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

Compile error in switch-case statement which use finalized object's variable

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.3
    • tools
    • None
    • sparc
    • solaris_2.5.1



      Name: rlT66838 Date: 07/17/97


      1, Exact steps to reproduce the problem.
        Compile source code in Solaris 2.5 or windows95 (or anyother system).

      2, source code
      //----------- Begin A.java --------------------------------
      class A{
      final int AAA = 1; // static will do.
      public A(int i){
      switch(i){
      case AAA: System.out.println(AAA); break; // maybe stop in this point
      default: break;
      }
      }
      public static void main(String args[]){
      new A(1);
      }
      }
      //----------- End A.java ----------------------------------

      3, Exact text of any error message(s) that appeard.
      % javac A.java
      sun.tools.java.CompilerError: addReference A this
      at sun.tools.java.ClassDefinition.addReference(ClassDefinition.java)
      at sun.tools.java.ClassDefinition.getReference(ClassDefinition.java)
      at sun.tools.tree.Context.noteReference(Context.java)
      at sun.tools.tree.Context.makeReference(Context.java)
      at sun.tools.tree.ThisExpression.checkValue(ThisExpression.java)
      at sun.tools.tree.Expression.checkAmbigName(Expression.java)
      at sun.tools.tree.FieldExpression.checkCommon(FieldExpression.java)
      at sun.tools.tree.FieldExpression.checkValue(FieldExpression.java)
      at sun.tools.tree.IdentifierExpression.checkValue(IdentifierExpression.java)
      at sun.tools.tree.MethodExpression.checkValue(MethodExpression.java)
      at sun.tools.tree.MethodExpression.check(MethodExpression.java)
      at sun.tools.tree.ExpressionStatement.check(ExpressionStatement.java)
      at sun.tools.tree.Statement.checkBlockStatement(Statement.java)
      at sun.tools.tree.SwitchStatement.check(SwitchStatement.java)
      at sun.tools.tree.Statement.checkBlockStatement(Statement.java)
      at sun.tools.tree.CompoundStatement.check(CompoundStatement.java)
      at sun.tools.tree.Statement.checkMethod(Statement.java)
      at sun.tools.javac.SourceField.check(SourceField.java)
      at sun.tools.javac.SourceClass.checkFields(SourceClass.java)
      at sun.tools.javac.SourceClass.checkInternal(SourceClass.java)
      at sun.tools.javac.SourceClass.check(SourceClass.java)
      at sun.tools.javac.Main.compile(Main.java)
      at sun.tools.javac.Main.main(Main.java)
      error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
      1 error

      5, Include additional configuration information that you think is relevant to the problem
      ???

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

            tturnidgsunw Todd Turnidge (Inactive)
            rlewis Roger Lewis (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: