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

Illegal access to protected nested class

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P3 P3
    • 1.3.0
    • 1.3.0
    • tools
    • rc2
    • generic
    • generic

      Consider the following code:

      package otherpkg;

      public class PublicC {

        protected class ProtectedMem {}
      }

      package thispkg;

      class Lucky {
      otherpkg.PublicC.ProtectedMem z; // Allowed by gjc!
      class Tricky2 extends otherpkg.PublicC{}
      }

      javac (in 1.3) accepts this. It does not accept it in 1.2. This code is illegal
      according to the JLS 2nd edition (6.6.1, 6.6.2).

      gilad.bracha@eng 2000-01-26

            wmaddoxsunw William Maddox (Inactive)
            gbrachasunw Gilad Bracha (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: