Java: Prepare to Restrict The Use of JNI
The article discusses a JEP draft that aims to restrict the use of JNI (Java Native Interface) in future releases of Java. JNI allows interoperability between Java code and native code, but it also poses risks to the integrity of applications and the Java Platform itself. The draft proposes issuing warnings when native code is invoked through JNI and making it an error to invoke native code without enabling native access on the command line. The goal is to align JNI with the Foreign Function & Memory (FFM) API, allowing libraries to migrate from JNI to FFM using the same command line option. This change will require developers to be cautious when using JNI and ensure that their code is secure and does not compromise the stability of the Java Platform. This update is relevant for developers who work with JNI and want to stay informed about the future restrictions and changes in the Java language.