RFR: 8180892: Correct handling of annotations on parameters [v2]
Chen Liang
liach at openjdk.org
Wed Apr 26 14:46:53 UTC 2023
> 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 incrementally with one additional commit since the last revision:
Fix assuming match without MethodParameters for type annotations, move implementation related to getAnnotatedParameterTypes to around it
-------------
Changes:
- all: https://git.openjdk.org/jdk/pull/13664/files
- new: https://git.openjdk.org/jdk/pull/13664/files/7b3646db..2332faad
Webrevs:
- full: https://webrevs.openjdk.org/?repo=jdk&pr=13664&range=01
- incr: https://webrevs.openjdk.org/?repo=jdk&pr=13664&range=00-01
Stats: 136 lines in 1 file changed: 57 ins; 57 del; 22 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