Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4242806

javac of Kestrel-F fails to compile switch with the only default branch

XMLWordPrintable

    • sparc
    • solaris_2.5.1



      Name: avC70361 Date: 06/01/99



        The java compiler of jdk1.3(build JDK1.3-F) fails to compile a switch statement with the only default
      branch followed by break operator. The compiler throws unexpected NullPointerException.

      Here is a test demonstrating the bug.
      ----------SwitchTest.java---------------
      public class SwitchTest {
          public SwitchTest() {
              switch(0) {
                  default : break;
              }
          }
      }
      --------The test compilation output---------
      > java -version
      java version "1.3"
      Classic VM (build JDK-1.3-F, green threads, sunwjit)
      > javac SwitchTest.java


      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, Compiled Code)
              at com.sun.tools.javac.v8.tree.Tree$Break.visit(Tree.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen.genStats(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen._case(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.tree.Tree$Switch.visit(Tree.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen.genStats(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen._case(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen.genStat(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen.genMethod(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen._case(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen.genDef(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.comp.Gen.genClass(Gen.java, Compiled Code)
              at com.sun.tools.javac.v8.JavaCompiler.genCode(JavaCompiler.java, Compiled Code)
              at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java, Compiled Code)
              at com.sun.tools.javac.v8.Main.compile(Main.java, Compiled Code)
              at com.sun.tools.javac.Main.main(Main.java, Compiled Code)

      ======================================================================

            iris Iris Clark
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: