RFR: 8180892: Correct handling of annotations on parameters [v3]
Chen Liang
liach at openjdk.org
Sun Feb 18 16:52:15 UTC 2024
> 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
-------------
Changes: https://git.openjdk.org/jdk/pull/13664/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13664&range=02
Stats: 628 lines in 7 files changed: 541 ins; 54 del; 33 mod
Patch: https://git.openjdk.org/jdk/pull/13664.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/13664/head:pull/13664
PR: https://git.openjdk.org/jdk/pull/13664
More information about the core-libs-dev
mailing list