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

Protected inner class is inaccessible from another package

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P2 P2
    • None
    • 1.2.0
    • 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(); }
          }
      }



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

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: