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

Chen Liang liach at openjdk.org
Wed Mar 13 02:19:14 UTC 2024


On Tue, 12 Dec 2023 03:58:03 GMT, Vicente Romero <vromero at openjdk.org> wrote:

>> Vicente Romero has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   removing comment
>
> src/java.base/share/classes/java/lang/reflect/Executable.java line 343:
> 
>> 341:                 final Type[] out = new Type[nonGenericParamTypes.length];
>> 342:                 final Parameter[] params = getParameters();
>> 343:                 int fromidx = genericParamTypes.length - 1;
> 
> so provided that the parameters order is: synthetic parameters first, then mandated, if any, and finally explicit parameters. I think that it is safe to get as many parameters as possible from the genericParamTypes array, starting from the last element of the array, and if this array is shorter than the nonGenericParamTypes array, then the difference must be due to the presence of synthetic parameters, and we take the type of those from the nonGenericParamTypes array

Do synthetic parameters really come before mandated ones? Seems not the case for anonymous classes in instance methods that capture local variables from its enclosing method, those captured local variables are passed as synthetic parameters in the end of the pareamter list while the mandated enclosing instance is the first parameter.

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

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


More information about the core-libs-dev mailing list