RFR [XS] JDK-6590839: JNI Spec should point out Java objects created in JNI using AllocObject are not finalized
David Simms
david.simms at oracle.com
Fri Apr 25 15:14:44 UTC 2014
JDK-6590839 <https://bugs.openjdk.java.net/browse/JDK-6590839>
Minor addition to the JNI Specification
<http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/jniTOC.html>:
Explain the lack of finalization AllocObject
<http://docs.oracle.com/javase/8/docs/technotes/guides/jni/spec/functions.html#AllocObject>().
Web review here: http://cr.openjdk.java.net/~dsimms/jnispec/6590839/
<http://cr.openjdk.java.net/%7Edsimms/jnispec/6590839/>
*Old Text*
*New Text*
AllocObject
|jobject AllocObject(JNIEnv *env, jclass clazz);|
Allocates a new Java object without invoking any of the constructors for
the object. Returns a reference to the object.
The clazz argument must not refer to an array class.
AllocObject
|jobject AllocObject(JNIEnv *env, jclass clazz);|
Allocates a new Java object without invoking any of the constructors for
the object. Returns a reference to the object.
*Note:*The Java Language Specification, "Implementing Finalization" (JLS
§12.6.1
<http://docs.oracle.com/javase/specs/jls/se8/html/jls-12.html#jls-12.6.1>)
states: "An object o is not finalizable until its constructor has
invoked the constructor for Object on o and that invocation has
completed successfully". Since AllocObject() does not invoke a
constructor, objects created with this function are not eligible for
finalization.
The clazz argument must not refer to an array class.
More information about the hotspot-dev
mailing list