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

javac can compile static members in non-static inner classes

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.2.0
    • tools
    • generic
    • generic



      Name: igT44549 Date: 02/24/99


      javac successfully compiles the program:

      public class Test {
          public class InnerTest {
              public static final int ONE = 1;
          }

          public static void main(String[] args) {
              System.out.println("InnerTest.ONE = " + InnerTest.ONE);
          }
      }

      The inner classes spec from the JDK1.1.7 docs say:
      "This shows why an inner class cannot declare a static member,
       because the entire body of the inner class is in the scope of
       one or more enclosing instances."
      This is from innerclasses.doc6.html

      As a side note, why don't the JDK1.2 docs hae any inner classes
      specs?
      (Review ID: 53258)
      ======================================================================

            Unassigned Unassigned
            iris Iris Clark
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: