Bug 90827 - StackOverflow while weaving enum/annotation with Enum/Annotation name
Summary: StackOverflow while weaving enum/annotation with Enum/Annotation name
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.0M2   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 1.5.0 M3   Edit
Assignee: Adrian Colyer CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-04-08 13:04 EDT by Michal Stochmialek CLA
Modified: 2005-06-08 11:05 EDT (History)
0 users

See Also:


Attachments
sources and ajcore files (9.33 KB, application/octet-stream)
2005-04-08 13:06 EDT, Michal Stochmialek CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michal Stochmialek CLA 2005-04-08 13:04:21 EDT
While compiling single simple annotation or enum, weaver goes into
infinitive loop, which ends with StackOverFlowException.

I attached sources (Annotation.java and Enum.java) and ajcore.*.txt
files from Sun JDK 1.5.0.02 and JRockit 1.5, since they give
different ajcore files (different stack trace). So archive
contains 4 ajcore files.


I'm using Linux with JDK JRockit 1.5 and AspectJ 1.5.0M2.
Comment 1 Michal Stochmialek CLA 2005-04-08 13:06:06 EDT
Created attachment 19690 [details]
sources and ajcore files
Comment 2 Michal Stochmialek CLA 2005-04-08 14:32:53 EDT
The cause of the problem is the name of annotation and enum
('Annotation', 'Enum'). When I change those names, the problem
dissapears.
Comment 3 Andrew Clement CLA 2005-04-11 05:45:32 EDT
take a look in the parser when its open for Eclipse M6 compiler integration
Comment 4 Michal Stochmialek CLA 2005-04-11 11:45:32 EDT
I tried to create annotation named 'Annotation' with eclipse 3.1M6
and ajdt 1.2.0.20050407142843, and I got similar error (but in dialog):
'StackOverflowError: null'. The same for enum named 'Enum'.
Comment 5 Andrew J Huff CLA 2005-05-06 10:48:59 EDT
enum AnEnum {A,B,C} // ok
//enum Enum {A,B,C} // dies

@interface anInterface {} // ok
//@interface Annotation {} // dies

============= for the enum called Enum:

java.lang.StackOverflowError
	at java.util.HashMap.hash(HashMap.java:264)
	at java.util.HashMap.get(HashMap.java:320)
	at org.aspectj.weaver.World$TypeMap.get(World.java:543)
	at org.aspectj.weaver.World.resolve(World.java:124)
	at org.aspectj.weaver.World.resolve(World.java:109)
	at org.aspectj.weaver.World.resolve(World.java:152)
	at org.aspectj.weaver.bcel.BcelWeaver.weaveParentsFor(BcelWeaver.java:1034)
	at org.aspectj.weaver.bcel.BcelWeaver.weaveParentsFor(BcelWeaver.java:1037)
	at org.aspectj.weaver.bcel.BcelWeaver.weaveParentsFor(BcelWeaver.java:1037)
... etc

============================ for the annotation called Annotation:

java.lang.StackOverflowError
	at java.util.HashMap.get(HashMap.java:320)
	at org.aspectj.weaver.World$TypeMap.get(World.java:543)
	at org.aspectj.weaver.World.resolve(World.java:124)
	at org.aspectj.weaver.World.resolve(World.java:109)
	at org.aspectj.weaver.World.resolve(World.java:152)
	at org.aspectj.weaver.bcel.BcelWeaver.weaveParentsFor(BcelWeaver.java:1034)
	at org.aspectj.weaver.bcel.BcelWeaver.weaveParentsFor(BcelWeaver.java:1045)
	at org.aspectj.weaver.bcel.BcelWeaver.weaveParentsFor(BcelWeaver.java:1045)
... etc
Comment 6 Andrew J Huff CLA 2005-05-09 06:33:48 EDT
Think I've fixed this.
I've sent my patch+test to Andy Clement, who'll maybe put it in the dev version
some time.


The problem was in BcelWeaver.java where it tries weaving the parent types for
things. It was confusing the names you declared (Enum etc) with the names of
classes declared inside AspectJ. To fix this ambiguity I prefixed all the names
of types with their package.
Comment 7 Andrew Clement CLA 2005-05-10 12:04:56 EDT
Fix checked in - waiting on build before closing.
Comment 8 Andrew Clement CLA 2005-06-08 11:05:13 EDT
Fix available in latest dev build.