JDK-6178802 : Stack overflow in javac when using wildards in quantifier bounds
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 5.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: linux
  • CPU: x86
  • Submitted: 2004-10-13
  • Updated: 2010-04-02
  • Resolved: 2004-10-14
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
Other
5.0Resolved
Related Reports
Duplicate :  
Description
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