-
Bug
-
Resolution: Fixed
-
P3
-
None
-
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
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
- relates to
-
JDK-8033790 6.6.2: Protected accessibility check inconsistent with longstanding javac behavior
-
- Closed
-