Bug 290137 - StackOverflowError: infinite recursion in org.aspectj.weaver.ReferenceType.isAssignableFrom()
Summary: StackOverflowError: infinite recursion in org.aspectj.weaver.ReferenceType.is...
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P2 normal (vote)
Target Milestone: 1.6.8   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-09-22 11:10 EDT by Troy Anderson CLA
Modified: 2010-01-08 19:22 EST (History)
1 user (show)

See Also:


Attachments
Java file that breaks iajc (3.83 KB, text/plain)
2009-09-22 11:14 EDT, Troy Anderson CLA
no flags Details
Aspects applied (3.70 KB, application/x-zip-compressed)
2009-09-22 16:54 EDT, Troy Anderson CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Troy Anderson CLA 2009-09-22 11:10:22 EDT
User-Agent:       Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.0; Trident/4.0; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2; .NET CLR 3.5.30729; .NET CLR 3.0.30618; OfficeLivePatch.1.3; OfficeLiveConnector.1.4)
Build Identifier: AspectJ 1.6.5

When compiling one of my classes with iacj, I get the following output:

	
Exception thrown from AspectJ 1.6.5

This might be logged as a bug already -- find current bugs at
  http://bugs.eclipse.org/bugs/buglist.cgi?product=AspectJ&component=Compiler

Bugs for exceptions thrown have titles File:line from the top stack, 
e.g., "SomeFile.java:243"

If you don't find the exception below in a bug, please add a new bug
at http://bugs.eclipse.org/bugs/enter_bug.cgi?product=AspectJ
To make the bug a priority, please include a test program
that can reproduce this exception.

when weaving type com.webroot.models.account.OneToMany
when weaving classes 
when weaving 
when batch building BuildConfig[null] #Files=198 AopXmls=#0
null
java.lang.StackOverflowError
	at java.lang.ref.ReferenceQueue.poll(ReferenceQueue.java:82)
	at java.util.WeakHashMap.expungeStaleEntries(WeakHashMap.java:274)
	at java.util.WeakHashMap.getTable(WeakHashMap.java:302)
	at java.util.WeakHashMap.get(WeakHashMap.java:349)
	at java.util.Collections$SynchronizedMap.get(Collections.java:1975)
	at org.aspectj.weaver.World$TypeMap.get(World.java:1036)
	at org.aspectj.weaver.World.resolve(World.java:255)
	at org.aspectj.weaver.World.resolve(World.java:192)
	at org.aspectj.weaver.UnresolvedType.resolve(UnresolvedType.java:625)
	at org.aspectj.weaver.ReferenceType.getRawType(ReferenceType.java:733)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:389)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:363)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:389)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:363)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:389)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:363)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:389)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:363)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:389)
	at org.aspectj.weaver.ReferenceType.isAssignableFrom(ReferenceType.java:363)
...

Reproducible: Always




Will attach java class that causes the exception.
Comment 1 Troy Anderson CLA 2009-09-22 11:14:26 EDT
Created attachment 147786 [details]
Java file that breaks iajc
Comment 2 Andrew Clement CLA 2009-09-22 16:37:45 EDT
unfortunately I cannot reproduce the problem.  I probably need to know what aspect you are using against that java class - are you able to include it?

Compiling that code standalone just works (with the necessary annotations stubbed out), or compiling it with an aspect containing:

before(): within(*) {}

just works.  It must be something about the pointcuts in use that cause the type analysis that leads to the recursion.
Comment 3 Troy Anderson CLA 2009-09-22 16:54:12 EDT
Created attachment 147837 [details]
Aspects applied

Here are the asspects applied
Comment 4 Andrew Clement CLA 2009-09-23 16:07:07 EDT
hmm, unfortunately even with the aspects compiled against that type, I can't trigger the failure.  It is possible due to the other types that are missing - I'm just stubbing them out when their inter relationships may be important to drive the failure case.
Comment 5 Andrew Clement CLA 2010-01-08 19:22:40 EST
Believed fixed!  Reported as occurring more frequently against 1.6.7 and knowing what I had changed in that release led me to find the cause.  Discussed fully in https://bugs.eclipse.org/bugs/show_bug.cgi?id=298908

fix is in 1.6.8