[ 
https://issues.jboss.org/browse/WELD-991?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jozef Hartinger updated WELD-991:
---------------------------------

    Labels: backport_weld1x  (was: )

    
> Incorrect check of bean type when obtaining contextual reference via 
> BeanManager#getReference()
> -----------------------------------------------------------------------------------------------
>
>                 Key: WELD-991
>                 URL: https://issues.jboss.org/browse/WELD-991
>             Project: Weld
>          Issue Type: Bug
>    Affects Versions: 1.1.2.Final
>            Reporter: Martin Kouba
>            Assignee: Jozef Hartinger
>              Labels: backport_weld1x
>             Fix For: 2.0.0.Alpha3
>
>
> CDI 1.0 section *11.3.1 Obtaining a contextual reference for a bean* states:
> "If the given type is not a bean type of the given bean, an 
> IllegalArgumentException is thrown."
> However no such exception is thrown. Refer to CDI TCK test [1].
> After inspecting the source code I suppose the problem is probably related to 
> following part of 
> *org.jboss.weld.manager.BeanManagerImpl.getReference(Bean<?>, Type, 
> CreationalContext<?>)*:
> {code}
> if (!Reflections.isAssignableFrom(bean.getTypes(), beanType))
> {
>  throw new IllegalArgumentException(SPECIFIED_TYPE_NOT_BEAN_TYPE, beanType, 
> bean );
> }
> {code}
> All beans have the bean type *java.lang.Object* (2.2. Bean types) - since 
> java.lang.Object is assignable from any class 
> *Reflections.isAssignableFrom(bean.getTypes(), beanType)* will always return 
> true.
> [1] 
> https://github.com/jboss/cdi-tck/blob/master/impl/src/main/java/org/jboss/jsr299/tck/tests/lookup/manager/ManagerTest.java

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        
_______________________________________________
weld-issues mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/weld-issues

Reply via email to