RFR: 8373196: Core reflection overview update for access check and conversions
Joe Darcy
darcy at openjdk.org
Fri Jan 9 18:19:26 UTC 2026
On Fri, 5 Dec 2025 23:36:22 GMT, Chen Liang <liach at openjdk.org> wrote:
> Core reflection has its own type conversion behavior that is somewhat poorly specified; it is scattered around a few places, and its boxing and unboxing deviates from that of Java language assignment contexts. In addition, core reflection has a somewhat erroneous access check system. We can improve the overview of java.lang.reflect to address these shortcomings and recommend users to use java.lang.invoke for better functionality in these areas.
Overall, I think this PR represents a good direction for the core reflection spec to move in and the package-level discussion just needs some refinement.
src/java.base/share/classes/java/lang/reflect/package-info.java line 47:
> 45: *
> 46: * <h3 id="access-control">Access Control</h3>
> 47: * An accessor of a reflected object perform access control against the caller
Typo: perform -> performs
src/java.base/share/classes/java/lang/reflect/package-info.java line 56:
> 54: * the use happened on the member in A, while in the Java Language and JVM,
> 55: * the use can happen on an inherited member in another class or interface, and
> 56: * access control proceeds differently. (JLS {@jls 6.6.1}, JVMS {@jvms 5.4.4})
I suggest making the discussion here more explicit, such as by added a concrete B subclasses to the text, and discussing briefly the distinctions between method access i the context of B vs A.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/28685#issuecomment-3730049539
PR Review Comment: https://git.openjdk.org/jdk/pull/28685#discussion_r2677149838
PR Review Comment: https://git.openjdk.org/jdk/pull/28685#discussion_r2677155989
More information about the core-libs-dev
mailing list