RFR: 8353835: Implement JEP 500: Prepare to Make Final Mean Final [v10]
Chen Liang
liach at openjdk.org
Tue Nov 11 15:04:38 UTC 2025
On Tue, 11 Nov 2025 08:56:56 GMT, Alan Bateman <alanb at openjdk.org> wrote:
> It's aligned with setAccessible. It's corner case of course but if a JNI attached thread invokes setAccessible with no java frames on the stack, then it is specified to only succeed if the API element is public and declared in a public class in an exported package.
Consider setting the field `java.lang.constant.DirectMethodHandleDesc$Kind.refKind` (public final instance field in public class in exported, non-open package) in 3 ways:
1. `Field.setAccessible` + `set` in Java code: Now `set` fails without `--add-opens` (not open)
2. Performing the 2 Java calls in JNI: Completely permitted (exported)
3. jni_Set##Result##Field: Completely permitted, one warning message
I find it a bit weird that 1 is inconsistent with 2, but given case 3, we have plenty of time to restrict 2 and 3 together in future releases.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/25115#issuecomment-3517325736
More information about the core-libs-dev
mailing list