Bug 136258 - Stack Overflow in compiler On Valid 100% Pure Java
Summary: Stack Overflow in compiler On Valid 100% Pure Java
Status: RESOLVED FIXED
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: 1.5.1   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 1.5.2   Edit
Assignee: AJDT-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-04-11 23:29 EDT by Ron Bodkin CLA
Modified: 2006-04-18 03:24 EDT (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ron Bodkin CLA 2006-04-11 23:29:54 EDT
I closed some projects to get rid of nagging exceptions from duplicate META-INF/aop.xml files. I'm using the latest dev build with 3.2M6. Incremental recompilation produced:

java.lang.StackOverflowError
at java.util.Vector.addElement(Vector.java:581)
at java.util.Stack.push(Stack.java:44)
at org.aspectj.bridge.context.CompilationAndWeavingContext.enteringPhase(CompilationAndWeavingContext.java:178)
at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.collectAllITDsAndDeclares(AjLookupEnvironment.java:319)
at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.doSupertypesFirst(AjLookupEnvironment.java:301)
at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.collectAllITDsAndDeclares(AjLookupEnvironment.java:329)
at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.doSupertypesFirst(AjLookupEnvironment.java:301)
at 
... (repeats many times)
at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.doSupertypesFirst(AjLookupEnvironment.java:301)
at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.collectAllITDsAndDeclares(AjLookupEnvironment.java:322)

StackOverflowError thrown: null
Comment 1 Ron Bodkin CLA 2006-04-11 23:43:51 EDT
It turns out I get this one with a full rebuild even when using ant. I must have some kind of cyclic dependency in the source with some recent edits I made. Lots of fun to debug...
Comment 2 Ron Bodkin CLA 2006-04-11 23:44:34 EDT
p.s. In use cases like this, I really miss the old AJDT build configuration files, which made it a lot easier to build a changing subset of files to track down compiler bugs.
Comment 3 Ron Bodkin CLA 2006-04-12 21:02:47 EDT
I have narrowed this bug down (by debugging the ajc run in an Eclipse workspace with the AspectJ modules checked out). This pure Java code causes the same stack overflow in ajc, but runs properly with javac:

public interface StatisticsType {
}

public class StatisticsTypeImpl implements StatisticsType {
    static class UIStatisticsType extends UofwStatisticsType {
    };

    public static void main(String argz[]) {
        System.out.println(new UIStatisticsType().toString());
    }
}

public class UofwStatisticsType extends StatisticsTypeImpl {
}

C:\devel\scratch\funWithTypes>javac *.java

C:\devel\scratch\funWithTypes>java StatisticsTypeImpl
StatisticsTypeImpl$UIStatisticsType@182f0db

C:\devel\scratch\funWithTypes>ajc *.java
C:\devel\scratch\funWithTypes\UofwStatisticsType.java [error] Internal compiler
error
java.lang.StackOverflowError
        at org.aspectj.bridge.context.CompilationAndWeavingContext.enteringPhase
(CompilationAndWeavingContext.java:176)
        at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.collect
AllITDsAndDeclares(AjLookupEnvironment.java:319)
        at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.doSuper
typesFirst(AjLookupEnvironment.java:301)
        at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.collect
AllITDsAndDeclares(AjLookupEnvironment.java:329)
        at org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment.doSuper
typesFirst(AjLookupEnvironment.java:301)
...
Comment 4 Andrew Clement CLA 2006-04-13 05:37:39 EDT
fix committed.  Remove the type earlier in the process so we don't loop round thinking we still need to deal with it.  Still might cause a problem with some wierd configuration of inter-dependendant types (wont overflow, but may fail to correctly apply ITDs).
Comment 5 Andrew Clement CLA 2006-04-18 03:24:04 EDT
fix available.