JDK-8281386 : Adjust behaviour when --enable-native-access is not specified to be more tolerant
  • Type: Enhancement
  • Component: tools
  • Sub-Component: jextract
  • Affected Version: repo-panama
  • Priority: P4
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2022-02-07
  • Updated: 2022-02-22
  • Resolved: 2022-02-22
Description
Tweak the policy of the --enable-native-access flag, as follows (this change was first discussed in [1]):

* when the flag is specified, we keep existing behavior. This means getting an exception on every unsafe access, if the accessing module is not listed in the flag;
* when the flag is not specified, access to unsafe functionalities is allowed, with runtime warning (instead of an error).

The new, more-tolerant behavior in the absence of flag would facilitate migration away from JNI in cases where altering the set of command line options might be difficult. This mode would also help us (later) to migrate JNI to require a similar opt-in, effectively putting both JNI and Panama on the same grounds. The new mode is transitional and in a future release, this mode will be disabled and the new flag will be required _always_.

[1] https://mail.openjdk.java.net/pipermail/panama-dev/2022-January/016011.html