-
Bug
-
Resolution: Fixed
-
P3
-
1.2.2, 1.3.0
-
beta
-
generic, sparc
-
generic, solaris_2.5.1
-
Verified
This problem has been reported by several people who have downloaded javac-ea.
FILE: EmptyBreak.java
/**
* @test %W% %E%
* @bug
* @summary Empty "default" statements should not cause the compiler to crash.
*
* @run clean EmptyBreak
* @run compile EmptyBreak.java
*/
// If the test fails to compile, then the bug exists.
public class EmptyBreak
{
public void foo(int i)
{
switch (i) {
default:
// empty!
break;
}
}
}
OUTPUT:
An exception has occurred in the compiler. (v0.8)
Please file a bug report by sending your program and the following diagnostic to
###@###.###.
Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:896)
at com.sun.tools.javac.v8.tree.Tree$Break.visit(Tree.java:606)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:351)
at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:364)
at com.sun.tools.javac.v8.comp.Gen.genStats(Gen.java:372)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:565)
at com.sun.tools.javac.v8.tree.Tree$Switch.visit(Tree.java:503)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:351)
at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:364)
at com.sun.tools.javac.v8.comp.Gen.genStats(Gen.java:372)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:493)
at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java:429)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:351)
at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:364)
at com.sun.tools.javac.v8.comp.Gen.genMethod(Gen.java:460)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:426)
at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java:387)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:351)
at com.sun.tools.javac.v8.comp.Gen.genClass(Gen.java:1410)
at com.sun.tools.javac.v8.JavaCompiler.genCode(JavaCompiler.java:261)
at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:358)
at com.sun.tools.javac.v8.Main.compile(Main.java:247)
at com.sun.tools.javac.Main.main(Main.java:16)
iris.garcia@eng 1999-05-14
FILE: EmptyBreak.java
/**
* @test %W% %E%
* @bug
* @summary Empty "default" statements should not cause the compiler to crash.
*
* @run clean EmptyBreak
* @run compile EmptyBreak.java
*/
// If the test fails to compile, then the bug exists.
public class EmptyBreak
{
public void foo(int i)
{
switch (i) {
default:
// empty!
break;
}
}
}
OUTPUT:
An exception has occurred in the compiler. (v0.8)
Please file a bug report by sending your program and the following diagnostic to
###@###.###.
Thank you.
java.lang.NullPointerException
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:896)
at com.sun.tools.javac.v8.tree.Tree$Break.visit(Tree.java:606)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:351)
at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:364)
at com.sun.tools.javac.v8.comp.Gen.genStats(Gen.java:372)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:565)
at com.sun.tools.javac.v8.tree.Tree$Switch.visit(Tree.java:503)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:351)
at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:364)
at com.sun.tools.javac.v8.comp.Gen.genStats(Gen.java:372)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:493)
at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java:429)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:351)
at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java:364)
at com.sun.tools.javac.v8.comp.Gen.genMethod(Gen.java:460)
at com.sun.tools.javac.v8.comp.Gen._case(Gen.java:426)
at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java:387)
at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java:351)
at com.sun.tools.javac.v8.comp.Gen.genClass(Gen.java:1410)
at com.sun.tools.javac.v8.JavaCompiler.genCode(JavaCompiler.java:261)
at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:358)
at com.sun.tools.javac.v8.Main.compile(Main.java:247)
at com.sun.tools.javac.Main.main(Main.java:16)
iris.garcia@eng 1999-05-14
- duplicates
-
JDK-4242806 javac of Kestrel-F fails to compile switch with the only default branch
- Closed
-
JDK-4256340 javac-ea (early access) crashes with NullPointerException
- Closed