When compiling the following source:
class Test {
Test(Integer x) {}
void test() {
new Test(""){};
}
}
javac silently crashes. The crash is reproducible when the above program is compiled with the -XDdev hidden option - otherwise the only observable difference in javac's behavior is that any diagnostic following the one that is causing the crash will not be generated by javac.
Here's the javac output:
/usr/local/home/maurizio/Desktop/TestX.java:6: cannot find symbol
/usr/local/home/maurizio/Desktop/TestX.java:6: cannot find symbol
new Test(""){};
^
symbol: constructor Test(java.lang.String)
location: class Test
/usr/local/home/maurizio/Desktop/TestX.java:6: cannot find symbol
/usr/local/home/maurizio/Desktop/TestX.java:6: cannot find symbol
new Test(""){};
^
symbol: constructor Test()
location: class Test
An exception has occurred in the compiler (1.7.0-ea). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.code.Types$14.visitClassType(Types.java:1339)
at com.sun.tools.javac.code.Types$14.visitClassType(Types.java:1322)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:550)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3346)
at com.sun.tools.javac.code.Types.asSuper(Types.java:1319)
at com.sun.tools.javac.code.Types$14.visitClassType(Types.java:1335)
at com.sun.tools.javac.code.Types$14.visitClassType(Types.java:1322)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:550)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3346)
at com.sun.tools.javac.code.Types.asSuper(Types.java:1319)
at com.sun.tools.javac.code.Types$14.visitClassType(Types.java:1335)
at com.sun.tools.javac.code.Types$14.visitClassType(Types.java:1322)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:550)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3346)
at com.sun.tools.javac.code.Types.asSuper(Types.java:1319)
at com.sun.tools.javac.code.Types.asOuterSuper(Types.java:1379)
at com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:2367)
at com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:1582)
at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1344)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:394)
at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:418)
at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1102)
at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1139)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:394)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:438)
at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:454)
at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:800)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:762)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:394)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:438)
at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:720)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:650)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:394)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:438)
at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2826)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2752)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2688)
at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1120)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:846)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:808)
at com.sun.tools.javac.main.Main.compile(Main.java:400)
at com.sun.tools.javac.main.Main.compile(Main.java:318)
at com.sun.tools.javac.main.Main.compile(Main.java:309)
at com.sun.tools.javac.Main.compile(Main.java:82)
at com.sun.tools.javac.Main.main(Main.java:67)
Java Result: 4
class Test {
Test(Integer x) {}
void test() {
new Test(""){};
}
}
javac silently crashes. The crash is reproducible when the above program is compiled with the -XDdev hidden option - otherwise the only observable difference in javac's behavior is that any diagnostic following the one that is causing the crash will not be generated by javac.
Here's the javac output:
/usr/local/home/maurizio/Desktop/TestX.java:6: cannot find symbol
/usr/local/home/maurizio/Desktop/TestX.java:6: cannot find symbol
new Test(""){};
^
symbol: constructor Test(java.lang.String)
location: class Test
/usr/local/home/maurizio/Desktop/TestX.java:6: cannot find symbol
/usr/local/home/maurizio/Desktop/TestX.java:6: cannot find symbol
new Test(""){};
^
symbol: constructor Test()
location: class Test
An exception has occurred in the compiler (1.7.0-ea). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.code.Types$14.visitClassType(Types.java:1339)
at com.sun.tools.javac.code.Types$14.visitClassType(Types.java:1322)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:550)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3346)
at com.sun.tools.javac.code.Types.asSuper(Types.java:1319)
at com.sun.tools.javac.code.Types$14.visitClassType(Types.java:1335)
at com.sun.tools.javac.code.Types$14.visitClassType(Types.java:1322)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:550)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3346)
at com.sun.tools.javac.code.Types.asSuper(Types.java:1319)
at com.sun.tools.javac.code.Types$14.visitClassType(Types.java:1335)
at com.sun.tools.javac.code.Types$14.visitClassType(Types.java:1322)
at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:550)
at com.sun.tools.javac.code.Types$DefaultTypeVisitor.visit(Types.java:3346)
at com.sun.tools.javac.code.Types.asSuper(Types.java:1319)
at com.sun.tools.javac.code.Types.asOuterSuper(Types.java:1379)
at com.sun.tools.javac.comp.Attr.checkMethod(Attr.java:2367)
at com.sun.tools.javac.comp.Attr.visitNewClass(Attr.java:1582)
at com.sun.tools.javac.tree.JCTree$JCNewClass.accept(JCTree.java:1344)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:394)
at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:418)
at com.sun.tools.javac.comp.Attr.visitExec(Attr.java:1102)
at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1139)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:394)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:438)
at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:454)
at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:800)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:762)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:394)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:438)
at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:720)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:650)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:394)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:438)
at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2826)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2752)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2688)
at com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1120)
at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:846)
at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:808)
at com.sun.tools.javac.main.Main.compile(Main.java:400)
at com.sun.tools.javac.main.Main.compile(Main.java:318)
at com.sun.tools.javac.main.Main.compile(Main.java:309)
at com.sun.tools.javac.Main.compile(Main.java:82)
at com.sun.tools.javac.Main.main(Main.java:67)
Java Result: 4
- relates to
-
JDK-6723444 javac fails to substitute type variables into a constructor's throws clause
-
- Closed
-