RFR: 8287908: Use non-cloning reflection methods where acceptable [v2]
Сергей Цыпанов
duke at openjdk.java.net
Tue Jun 14 19:33:46 UTC 2022
On Tue, 14 Jun 2022 18:46:25 GMT, Roger Riggs <rriggs at openjdk.org> wrote:
>> Сергей Цыпанов has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains two additional commits since the last revision:
>>
>> - Merge branch 'master' into 8287908
>> - 8287908: Use non-cloning reflection methods where acceptable
>
> src/java.base/share/classes/java/lang/reflect/Executable.java line 318:
>
>> 316: final boolean realParamData = hasRealParameterData();
>> 317: final Type[] genericParamTypes = getGenericParameterTypes();
>> 318: final Type[] nonGenericParamTypes = getSharedParameterTypes();
>
> This is not a safe replacement; it may be returned to the caller at line 345.
Right, I was looking into usages of `getAllGenericParameterTypes()` and all of them are read-only. However I agree that later it might become an issue, so I'd use `getParameterTypes()` in line 345.
-------------
PR: https://git.openjdk.org/jdk/pull/9064
More information about the core-libs-dev
mailing list