Name: sg39081 Date: 08/27/97
with the input file:
package js.operators;
import antlr.collections.AST;
import js.lang.*;
public class BitwiseAndAssignCode extends BitwiseAndAssignCode {
public BitwiseAndAssignCode(ExecutionStack execution_stack) {
super("&=", execution_stack);
}
//////////////////////////////////////////////////////////////////////
// Section 11.13.2
//////////////////////////////////////////////////////////////////////
protected Object apply2(int result5, int result6) {
return new Integer(result5 & result6);
}
}
// note the mistake: subclassing itself
edinburgh[1626] /ufs1/emberson/work/js/operators > make
/usr/local/java/jdk1.2/bin/javac -g -d ../classes -classpath
../classes:./:./../..:/usr/local/java/jdk1.2/lib/classes.zip:/usr/local/java/JFC/swing-0.3/swing.jar:/usr/local/java/JFC/swing-0.3/rose.jar:/usr/local/java/jdk1.2/lib/classes.zip:.:./..:./../../.:./../../../.:./../../../../.:/ufs1/emberson/work/:/usr/local/java/antlr2.11
BitwiseAndAssignCode.java
java.lang.StackOverflowError
at sun.tools.javac.SourceClass.basicCheck(SourceClass.java:907)
at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:121)
at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java:675)
at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java:675)
many many more .....
sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java:675)
at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java:675)
at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java:675)
at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java:675)
at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java:675)
at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java:675)
at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java:675)
at sun.tools.java.ClassDefinition.getInnerClass(ClassDefinition.java:675)
at sun.tools.java.ClassDefinition.resolveName(ClassDefinition.java:863)
at sun.tools.java.Environment.resolveNames(Environment.java:222)
at sun.tools.java.Environment.resolveNames(Environment.java:241)
at sun.tools.javac.SourceField.resolveTypeStructure(SourceField.java:228)
at sun.tools.javac.SourceClass.resolveTypeStructure(SourceClass.java:976)
at sun.tools.javac.SourceClass.basicCheck(SourceClass.java:920)
at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:121)
at sun.tools.javac.Main.compile(Main.java:274)
at sun.tools.javac.Main.main(Main.java:467)
error: An error has occurred in the compiler; please file a bug report
(http://java.sun.com/cgi-bin/bugreport.cgi).
1 error
make: *** [../classes/js/operators/BitwiseAndAssignCode.class] Error 1
Whats funny is that I could not duplicate this with a simple
test case like:
package java.test;
public class Incest extends Incest {
public Incest() {
}
}
Here the compiler is ok giving one:
Incest.java:4: Cyclic class inheritance.
public class Incest extends Incest {
^
1 error
======================================================================
- duplicates
-
JDK-4073739 The compiler falls into an infinite loop instead of giving an error.
- Closed