[
https://issues.apache.org/jira/browse/LABS-280?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12665208#action_12665208
]
Simone Gianni commented on LABS-280:
------------------------------------
The problem is quite complicated, what happens is :
- The bytecode is retrieved (as a byte[] )
- The bytecode is passed to the AspectJ weaver, that weaves it
- The bytecode is then sent to the OpenJPA enhancer
... Serp (used by OpenJPA) reads the bytecode correctly
... OpenJPA then asks Serp for the Class
... Serp has not defined the parsed bytes as a class on the classloader, nor
has done OpenJPA (I think this is a bug)
... So, Serp simply fetches the bytecode again from the classloader
... The returned bytecode is fetched again, so IT IS NOT WEAVED
... OpenJPA enhances the class, but believe it or not, it is enhancing the
correct byte[] but using the old metadata
... The bytecode is returned, it is OpenJPA enhanced, but misses stuff added by
aspectj.
I tried saving the AspectJ transformed class to a temporary file and return the
URL of that file to Serp, to see if that could be a solution, but it is not
both because of performance and because Serp will try to resolve the class, and
load other classes in the mean while, which are not catched by AspectJ at all
since it's the OpenJPA classloader that is loading them directly thru URLs.
A final solution could be to setup a complete classloader chain, having the
AspectJ weaving classloader operate in terms of resources directly, and serving
to child classloader rewritten URLs that point to a storage of already weaved
classes.
This could also be the base for caching of LTW transformed classes required by
RAD.
> [database] OpenJPA does not see ITD properties
> ----------------------------------------------
>
> Key: LABS-280
> URL: https://issues.apache.org/jira/browse/LABS-280
> Project: Labs
> Issue Type: Bug
> Components: Magma
> Affects Versions: Current
> Reporter: Simone Gianni
> Assignee: Simone Gianni
> Fix For: Current
>
>
> AspectJ weaving should happen before OpenJPA enhancement. While this seems to
> be the case both in the LTW environment and in the compile time environment,
> adding a property to an entity bean using ITD is not seen by OpenJPA.
> If it is not a problem of class weaving ordering, then proper inspection of
> how OpenJPA enhancer find which properties are present in a class is
> required, understanding why AspectJ ITDs are not taken into consideration
> (for example, are they marked synthetic? bridged? is the fact that the field
> is private to the aspect a problem for the OpenJPA enhancer?)
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]