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

6.6.2: Handle method references in protected access rules

XMLWordPrintable

    • Verified

      6.6.2, in defining when a protected method is accessible, talks about the forms of method invocations and class instance creations. It needs to be updated to account for method references as well.

      This form is tricky:
      ReferenceType :: [TypeArguments] Identifier
      - In the first search, we must be in a subclass of the declaring class
      - If the second search, the first bullet of 6.6.2.1 should also apply: it must be the case that ReferenceType is a subclass of (or the same as) the current class

      These forms are covered by the two bullets in 6.6.2.1, but the rules needs to allow for method reference syntax:
      ExpressionName :: [TypeArguments] Identifier
      Primary :: [TypeArguments] Identifier

      These forms can always be used in a subclass of the declaring class -- the receiver is implicitly 'this' of the subclass type (no change necessary):
      super :: [TypeArguments] Identifier
      TypeName . super :: [TypeArguments] Identifier

      This form must be allowed for in the third bullet of 6.6.2.2:
      ClassType :: [TypeArguments] new

            dlsmith Dan Smith
            dlsmith Dan Smith
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: