RFR: 8320575: generic type information lost on mandated parameters of record's compact constructors [v19]
Joe Darcy
darcy at openjdk.org
Mon Apr 29 20:26:07 UTC 2024
On Mon, 29 Apr 2024 18:55:24 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:
>
> minor refactoring
src/java.base/share/classes/java/lang/reflect/Executable.java line 286:
> 284: * declared parameter in addition to explicitly declared ones.
> 285: * Also note that compact constructors of a record class may have
> 286: * implicitly ({@linkplain java.compiler/javax.lang.model.util.Elements.Origin#MANDATED mandated}) declared parameters.
I think a better version of this edit is
`{@linkplain java.compiler/javax.lang.model.util.Elements.Origin#MANDATED implicitly declared}`
src/java.base/share/classes/java/lang/reflect/Executable.java line 287:
> 285: * Also note that compact constructors of a record class may have
> 286: * implicitly ({@linkplain java.compiler/javax.lang.model.util.Elements.Origin#MANDATED mandated}) declared parameters.
> 287: * Finally note that as a <a href="{@docRoot}/java.base/java/lang/reflect/package-summary.html#LanguageJvmModel">modeling
I believe syntax like
`{@link java.lang.reflect##LanguageJvmModel modeling artifact}`
can be used instead of the href link.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17070#discussion_r1583699306
PR Review Comment: https://git.openjdk.org/jdk/pull/17070#discussion_r1583702180
More information about the core-libs-dev
mailing list