RFR: 8349716: IllegalAccessError when Proxy methods return object of a package-private type
Chen Liang
liach at openjdk.org
Tue Feb 11 18:00:25 UTC 2025
The return value adaption of Proxy is problematic, that it may attempt to access package-private types inaccessible to its package in a `checkcast` instruction, which causes `IllegalAccessError` if the returned object is not `null`. This likely affects all Java versions since the publication of OpenJDK.
A practical effect of this is that if a repeatable annotation is package-private but the container is not, user code cannot access the `value` element in the container annotation.
All added tests except `PackagePrivateContainerTest::testGetRepeatable` fail on current mainline and pass with the ProxyGenerator patch.
Testing: Running tier 1-3
-------------
Commit messages:
- 8349716: IllegalAccessError when Proxy methods return object of a package-private type
Changes: https://git.openjdk.org/jdk/pull/23567/files
Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=23567&range=00
Issue: https://bugs.openjdk.org/browse/JDK-8349716
Stats: 140 lines in 3 files changed: 133 ins; 0 del; 7 mod
Patch: https://git.openjdk.org/jdk/pull/23567.diff
Fetch: git fetch https://git.openjdk.org/jdk.git pull/23567/head:pull/23567
PR: https://git.openjdk.org/jdk/pull/23567
More information about the core-libs-dev
mailing list