[cdi-dev] getBeanClass return value for build-in beans?

arjan tijms arjan.tijms at gmail.com
Tue Aug 11 06:26:48 EDT 2015


This is split-off from the thread "Bean<T> that only qualifies super
types?", where the question came up what a Bean<T> should return from
the getBeanClass() method for the case of build-in beans.

The JavaDoc for getBeanClass() currently says the following:

"The bean class of the managed bean or session bean or of the bean
that declares the producer method or field."

See: https://javaee-spec.java.net/nonav/javadocs/javax/enterprise/inject/spi/Bean.html#getBeanClass()

The case where a Bean<T> instance is directly created and added as
bean to AfterBeanDiscovery in an extension does not seem to be covered
by this documentation.

Weld returns "this.class" here.

See http://grepcode.com/file/repo1.maven.org/maven2/org.jboss.weld.se/weld-se/2.2.12.Final/org/jboss/weld/bean/builtin/AbstractDecorableBuiltInBean.java#71

Is that what build-in beans should always do, and if so, should the
JavaDoc/spec be clarified for this?

Kind regards,
Arjan Tijms

More information about the cdi-dev mailing list