New compiler incorrectly allows inheritance of private fields

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P3
    • None
    • Affects Version/s: 1.3.0
    • Component/s: tools
    • generic
    • generic

      The following well-formed program is rejected by javac-ea:

      package othello;

      public class H extends I
      {
          public static void main (final String[] args)
          {
              q.f();
          }
      }

      class I
      {
          void f () { System.out.println("I.f()"); }
          private static I q;
      }

      class q
      {
          static void f () { System.out.println("q.f()"); }
      }

      It complains that "q" is private, i.e. it is resolving the simple name "q"
      in H.main() to the private static field of H's superclass, rather than to
      the package-scope type q, even though private members are not inherited.

      [from Roly]

      william.maddox@Eng 1999-06-23

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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: