RFR: 8180892: Correct handling of annotations on parameters
Chen Liang
liach at openjdk.org
Wed Apr 26 04:56:23 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.
-------------
Commit messages:
- 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
- Try map parameter content with modifier info
Changes: https://git.openjdk.org/jdk/pull/13664/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13664&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8180892
Stats: 636 lines in 7 files changed: 548 ins; 57 del; 31 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