[ 
https://issues.apache.org/jira/browse/OWB-569?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13033902#comment-13033902
 ] 

Mark Struberg commented on OWB-569:
-----------------------------------

Hi Arne!

I'd like to clear up a few conceptional ideas behind the original code first.
This area of OpenWebBeans is pretty complicated, thus I need to go back and 
think about a few details too.

a) The AnnotatedTypeImpl initially gets constructed from the annotations and 
information available at the class. Then this information gets handed over to 
all Extensions observing the ProcessAnnotatedType system event. If an Extension 
changes the content of the AnnotatedType (by wrapping it/setting a different 
one) then we use this one for the further processing. OWB decides this if 
ProcessAnnotatedTypeImpl#set == true (I gonna change the name of this variable 
to 'modifiedAnnotatedType' ^^) 

But the fact remains that we originally need to create the AnnotatedTypeImpl 
from the information (types, annotations) of the class/producer we scan.

b) The reason why the init() method exists at all is due to the (imo unlucky) 
fact that the spec needs us to pick up all classes as @Dependent if they don't 
have en explicit JSR-299 scope. The problem was that we really did create tons 
of unnecessary AnnotatedTypeImpls for classes which never got used for 
injection at all! Thus we create the AnnotatedType for beans which have no 
explicit scope annotation lazily on the first use. We decide upon a 
constructor==null (every class has at least 1 ct) if this lazy initialization 
is still needed. But in this case we not only initialize the constructor but 
ALL the information of the AnnotatedTypeImpl. 

Maybe there is a call to init() missing somewhere, but it should work as is.

If you did hit a problem somewhere, then it would really help if you could 
create a small sample (or even better a unit test) for it.

Btw, you are pretty deep in the codebase already, so heads up - this is really 
complicated stuff ;)

> OpenWebBeans uses the Java Reflection API to discover program element types 
> and annotations in addition to the AnnotatedType
> ----------------------------------------------------------------------------------------------------------------------------
>
>                 Key: OWB-569
>                 URL: https://issues.apache.org/jira/browse/OWB-569
>             Project: OpenWebBeans
>          Issue Type: Bug
>            Reporter: Arne Limburg
>            Assignee: Gurkan Erdogdu
>         Attachments: OWB-569.patch
>
>
> OpenWebBeans uses the Java Reflection API to discover program element types 
> and annotations in addition to the AnnotatedType, but the spec says it must 
> use the AnnotatedType INSTEAD of directly calling the Java Reflection API.
> This must be fixed in WebBeansAnnotatedTypeUtil in defineInjectedMethods and 
> defineInjectedFields, where 
> DefinitionUtil.defineInternalInjectedMethodsRecursively and 
> DefinitionUtil.defineInternalInjectedFieldsRecursively is called.
> Instead of this, the AnnotatedTypeImpl must contain methods and fields of 
> superclasses.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to