RFR: 8320575: generic type information lost on mandated parameters [v10]
Jan Lahoda
jlahoda at openjdk.org
Fri Dec 15 12:13:38 UTC 2023
On Thu, 14 Dec 2023 04:00:58 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:
>
> adding comment to jcod file
As the patch is flipping the iteration order, it may be useful to have tests for other cases, especially capturing local (and maybe anonymous) classes (in static and non-static contexts?), maybe even using classfile before and after [JDK-8292275](https://bugs.openjdk.org/browse/JDK-8292275). Not sure if such tests exist, but it would help to make sure we don't regress. Note that captured variables for local/anonymous classes are appended to the end of the "explicit" parameters, so the change in iteration order could affect that.
I was experimenting with such local and anonymous classfiles, and didn't see an error, so it is probably OK, and it is probably only about the tests.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/17070#issuecomment-1857786430
More information about the core-libs-dev
mailing list