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

Constant declaration problem

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.4
    • tools
    • x86
    • windows_95



      Name: diC59631 Date: 11/10/97


      I narrowed down the problem to the following excerpt from an
      applet of mine:


      public class test1 extends Object
      {

           private final short daywidth = 80;
           private final short mTopLeftX = 80; // measured from top left corner
           private final short mTopLeftY = 40; // of the matrix border
           private final short sTopLeftX = mTopLeftX+(7*daywidth);
           private final short sTopLeftY = mTopLeftY;


      }


      This was originally an applet, but I kept stripping it down until I was left
      with that piece of code, which produces the following error:


      sun.tools.java.CompilerError: addReference test1 this
              at sun.tools.java.ClassDefinition.addReference(ClassDefinition.java:1077
      )
              at sun.tools.java.ClassDefinition.getReference(ClassDefinition.java:1072
      )
              at sun.tools.tree.Context.noteReference(Context.java:308)
              at sun.tools.tree.Context.makeReference(Context.java:329)
              at sun.tools.tree.ThisExpression.checkValue(ThisExpression.java:76)
              at sun.tools.tree.Expression.checkAmbigName(Expression.java:210)
              at sun.tools.tree.FieldExpression.checkCommon(FieldExpression.java:135)
              at sun.tools.tree.FieldExpression.checkValue(FieldExpression.java:111)
              at sun.tools.tree.IdentifierExpression.checkValue(IdentifierExpression.j
      ava:224)
              at sun.tools.tree.Expression.checkInitializer(Expression.java:170)
              at sun.tools.javac.SourceField.check(SourceField.java:434)
              at sun.tools.javac.SourceClass.checkFields(SourceClass.java:838)
              at sun.tools.javac.SourceClass.checkInternal(SourceClass.java:615)
              at sun.tools.javac.SourceClass.check(SourceClass.java:566)
              at sun.tools.javac.Main.compile(Main.java:318)
              at sun.tools.javac.Main.main(Main.java:473)
      error: An error has occurred in the compiler; please file a bug report (http://j
      ava.sun.com/cgi-bin/bugreport.cgi).
      1 error



      ...so something about that combination of constants makes the compiler unhappy.
      I commented out the last declaration and the error disappeared. I commented
      out the first and the next-to-last declarations, and the problem disappeared.
      I hard-coded the last declaration to 40 since it was just a copy of another
      constant anyhow, and the problem disappeared.

      The compiler seems to die in a late phase, since any syntax errors will cause
      it to stop first without dying.

      I'm compiling this on a 486 DX4-100, 48 megs RAM, Win95 OSR2
      (Review ID: 19909)
      ======================================================================

            tturnidgsunw Todd Turnidge (Inactive)
            dindrigo Daniel Indrigo (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: