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

Jonathan Gibbons jonathan.gibbons at oracle.com
Thu May 23 00:20:18 UTC 2019


OK, but the second part does leave the reader asking, "why not?"

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".

-- Jon


On 05/22/2019 05:14 PM, Joe Darcy wrote:
> Hello,
>
> Please review the spec clarification below to address
>
>     JDK-8224628: Note that type parameters are not visited by 
> ElementScanners
>
> As this is not a change of the semantics of the spec, no CSR is needed.
>
> Thanks,
>
> -Joe
>
> diff -r a978d86ac389 
> src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java
> --- 
> a/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java 
> Mon May 20 17:29:44 2019 -0700
> +++ 
> b/src/java.compiler/share/classes/javax/lang/model/util/ElementScanner6.java 
> Wed May 22 17:12:32 2019 -0700
> @@ -180,6 +180,10 @@
>       * {@inheritDoc}
>       *
>       * @implSpec This implementation scans the enclosed elements.
> +     * Note that type parameters are <em>not</em> scanned by this
> +     * implementation since type parameters are not considered to be
> +     * {@linkplain TypeElement#getEnclosedElements enclosed elements
> +     * of a type}.
>       *
>       * @param e  {@inheritDoc}
>       * @param p  {@inheritDoc}
> @@ -211,6 +215,8 @@
>       * {@inheritDoc}
>       *
>       * @implSpec This implementation scans the parameters.
> +     * Note that type parameters are <em>not</em> scanned by this
> +     * implementation.
>       *
>       * @param e  {@inheritDoc}
>       * @param p  {@inheritDoc}
>



More information about the compiler-dev mailing list