Bug 336654 - problem with hierarchy weaving when using sophisticated ITDs
Summary: problem with hierarchy weaving when using sophisticated ITDs
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: DEVELOPMENT   Edit
Hardware: PC Windows 7
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-08 15:59 EST by Andrew Clement CLA
Modified: 2011-02-08 16:00 EST (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Clement CLA 2011-02-08 15:59:12 EST
In the springdata project they have a numerous ITDs, both declare parents and regular method/field ITDs.

At one particular point during compilation they are compiling a type NodeBacked (a type with ITDs on it), a subtype of it called Car and two subtypes of that called Volvo and Toyota (test classes).

Volvo needs to implement a particular method and should be inheriting the implementation from the NodeBacked type.  The same thing should happen for Toyota.

However, what happens, due to pipelining, is that Volvo is confirmed to inherit the method (at compile time) then gets into the weaver, the weaver likes to ensure the parent type hierarchy is setup correctly so goes up the hierarchy and weaves any declare parents in - all before Volvo is woven.  Unfortunately the walking up the hierarchy will clear any type mungers registered against a type (clearing the eclipse form of the type mungers) before it replaces them with the bcel equivalent parent mungers.  The clearing removes the implentation method that we were relying on from NodeBacked.  If Toyota is then processed *before* we reach (and repair) NodeBacked, then Toyota will apparently be missing an implementation.

There is an inconsistency here and a few options for fixing it.

The inconsistent is that the parent weaving runs up the supertype chain, clearing out all mungers, it then adds the parent mungers in as it comes back down *but* doesnt add the regular mungers (ITD methods).  It only adds those to the type itself (Volvo).  Fixing this inconsistency seems like it would disturb quite a bit of code and slow things down.

The alternative is that we don't rush up the chain clearing out type mungers, we only clear them out if we are about to repair them properly with bcel type mungers.  If we aren't about to weave them and get them correct, we leave them alone.  This change fixes the springdata case and passes all existing testcases.
Comment 1 Andrew Clement CLA 2011-02-08 16:00:06 EST
This means after Volvo has been processed, if we hit Toyota next it will still find the ITDs on NodeBacked (they will be in their eclipse form).  If NodeBacked is hit before Toyota, the ITDs will transform from eclipse form to bcel form, and Toyota will still find them when it is later processed.