FULL PRODUCT VERSION :
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Server VM (build 19.0-b09, mixed mode)
also fails on 1.6.0_12 and 1.6.0_17
ADDITIONAL OS VERSION INFORMATION :
Fails on all platforms:
Linux lonrs01505 2.6.9-42.0.8.ELsmp #1 SMP Tue Jan 23 12:49:51 EST 2007 x86_64 x86_64 x86_64 GNU/Linux
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When trying to compile the provided code sample, javac fails with an exception trace.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Please try to compile the provided java class to reproduce the problem.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should print the following to STDOUT:
test
ACTUAL -
Code does not compile due to an internal error inside java compiler.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.6.0_23). 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.AssertionError: details.e.toString
at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:1949)
at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1835)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1522)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:377)
at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1241)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1210)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:377)
at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:683)
at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:691)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:397)
at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:413)
at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:715)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:739)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:397)
at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:634)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:639)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:397)
at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2697)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2628)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2564)
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:353)
at com.sun.tools.javac.main.Main.compile(Main.java:279)
at com.sun.tools.javac.main.Main.compile(Main.java:270)
at com.sun.tools.javac.Main.compile(Main.java:69)
at com.sun.tools.javac.Main.main(Main.java:54)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package sandbox.test11;
public class Test {
static class Node<E> {
class Details {
E e;
Details(final E e) {
this.e = e;
}
}
Details details;
Details getDetails() {
return details;
}
Details createDetails(E e){
details = new Details(e);
return details;
}
}
public Test(Node<? extends CharSequence> node) {
Node<? extends CharSequence>.Details details = node.getDetails();
// String str = ((CharSequence) details.e).toString();
String str = details.e.toString(); // Bang!
System.out.println(str);
}
public static void main(String[] args) {
Node<String> node = new Node<String>();
node.createDetails("test");
new Test(node);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Casting explicitly to CharSequence makes code compilable and it runs as expected. Try uncommenting the commented out line in the example and commenting out the line below.
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Server VM (build 19.0-b09, mixed mode)
also fails on 1.6.0_12 and 1.6.0_17
ADDITIONAL OS VERSION INFORMATION :
Fails on all platforms:
Linux lonrs01505 2.6.9-42.0.8.ELsmp #1 SMP Tue Jan 23 12:49:51 EST 2007 x86_64 x86_64 x86_64 GNU/Linux
Microsoft Windows XP [Version 5.1.2600]
A DESCRIPTION OF THE PROBLEM :
When trying to compile the provided code sample, javac fails with an exception trace.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Please try to compile the provided java class to reproduce the problem.
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
Should print the following to STDOUT:
test
ACTUAL -
Code does not compile due to an internal error inside java compiler.
ERROR MESSAGES/STACK TRACES THAT OCCUR :
An exception has occurred in the compiler (1.6.0_23). 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.AssertionError: details.e.toString
at com.sun.tools.javac.comp.Attr.selectSym(Attr.java:1949)
at com.sun.tools.javac.comp.Attr.visitSelect(Attr.java:1835)
at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1522)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:377)
at com.sun.tools.javac.comp.Attr.visitApply(Attr.java:1241)
at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1210)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
at com.sun.tools.javac.comp.Attr.attribExpr(Attr.java:377)
at com.sun.tools.javac.comp.Attr.visitVarDef(Attr.java:683)
at com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:691)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:397)
at com.sun.tools.javac.comp.Attr.attribStats(Attr.java:413)
at com.sun.tools.javac.comp.Attr.visitBlock(Attr.java:715)
at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:739)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:397)
at com.sun.tools.javac.comp.Attr.visitMethodDef(Attr.java:634)
at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:639)
at com.sun.tools.javac.comp.Attr.attribTree(Attr.java:360)
at com.sun.tools.javac.comp.Attr.attribStat(Attr.java:397)
at com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:2697)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2628)
at com.sun.tools.javac.comp.Attr.attribClass(Attr.java:2564)
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:353)
at com.sun.tools.javac.main.Main.compile(Main.java:279)
at com.sun.tools.javac.main.Main.compile(Main.java:270)
at com.sun.tools.javac.Main.compile(Main.java:69)
at com.sun.tools.javac.Main.main(Main.java:54)
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
package sandbox.test11;
public class Test {
static class Node<E> {
class Details {
E e;
Details(final E e) {
this.e = e;
}
}
Details details;
Details getDetails() {
return details;
}
Details createDetails(E e){
details = new Details(e);
return details;
}
}
public Test(Node<? extends CharSequence> node) {
Node<? extends CharSequence>.Details details = node.getDetails();
// String str = ((CharSequence) details.e).toString();
String str = details.e.toString(); // Bang!
System.out.println(str);
}
public static void main(String[] args) {
Node<String> node = new Node<String>();
node.createDetails("test");
new Test(node);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Casting explicitly to CharSequence makes code compilable and it runs as expected. Try uncommenting the commented out line in the example and commenting out the line below.
- duplicates
-
JDK-6886247 regression: javac crashes with an assertion error in Attr.java
-
- Closed
-