RFR: 8180892: Correct handling of annotations on parameters [v3]

Chen Liang liach at openjdk.org
Thu Apr 11 17:12:51 UTC 2024


On Sun, 18 Feb 2024 16:52:15 GMT, Chen Liang <liach at openjdk.org> wrote:

>> This patch aims to correct handling of annotations on parameters with the help of `MethodParameters` attribute, which will be always available once #9862 is integrated.
>> 
>> It utilizes and expands upon the existing parameter matching logic present in `Executable::getAllGenericParameterTypes`, and delegate parameter parameterized types, parameter annotation, and parameter type annotation accesses through the matched results, if matching is available. If matching failed, it falls back to existing heuristics that works without `MethodParameters` attributes for annotations, in `Executable::handleParameterNumberMismatch` and `TypeAnnotationParser::buildAnnotatedTypes` (renamed `buildAnnotatedTypesWithHeuristics` in this patch)
>> 
>> `ParameterMappingTest` covers these scenarios with class files that have `MethodParameters` or `Signature` attributes stripped or preserved to ensure the new Reflection API implementation works for both class files generated before #9862 and after its integration.
>> 
>> Also special thanks to Joe Darcy for reviewing 8304918 (#13183); this brings much convenience to this patch.
>
> Chen Liang has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 11 commits:
> 
>  - Update copyright year, cleanup and fix volatile, fix test
>  - Merge branch 'master' into param-implicit-mapping
>  - Merge branch 'master' into param-implicit-mapping
>  - Fix assuming match without MethodParameters for type annotations, move implementation related to getAnnotatedParameterTypes to around it
>  - copyright years
>  - Complete ParameterMappingTest to take care of interested scenarios
>  - Merge branch 'master' into param-implicit-mapping
>  - test wip
>  - Introduce base for annotated types if signature is absent but method parameters is present
>  - simplify code with further contracts
>  - ... and 1 more: https://git.openjdk.org/jdk/compare/c2d9fa26...611deabe

Keep-alive.

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

PR Comment: https://git.openjdk.org/jdk/pull/13664#issuecomment-2050140022


More information about the core-libs-dev mailing list