[cdi-dev] ProcessSessionBean type declaration

Pete Muir pmuir at redhat.com
Tue Jul 3 08:57:50 EDT 2012

On 26 Jun 2012, at 15:21, Martin Kouba wrote:

> Hello everyone,
> does anyone know why ProcessSessionBean type declaration is "ProcessSessionBean<X> extends ProcessManagedBean<Object>" and not "ProcessSessionBean<X> extends ProcessManagedBean<X>"?

The bean types of most beans (managed beans, producers) are defined by the type of the object defining the bean. 

The bean types of a session bean are defined by it's local views, as defined by the EJB spec. These might include the defining type (no-interface view), super-interfaces of the type (when defined using the classic Foo implements Bar, Baz, with @Local on interfaces) or interfaces not in the type hierarchy (when defined using @Local on the defining type).

ProcessManagedBean allows access to AnnotatedType<X>, where X is the bean class.

Putting this together, we can see there is a problem as X, as the bean class may have no relationship to the bean type, in the java type hierarchy (which is clearly crazy, but anyway). For this reason, we choose to simply avoid this whole problem by forcing people to do a cast on getAnnotatedBeanClass.

Does that make sense?

> Also there is no comment for type parameter X.

Bug, please raise an issue :-)

> Thanks
> Martin
> -- 
> Martin Kouba
> JBoss Quality Assurance Engineer
> CDI TCK lead
> E-mail: mkouba at redhat.com
> Web: www.cz.redhat.com
> Red Hat Czech s.r.o., Purkyňova 99/71, 612 45, Brno, Czech Republic
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev

More information about the cdi-dev mailing list