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

javac crash when local from enclosing context is captured multiple times

    Details

    • Subcomponent:
    • Resolved In Build:
      b27
    • CPU:
      generic
    • OS:
      generic

      Description

      FULL PRODUCT VERSION :
      Java version "1.8.0_112"
      Java(TM) SE Runtime Environment (build 1.8.0_112-b15)
      Java HotSpot(TM) 64-Bit Server VM (build 25.112-b15, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux test-javac 4.4.0-45-generic #66-Ubuntu SMP Wed Oct 19 14:12:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
      Darwin 30-10-9.wireless.csail.mit.edu 16.0.0 Darwin Kernel Version 16.0.0: Mon Aug 29 17:56:20 PDT 2016; root:xnu-3789.1.32~3/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      javac crashes when run on the supplied Main.java program. The program is notable for its use of nested local classes and deferred final variable initialization.

      This program is adapted from https://github.com/kframework/java-semantics/blob/master/tests/65_local_cl/local_cl_912_base_deriv_diff_encl_env.java . It was discovered when testing a program transformation tool.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the included source program

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Compilation completes successfully
      ACTUAL -
      javac crashes

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      An exception has occurred in the compiler (1.8.0_112). 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.comp.Lower.initField(Lower.java:1868)
      at com.sun.tools.javac.comp.Lower.visitMethodDefInternal(Lower.java:2792)
      at com.sun.tools.javac.comp.Lower.visitMethodDef(Lower.java:2737)
      at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2371)
      at com.sun.tools.javac.comp.Lower.visitClassDef(Lower.java:2508)
      at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2371)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)
      at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:162)
      at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:3561)
      at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2371)
      at com.sun.tools.javac.tree.TreeTranslator.visitMethodDef(TreeTranslator.java:145)
      at com.sun.tools.javac.comp.Lower.visitMethodDefInternal(Lower.java:2828)
      at com.sun.tools.javac.comp.Lower.visitMethodDef(Lower.java:2737)
      at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2371)
      at com.sun.tools.javac.comp.Lower.visitClassDef(Lower.java:2508)
      at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2371)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:70)
      at com.sun.tools.javac.tree.TreeTranslator.visitBlock(TreeTranslator.java:162)
      at com.sun.tools.javac.comp.Lower.visitBlock(Lower.java:3561)
      at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2371)
      at com.sun.tools.javac.tree.TreeTranslator.visitMethodDef(TreeTranslator.java:145)
      at com.sun.tools.javac.comp.Lower.visitMethodDefInternal(Lower.java:2828)
      at com.sun.tools.javac.comp.Lower.visitMethodDef(Lower.java:2737)
      at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2371)
      at com.sun.tools.javac.comp.Lower.visitClassDef(Lower.java:2508)
      at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
      at com.sun.tools.javac.tree.TreeTranslator.translate(TreeTranslator.java:58)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2371)
      at com.sun.tools.javac.comp.Lower.translate(Lower.java:2390)
      at com.sun.tools.javac.comp.Lower.translateTopLevelClass(Lower.java:3932)
      at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1512)
      at com.sun.tools.javac.main.JavaCompiler.desugar(JavaCompiler.java:1356)
      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)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      public class Main
      {
        void test ()
        {
          final int b;
          b = 10;
          class Local1
          {
            public String toString ()
            {
              return "" + b ;
            }
          }
          class Local2
          {
            void test ()
            {
              final int b;
              b = 20;
              class DeepLocal extends Local1
              {
                public String toString ()
                {
                  return "" + b;
                }
              }
            }
          }
        }
      }

      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mcimadamore Maurizio Cimadamore
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: