Bogus warning generated for "override" of inaccessible method

XMLWordPrintable

    • Type: Bug
    • Resolution: Won't Fix
    • Priority: P3
    • None
    • Affects Version/s: 1.1
    • Component/s: tools
    • None
    • sparc
    • solaris_2.5.1

      If you compile the following two classes, class X will get a warning of the form:

      x/X.java:6: Note: Method void foo() in class x.X does not override the corresponding method in class a.A, which is private to a different package.
          void foo() {
               ^
      1 warning

      This is bogus. If A.foo() were private, no warning would be generated.
      This is a situation where the compiler should be silent. I should be
      able to add a new package-accessible method to my classes without worrying
      that I may generate warnings to every user about something that doesn't matter
      to them (that I have an inaccessible member of the same name).

      Here's the source

      package a;

      import x.X;

      public class A {
          void foo() { }
          public static void main(String[] args) {
      X xref = new X();
      xref.foo();
          }
      }

      package x;

      import a.*;

      public class X extends A {
          void foo() {
      System.out.println("X's foo");
          }
      }

            Assignee:
            David Stoutamire (Inactive)
            Reporter:
            Kenneth Arnold (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: