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

description of protected access in JVMS contradicts to JLS

XMLWordPrintable

    • 1.2fcs
    • sparc
    • solaris_2.4
    • Not verified



      Name: akC45999 Date: 04/23/98



      The description of getfield instruction in JVMS says that:

         "If the field is protected, then it must be either a member of the current class
          or a member of a superclass of the current class, and the class of objectref
          must be either the current class or a subclass of the current class."

      However, JLS (6.6.1) allows access also from within the same package:

         "Otherwise, if the member or constructor is declared protected, then access is
          permitted only when one of the following is true:
             Access to the member or constructor occurs from within the package
             containing the class in which the protected member is declared...

             Access occurs within a subclass of the class in which the protected
             member is declared ..."

      The descriptions of getstatic, putfield, putstatic, invokespecial, invokestatic and
      invokevirtual in JVMS are in quite similar contradictions with JLS.

      Note that the actual behavior of the jdk VM (1.2beta3) is in compliance
      with the JLS.

      ======================================================================
      ======================================================================

            gbrachasunw Gilad Bracha (Inactive)
            rfqsunw Rfq Rfq (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: