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

Assertion error when compiling do while loop with java compiler

XMLWordPrintable

    • generic
    • generic

      A DESCRIPTION OF THE PROBLEM :
      When I compile the following test case, instead of successfully generating the .class file, I get an assertion error with the error message as shown in the Output content. Could you please tell me what is the cause of this situation?
      Test case:
      public class MyJVMTest_13160 {
        
          static void foo() {
              Integer i = 100;
              do {
                  return;
              } while (i++ < 10);
          }

          public static void main(String[] args) {
              foo();
          }
      }
      Output:
      An exception has occurred in the compiler (1.8.0-internal). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.AssertionError
      at com.sun.tools.javac.util.Assert.error(Assert.java:126)
      at com.sun.tools.javac.util.Assert.check(Assert.java:45)
      at com.sun.tools.javac.jvm.Items$LocalItem.<init>(Items.java:390)
      at com.sun.tools.javac.jvm.Items.makeLocalItem(Items.java:131)
      at com.sun.tools.javac.jvm.Gen.visitIdent(Gen.java:2314)
      at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2011)
      at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:947)
      at com.sun.tools.javac.jvm.Gen.visitLetExpr(Gen.java:2413)
      at com.sun.tools.javac.tree.JCTree$LetExpr.accept(JCTree.java:2426)
      at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:947)
      at com.sun.tools.javac.jvm.Gen.visitLetExpr(Gen.java:2413)
      at com.sun.tools.javac.tree.JCTree$LetExpr.accept(JCTree.java:2426)
      at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:947)
      at com.sun.tools.javac.jvm.Gen.visitSelect(Gen.java:2350)
      at com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:1897)
      at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:947)
      at com.sun.tools.javac.jvm.Gen.visitApply(Gen.java:1846)
      at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
      at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:947)
      at com.sun.tools.javac.jvm.Gen.visitBinary(Gen.java:2160)
      at com.sun.tools.javac.tree.JCTree$JCBinary.accept(JCTree.java:1785)
      at com.sun.tools.javac.jvm.Gen.genExpr(Gen.java:947)
      at com.sun.tools.javac.jvm.Gen.genCond(Gen.java:870)
      at com.sun.tools.javac.jvm.Gen.genCond(Gen.java:823)
      at com.sun.tools.javac.jvm.Gen.genLoop(Gen.java:1218)
      at com.sun.tools.javac.jvm.Gen.visitDoLoop(Gen.java:1167)
      at com.sun.tools.javac.tree.JCTree$JCDoWhileLoop.accept(JCTree.java:938)
      at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:737)
      at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:772)
      at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:758)
      at com.sun.tools.javac.jvm.Gen.genStats(Gen.java:809)
      at com.sun.tools.javac.jvm.Gen.visitBlock(Gen.java:1157)
      at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
      at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:737)
      at com.sun.tools.javac.jvm.Gen.genStat(Gen.java:772)
      at com.sun.tools.javac.jvm.Gen.genMethod(Gen.java:1031)
      at com.sun.tools.javac.jvm.Gen.visitMethodDef(Gen.java:994)
      at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
      at com.sun.tools.javac.jvm.Gen.genDef(Gen.java:737)
      at com.sun.tools.javac.jvm.Gen.genClass(Gen.java:2463)
      at com.sun.tools.javac.main.JavaCompiler.genCode(JavaCompiler.java:745)
      at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1572)
      at com.sun.tools.javac.main.JavaCompiler.generate(JavaCompiler.java:1536)
      at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
      at com.sun.tools.javac.main.Main.compile(Main.java:523)
      at com.sun.tools.javac.main.Main.compile(Main.java:381)
      at com.sun.tools.javac.main.Main.compile(Main.java:370)
      at com.sun.tools.javac.main.Main.compile(Main.java:361)
      at com.sun.tools.javac.Main.compile(Main.java:56)
      at com.sun.tools.javac.Main.main(Main.java:42)


      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: