Summary
Update javac's implementation of ExecutableElement.getReceiverType()
and ExecutableType.getReceiverType()
to allow accessing type use annotations on receiver types for methods loaded from bytecode.
Problem
The implementation currently returns a NoType
type mirror with kind NONE
whenever the receiver parameter syntax is not present in source.
The receiver parameter syntax is not recoverable from the class file, and it is currently never filled in for methods loaded from bytecode. This means that there is no type to host type annotations, and annotation processors are unable to access type annotations on receiver parameters loaded from bytecode.
Solution
If a type annotation is present on the receiver type of a method read from bytecode, the implementation should infer that a receiver parameter was present in source, and fill in the receiver type of that method to host the type annotation.
Specification
No specification change; behavioral change only.
Prompted by discussion in an earlier version of this CSR, JDK-8319843 tracks updating the specification to clarify the existing behavior of getReceiverType().
- csr of
-
JDK-8319196 ExecutableElement.getReceiverType doesn't return receiver types for methods loaded from bytecode
- Resolved