Summary
Javac's is not issuing an error if 'super' qualified method references or invocations occur in a static context and thus it needs to be synced with the spec.
Problem
Javac is not in sync with sections §15.12.3 and §15.13 of the JLS 16 specification. In particular javac is not issuing an error if 'super' qualified method references or invocations occur in a static context even when the specs mandates a compiler error to be issue in these cases.
Solution
Synchronize javac with sections §15.12.3 and §15.13 of the JLS 16 specification.
Specification
Of interest for this CSR is section §15.12.3 of the JLS 16 specification, titled: "Compile-Time Step 3: Is the Chosen Method Appropriate?" in particular where it reads:
• If the form is super . [TypeArguments] Identifier, then:
– It is a compile-time error if the compile-time declaration is abstract .
– It is a compile-time error if the method invocation occurs in a static context.
• If the form is TypeName . super . [TypeArguments] Identifier, then:
– It is a compile-time error if the compile-time declaration is abstract .
– It is a compile-time error if the method invocation occurs in a static context.
Also of interest for this CSR is section §15.13 of the JLS 16 specification, in particular:
If a method reference expression has the form super :: [TypeArguments] Identifier
or TypeName . super :: [TypeArguments] Identifier, it is a compile-time error if
the expression occurs in a static context (§8.1.3).
- csr of
-
JDK-8261006 'super' qualified method references cannot occur in a static context
- Resolved