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

javac dies on inner classes

    XMLWordPrintable

Details

    • generic
    • generic

    Description



      Name: wm38563 Date: 12/09/98


      with the following code:
      class Test {

        public int foo() {
          final int i2=0;
          class Local {
            Local() {
              new LI();
            }
            class LI {
                {new LI2();}
              class LI2 {
                  {System.out.println(i2);}
              }
            }
          }
          new Local();
          return -1;
        }
      }

      javac dumps the following:
      > javac Test.java
      sun.tools.java.CompilerError: referencesMustNotBeFrozen inner class Te
      st. 1$Local.LI
              at sun.tools.java.ClassDefinition.referencesMustNotBeFrozen(Cl
      assDefinition.java:1926)
              at sun.tools.java.ClassDefinition.addReference(ClassDefinition
      .java:1898)
              at sun.tools.java.ClassDefinition.getReference(Compiled Code)
              at sun.tools.tree.Context.noteReference(Compiled Code)
              at sun.tools.tree.UplevelReference.willCodeArguments(UplevelRe
      ference.java:336)
              at sun.tools.tree.UplevelReference.willCodeArguments(UplevelRe
      ference.java:340)
              at sun.tools.tree.NewInstanceExpression.inlineValue(Compiled C
      ode)
              at sun.tools.tree.NewInstanceExpression.inline(NewInstanceExpr
      ession.java:397)
              at sun.tools.tree.ExpressionStatement.inline(ExpressionStateme
      nt.java:47)
              at sun.tools.tree.CompoundStatement.inline(Compiled Code)
              at sun.tools.tree.InlineMethodExpression.inline(InlineMethodEx
      pression.java:39)
              at sun.tools.tree.CommaExpression.inline(CommaExpression.java:
      67)
              at sun.tools.tree.CommaExpression.inline(CommaExpression.java:
      67)
              at sun.tools.tree.MethodExpression.inline(Compiled Code)
              at sun.tools.tree.ExpressionStatement.inline(ExpressionStateme
      nt.java:47)
              at sun.tools.tree.CompoundStatement.inline(Compiled Code)
              at sun.tools.javac.SourceMember.inline(Compiled Code)
              at sun.tools.javac.SourceClass.inlineLocalClass(Compiled Code)

              at sun.tools.javac.SourceMember.inline(Compiled Code)
              at sun.tools.javac.SourceClass.inlineLocalClass(Compiled Code)

              at sun.tools.tree.VarDeclarationStatement.inline(VarDeclaratio
      nStatement.java:131)
              at sun.tools.tree.DeclarationStatement.inline(Compiled Code)
              at sun.tools.tree.CompoundStatement.inline(Compiled Code)
              at sun.tools.javac.SourceMember.inline(Compiled Code)
              at sun.tools.javac.SourceMember.code(Compiled Code)
              at sun.tools.javac.SourceClass.compileClass(Compiled Code)
              at sun.tools.javac.SourceClass.compile(Compiled Code)
              at sun.tools.javac.Main.compile(Compiled Code)
              at sun.tools.javac.Main.main(Main.java:733)
      Test.java:0: class Test:int foo()@sun.tools.java.CompilerError: refere
      ncesMustNotBeFrozen inner class Test. 1$Local.LI
      class Test {
      ^
      1 error
      (Review ID: 47609)
      ======================================================================

      Attachments

        Activity

          People

            wmaddoxsunw William Maddox (Inactive)
            wmaddoxsunw William Maddox (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: