JEP 178 covers statically-linked JNI libraries:
http://openjdk.java.net/jeps/178
In the section of this JEP entitled "JNI Specification Changes" there is a set of eight bullet points that has some specific assertions about how the Java SE APIs must behave in the presence of statically linked JNI libraries. Several of these points are missing from the System.loadLibrary and Runtime.loadLibrary specifications. These points are also not covered in the JNI Specification.
For example, the following points from the JEP don't appear anywhere in the Java SE specifications that I can find:
* If a statically linked library L exports a function called JNI_OnLoad_L and a function called JNI_OnLoad, the JNI_OnLoad function will be ignored.
* If a statically linked library L exports a function called JNI_OnUnLoad_L and a function called JNI_OnUnLoad, the JNI_OnUnLoad function will be ignored.
* If a library L is statically linked then it will be prohibited to link a library of the same name dynamically.
There may also be other points from the JEP missing from the specification.
There may also need to be other assertions added that don't appear in the JEP. For example, I'd propose these, which are related to JDK-8032456:
* If a library L is dynamically linked and it exports a function called JNI_OnLoad_L, that function will be ignored.
* If a library L is dynamically linked and it exports a function called JNI_OnUnload_L, that function will be ignored.
I also happened to notice a couple small issues in the relevant JNI Specification section, "Library and Version Management".
* JNI_Onload_L is missing the return type of jint.
* JNI_OnUnload_L is missing the return type of void.
Finally, there are a few editorial issues with the j.l.System and j.l.Runtime specs and JNI Specification.
* The System.loadLibrary and Runtime.loadLibrary specs mention the JNI Specification, but they don't provide a link. It would be helpful if they also specified, and if possible linked to, the "Library and Version Management" section.
* The top level JNI documentation page (the page linked from the "JNI" link on the "brick wall" of the main JDK doc page), describes JNI as follows: "The Java Native Interface 6.0 Specification describes how the AWT package is designed to use JNI mechanisms to display objects on Solaris, Linux and Windows platforms." This seems like an anachronism.
* The Library and Version Management section has a typo "... act as if the library was +never loaded."
* The Library and Version Management section doesn't make clear when it's talking about native libraries in general, or dynamically-linked libraries specifically. The statically-linked material was added but it makes the rest of the material somewhat unclear in scope.
* There are a couple paragraph indentation errors in this section.
(If necessary, the portions of this bug pertaining to the JNI Specification may need to be moved to a separate bug under the docs component.)
http://openjdk.java.net/jeps/178
In the section of this JEP entitled "JNI Specification Changes" there is a set of eight bullet points that has some specific assertions about how the Java SE APIs must behave in the presence of statically linked JNI libraries. Several of these points are missing from the System.loadLibrary and Runtime.loadLibrary specifications. These points are also not covered in the JNI Specification.
For example, the following points from the JEP don't appear anywhere in the Java SE specifications that I can find:
* If a statically linked library L exports a function called JNI_OnLoad_L and a function called JNI_OnLoad, the JNI_OnLoad function will be ignored.
* If a statically linked library L exports a function called JNI_OnUnLoad_L and a function called JNI_OnUnLoad, the JNI_OnUnLoad function will be ignored.
* If a library L is statically linked then it will be prohibited to link a library of the same name dynamically.
There may also be other points from the JEP missing from the specification.
There may also need to be other assertions added that don't appear in the JEP. For example, I'd propose these, which are related to JDK-8032456:
* If a library L is dynamically linked and it exports a function called JNI_OnLoad_L, that function will be ignored.
* If a library L is dynamically linked and it exports a function called JNI_OnUnload_L, that function will be ignored.
I also happened to notice a couple small issues in the relevant JNI Specification section, "Library and Version Management".
* JNI_Onload_L is missing the return type of jint.
* JNI_OnUnload_L is missing the return type of void.
Finally, there are a few editorial issues with the j.l.System and j.l.Runtime specs and JNI Specification.
* The System.loadLibrary and Runtime.loadLibrary specs mention the JNI Specification, but they don't provide a link. It would be helpful if they also specified, and if possible linked to, the "Library and Version Management" section.
* The top level JNI documentation page (the page linked from the "JNI" link on the "brick wall" of the main JDK doc page), describes JNI as follows: "The Java Native Interface 6.0 Specification describes how the AWT package is designed to use JNI mechanisms to display objects on Solaris, Linux and Windows platforms." This seems like an anachronism.
* The Library and Version Management section has a typo "... act as if the library was +never loaded."
* The Library and Version Management section doesn't make clear when it's talking about native libraries in general, or dynamically-linked libraries specifically. The statically-linked material was added but it makes the rest of the material somewhat unclear in scope.
* There are a couple paragraph indentation errors in this section.
(If necessary, the portions of this bug pertaining to the JNI Specification may need to be moved to a separate bug under the docs component.)
- duplicates
-
JDK-8079466 JNI Specification Update and Clean-up (JDK 8)
- Resolved
- relates to
-
JDK-8005716 Enhance JNI specification to allow support of static JNI libraries in Embedded JREs
- Closed
-
JDK-8079466 JNI Specification Update and Clean-up (JDK 8)
- Resolved