JDK-6556683 : Illegal type variable bound cause compiler crash
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 7
  • Priority: P3
  • Status: Closed
  • Resolution: Cannot Reproduce
  • OS: generic
  • CPU: generic
  • Submitted: 2007-05-12
  • Updated: 2010-04-02
  • Resolved: 2008-12-03
Related Reports
Relates :  
Description
This program causes a compiler crash (with -XDdev):

class Test {
    public static <T extends U & Test, U> T max() {
        return null;
    }
}

java.lang.ClassCastException: com.sun.tools.javac.code.Symbol$TypeSymbol cannot be cast to com.sun.tools.javac.code.Symbol$ClassSymbol
        at com.sun.tools.javac.comp.Check.checkImplementations(Check.java:1544)
        at com.sun.tools.javac.comp.Check.checkImplementations(Check.java:1535)
        at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2722)
        at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2652)
        at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2588)
        at com.sun.tools.javac.comp.Attr.attribBounds(Attr.java:466)
        at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:570)
        at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:640)
        at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:358)
        at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:395)
        at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2726)
        at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2652)
        at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2588)
        at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1036)
        at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:765)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:730)
        at com.sun.tools.javac.main.Main.compile(Main.java:366)
        at com.sun.tools.javac.main.Main.compile(Main.java:292)
        at com.sun.tools.javac.main.Main.compile(Main.java:283)
        at com.sun.tools.javac.Main.compile(Main.java:69)
        at com.sun.tools.javac.Main.main(Main.java:54)

Comments
EVALUATION Not reproducible in 7 (b38)
03-12-2008

EVALUATION A class cast exception causes by insufficient error recovery.
12-05-2007