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

Underflow with inner classes and assigning private members

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.1.5, 1.2.0
    • tools
    • None
    • x86, sparc
    • solaris_2.5.1, windows_nt

      The following code will cause a compiler error:

      %> javac t.java
      ERROR: sun.tools.java.CompilerError: stack under flow: 11: putfield boolean publicFlag = -1
      -- listing --
      $6:
      11: aload 0
      11: getfield t this$0
      11: aload 0
      11: getfield t this$0
      11: iconst_1 1
      11: invokestatic void access$1(t, boolean)
      11: putfield boolean publicFlag
      10: return
      sun.tools.java.CompilerError: stack under flow: 11: putfield boolean publicFlag = -1
              at sun.tools.asm.Assembler.balance(Assembler.java:246)
              at sun.tools.asm.Assembler.write(Assembler.java:378)
              at sun.tools.javac.SourceClass.compileClass(SourceClass.java:1969)
              at sun.tools.javac.SourceClass.compile(SourceClass.java:1690)
              at sun.tools.javac.Main.compile(Main.java:408)
              at sun.tools.javac.Main.main(Main.java:571)
      error: An error has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).
      1 error

      //code for t.java:
      public class t {
          public boolean publicFlag;
          private boolean privateFlag;

          public t() {
              publicFlag = privateFlag = true;
          }

          class inner {
              public void innerMethod() {
                  publicFlag = privateFlag = true;
              }
          }
      }

      Note that it is not a problem if privateFlag is declared 'public'.
      Note that it is still a problem if publicFlag is declared 'private'.

      I have verified this both on Solaris using 1.2beta3-N and 1.1.6N.

      dale.mcduffie@Eng 1998-04-23

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: