Protected inner class is inaccessible from another package

XMLWordPrintable

    • Type: Bug
    • Resolution: Duplicate
    • Priority: P2
    • None
    • Affects Version/s: 1.2.0
    • Component/s: tools
    • None
    • unknown
    • solaris_2.5.1

      A protected inner class is inaccessible from another package. The following
      example demonstrates the problem.

      -----


      package p1;

      public class ProtectedInnerClass1 {
          protected class Foo {
      public String getBar() { return "bar"; }
          }
      }

      -----

      package p2;

      public class ProtectedInnerClass2 extends p1.ProtectedInnerClass1
      {
          /* ProtectedInnerClass2.java:4: Can't access inner class p1.ProtectedInnerClass1.Foo.
           * Only public classes and interfaces in other packages can be accessed.
           * protected class Bug extends Foo {
           * ^
           */

          class Bug extends Foo {
      String getBug() { return getBar(); }
          }
      }



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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: