+1

2014-09-09 10:38 GMT+02:00 Antoine Sabot-Durand (JIRA) <issues@jboss.org>:

    [ https://issues.jboss.org/browse/CDI-456?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13000169#comment-13000169 ]

Antoine Sabot-Durand commented on CDI-456:
------------------------------------------

We all know there are issues with the Java EE module architecture. This has to be fix at Java EE level and CDI spec will have to follow not the other way around.
Now, regarding this ticket I think Jozef explained more than once why {{Bean#getBeanClass()}} should behave this way.  Yet I understand the need to get the exact type of a given bean instances. So IMO we should split this ticket in 2 :

# Clarify the javadoc and spec description of {{Bean#getBeanClass()}} to avoid confusion
# Add a new method to {{Bean}} returning the exact type of the bean instances. something like {{Bean#getInstanceClass()}}



> fix Bean#getBeanClass() definition
> ----------------------------------
>
>                 Key: CDI-456
>                 URL: https://issues.jboss.org/browse/CDI-456
>             Project: CDI Specification Issues
>          Issue Type: Bug
>          Components: Beans
>            Reporter: Mark Struberg
>
> currently Bean#getBeanClass() is defined to return the class of the bean it produces but has one important exception: in case of a producer method or field it must return the class of the owner bean of this method or field.
> Imo this only causes troubles and doesn't add any benefit.
> * At the time when 'using' the Bean (create and destroy) we always ONLY need the type which is to be created.
> * At the time we create interceptors we ONLY need the type which is to be created;
> * At the time we create the normalscoping proxies we ONLY need the type which is to be created;
> In fact the only time we need the ownerBean is when scanning the methods and fields in it. And for creating we really need the owner-Bean and not it's bean-class!
> In OWB we worked around this by having our own method getReturnType() which consistently returns the type which gets created.



--
This message was sent by Atlassian JIRA
(v6.3.1#6329)
_______________________________________________
cdi-dev mailing list
cdi-dev@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/cdi-dev

Note that for all code provided on this list, the provider licenses the code under the Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html). For all other ideas provided on this list, the provider waives all patent and other intellectual property rights inherent in such information.



--
Anatole Tresch
Java Lead Engineer, JSR Spec Lead
Glärnischweg 10
CH - 8620 Wetzikon

Switzerland, Europe Zurich, GMT+1
Twitter:  @atsticks
Blogs: http://javaremarkables.blogspot.ch/
Google: atsticks
Mobile  +41-76 344 62 79