[cdi-dev] ProcessSessionBean type declaration
mkouba at redhat.com
Tue Jul 10 10:20:38 EDT 2012
Dne 3.7.2012 14:57, Pete Muir napsal(a):
> 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?
Not really. AFAIK the bean class of a session bean is the implementation type - no relation to bean types (e.g. FooBean for FooBean implements FooLocal). You have to observe ProcessSessionBean<FooBean> not ProcessSessionBean<FooLocal>. So I don't think there is something wrong with AnnotatedType<X> or Bean<X>. Maybe I'm still missing something...
BTW this declaration "ProcessSessionBean<X> extends ProcessManagedBean<Object>" prevents from observing lifecycle events like ProcessBean<FooBean> which is not very intuitive IMHO.
>> Also there is no comment for type parameter X.
> Bug, please raise an issue :-)
>> 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
More information about the cdi-dev