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

found a compiler bug in switch/case statement

XMLWordPrintable

    • x86_64
    • windows_7

      FULL PRODUCT VERSION :
      java version "1.7.0"
      Java(TM) SE Runtime Environment (build 1.7.0-b147)
      Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows 7 [Version 6.1.7601]

      A DESCRIPTION OF THE PROBLEM :
      I wrote switch/case statemnt in wrong format but compiler raised not suitable error.

      REGRESSION. Last worked in version 7u80

      ADDITIONAL REGRESSION INFORMATION:
      java version "1.7.0"
      Java(TM) SE Runtime Environment (build 1.7.0-b147)
      Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)


      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      Information:Using javac 1.7.0 to compile java sources
      Information:java: An exception has occurred in the compiler (1.7.0). 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.
      Information:java: java.lang.NullPointerException
      Information:java: at com.sun.tools.javac.comp.Lower.visitStringSwitch(Lower.java:3456)
      Information:java: at com.sun.tools.javac.comp.Lower.visitSwitch(Lower.java:3357)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCSwitch.accept(JCTree.java:959)
      Information:java: at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      Information:java: at com.sun.tools.javac.comp.Lower.translate(Lower.java:2160)
      Information:java: at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)
      Information:java: at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:160)
      Information:java: at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:3311)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:781)
      Information:java: at com.sun.tools.javac.tree.TreeTranslator.visitMethodDef(TreeTranslator.java:144)
      Information:java: at com.sun.tools.javac.comp.Lower.visitMethodDefInternal(Lower.java:2619)
      Information:java: at com.sun.tools.javac.comp.Lower.visitMethodDef(Lower.java:2538)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:669)
      Information:java: at com.sun.tools.javac.comp.Lower.visitClassDef(Lower.java:2283)
      Information:java: at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:591)
      Information:java: at com.sun.tools.javac.comp.Lower.translate(Lower.java:2180)
      Information:java: at com.sun.tools.javac.comp.Lower.translateTopLevelClass(Lower.java:3650)
      Information:java: at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1393)
      Information:java: at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1271)
      Information:java: at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:870)
      Information:java: at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:829)
      Information:java: at com.sun.tools.javac.main.Main.compile(Main.java:417)
      Information:java: at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
      Information:java: at org.jetbrains.jps.javac.JavacMain.compile(JavacMain.java:168)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compileJava(JavaBuilder.java:382)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.compile(JavaBuilder.java:296)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.doBuild(JavaBuilder.java:204)
      Information:java: at org.jetbrains.jps.incremental.java.JavaBuilder.build(JavaBuilder.java:176)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1196)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:877)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:945)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:840)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:663)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:370)
      Information:java: at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:191)
      Information:java: at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:137)
      Information:java: at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:293)
      Information:java: at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:124)
      Information:java: at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:242)
      Information:java: at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:41)
      Information:java: at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
      Information:java: at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
      Information:java: at java.util.concurrent.FutureTask.run(FutureTask.java:166)
      Information:java: at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
      Information:java: at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
      Information:java: at java.lang.Thread.run(Thread.java:722)
      Information:java: Errors occurred while compiling module 'persistence'
      Information:08/17/2015 09:49 AM - Compilation completed with 1 error and 0 warnings in 3s 258ms
      Error:java: Compilation failed: internal java compiler error

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      switch (myString) {
                  case ("a"):
                      System.out.println("a");
                      break;

                  case ("b"):
                      System.out.println("b");
                      break;
      }
      ---------- END SOURCE ----------

            psonal Pallavi Sonal (Inactive)
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: