RFR: 8320575: generic type information lost on mandated parameters [v7]

Joe Darcy darcy at openjdk.org
Tue Dec 12 22:33:33 UTC 2023


On Tue, 12 Dec 2023 04:26:25 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Reflection is not retrieving generic type information for mandated parameters. This is a known issue which has been explicitly stated in the API of some reflection methods. Fix for [JDK-8292275](https://bugs.openjdk.org/browse/JDK-8292275) made the parameters of compact constructors of record classes `mandated` as specified in the spec. But this implied that users that previous to this change could retrieve the generic type of parameters of compact constructors now they can't anymore. The proposed fix is to try to retrieve generic type information for mandated parameters if available plus changing the spec of the related reflection methods.
>> 
>> TIA
>
> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
> 
>   fixing comment

src/java.base/share/classes/java/lang/reflect/Executable.java line 289:

> 287:      * artifact</a>, the number of returned parameters can differ
> 288:      * depending on whether or not generic information is present. If
> 289:      * generic information is present, only parameters implicitly or

It may be helpful to link to javax.lang.model.util.Elements.Origin.MANDATED and  javax.lang.model.util.Elements.Origin.SYNTHETIC to give the reader some more context here. If you do that, you may need to add some SuppressWarnings to make the compile-time doclint checking work due to the cross-module linkage.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/17070#discussion_r1424643273


More information about the core-libs-dev mailing list