FULL PRODUCT VERSION :
java version "1.5.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0-b64)
Java HotSpot(TM) Client VM (build 1.5.0-b64, mixed mode, sharing)
ADDITIONAL OS VERSION INFORMATION :
Linux [machine name] 2.6.3-7mdk-i686-up-4GB #1 Wed Mar 17 15:17:23 CET 2004 i686 unknown unknown GNU/Linux
Windows XP
A DESCRIPTION OF THE PROBLEM :
These two classes below bring the compiler down with a stack overflow.
interface AA<Z extends AA<Z>> {
public <X extends AA<X>> Z m(X that);
}
class BB<Z extends AA<Z>> {
public <X extends AA<? extends X>> boolean m(AA<X> that) { }
}
Note that removing the "? extends" avoids the stack overflow.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Compile only.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
I'd expect thecompiler not to crash, and moreover to issue at least one error since that method returns nothing for a boolean result.
ACTUAL -
A long stack trace which begins:
The system is out of resources.
Consult the following stack trace for details.
java.lang.StackOverflowError
at com.sun.tools.javac.code.Types.lowerBound(Types.java:112)
at com.sun.tools.javac.code.Types.convert(Types.java:2698)
at com.sun.tools.javac.code.Types.capture(Types.java:2679)
at com.sun.tools.javac.code.Types$IsSubTypeFcn.isSubType(Types.java:338)
at com.sun.tools.javac.code.Types$IsSubTypeFcn.visitType(Types.java:384)
at com.sun.tools.javac.code.Type$Visitor.visitTypeVar(Type.java:958)
at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:790)
at com.sun.tools.javac.code.Types$IsSubTypeFcn.isSubType(Types.java:344)
at com.sun.tools.javac.code.Types.isSubType(Types.java:327)
at com.sun.tools.javac.code.Types.convert(Types.java:2703)
at com.sun.tools.javac.code.Types.capture(Types.java:2679)
at com.sun.tools.javac.code.Types$IsSubTypeFcn.isSubType(Types.java:338)
at com.sun.tools.javac.code.Types$IsSubTypeFcn.visitType(Types.java:384)
at com.sun.tools.javac.code.Type$Visitor.visitTypeVar(Type.java:958)
at com.sun.tools.javac.code.Type$TypeVar.accept(Type.java:790)
at com.sun.tools.javac.code.Types$IsSubTypeFcn.isSubType(Types.java:344)
at com.sun.tools.javac.code.Types.isSubType(Types.java:327)
at com.sun.tools.javac.code.Types.convert(Types.java:2703)
at com.sun.tools.javac.code.Types.capture(Types.java:2679)
The last line I see on my screen is
at com.sun.tools.javac.code.Types$IsSubTypeFcn.isSubType(Types.java:344)
REPRODUCIBILITY :
This bug can be reproduced always.
###@###.### 10/13/04 22:07 GMT