Bug 339300

Summary: problem weaving anonymous inner (member owned) classes in scala library
Product: [Tools] AspectJ Reporter: Andrew Clement <aclement>
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 CC: romain.reuillon
Version: 1.6.10   
Target Milestone: 1.6.11   
Hardware: PC   
OS: Mac OS X - Carbon (unsup.)   
Whiteboard:

Description Andrew Clement CLA 2011-03-08 18:49:10 EST
Reported by Ramnivas.

Due to the use of numerous $ chars in scala classnames, some of the AspectJ handling of inner classes breaks down.  It should be possible to correctly use the available class attributes rather than mess around with attributes.  A while back one use did contribute a change to enable scala weaving which tried to use the InnerClasses attribute before falling back on string chopping.  However we have now hit another case.

In the scenario we are dealing with the class scala.Predef$$anon$3 in the scala library (a 2.9.0-SNAPSHOT version).  What we normally do here is in that type we discover the InnerClass attribute and refer to the outerclass index it holds.  Unfortunately, due to it being an anonymous inner inside a method, the index is 0.  So we fail to process the attribute and with string chopping come up with a stupid guessed name for the outer.

The solution is to use the EnclosingMethod attribute in these situations.  The EnclosingMethod attribute is an optional attribute. A class must have an EnclosingMethod attribute if and only if it is a local class or an anonymous class. A class may have no more than one EnclosingMethod attribute.

The EnclosingMethod attribute includes a pointer to the containing outerclass (that had the method in which encloses this inner type).
Comment 1 Andrew Clement CLA 2011-03-21 18:49:46 EDT
fix just made it into 1.6.11
Comment 2 Andrew Clement CLA 2011-03-21 18:55:12 EDT
*** Bug 337064 has been marked as a duplicate of this bug. ***