JDK 13 RFR of JDK-8224628: Note that type parameters are not visited by ElementScanners

Joseph D. Darcy joe.darcy at oracle.com
Thu May 23 00:33:46 UTC 2019

On 5/22/2019 5:20 PM, Jonathan Gibbons wrote:
> OK, but the second part does leave the reader asking, "why not?"

It was an oversight in the original implementation of the API. I've 
filed JDK-8224630: "ElementScannerN, N > 9 should scan type parameters" 
to address the issues once it comes time to add "ElementScanner14", or 
whatever the successor type happens to be named.

> It is also curious, and a potential candidate for a Java Puzzlers 
> talk, why there is not a two-way relationship between 
> "TypeParameterElement.getEnclosingElement()" and the relevant 
> "getEnclosedElements".

It is a detail the spec lead of JSR 269 failed to catch and address 
before it was time for the JSR to go final ;-)

This is one instance where the enclosed elements / enclosing element 
methods do not have the the inclusion relationship one would want. 
Another desirable invariant that doesn't quite hold is mapping between 
type and their element, such as there not being standard elements 
corresponding to primitive types.



More information about the compiler-dev mailing list