Summary
Two redundant and/or confusing sentences in relation to the arguments of AttachCurrentThread
are removed.
Problem
In Java 7, the spec was:
In JDK 1.1, the second argument to
AttachCurrentThread
is always a pointer toJNIEnv
. The third argument toAttachCurrentThread
was reserved, and should be set toNULL
.In JDK 1.2, you pass
NULL
as the third argument for 1.1 behavior, or pass a pointer to the following structure to specify additional information:
In Java 8 it changed to just:
The second argument to
AttachCurrentThread
is always a pointer toJNIEnv
. The third argument toAttachCurrentThread
was reserved, and should be set toNULL
.
The sentence "The second argument .." is redundant as it just repeats the definition of the second argument.
The sentence "The third argument to ..." is not correct as it can be NULL
or a pointer to a JavaVMAttachArgs
structure when there is additional information to specify.
Solution
Delete both sentences. In doing so the following sentence also becomes redundant and can be removed:
You pass a pointer to the following structure to specify additional information:
Specification
Before:
PARAMETERS:
vm
: the VM to which the current thread will be attached, must not beNULL
.
p_env
: pointer to the location where the JNI interface pointer of the current thread will be placed, must not beNULL
.
thr_args
: can beNULL
or a pointer to aJavaVMAttachArgs
structure to specify additional information:The second argument to
AttachCurrentThread
is always a pointer toJNIEnv
. The third argument toAttachCurrentThread
was reserved, and should be set toNULL
.You pass a pointer to the following structure to specify additional information:
typedef struct JavaVMAttachArgs {
...
After:
PARAMETERS:
vm
: the VM to which the current thread will be attached, must not beNULL
.
p_env
: pointer to the location where the JNI interface pointer of the current thread will be placed, must not beNULL
.
thr_args
: can beNULL
or a pointer to aJavaVMAttachArgs
structure to specify additional information:
typedef struct JavaVMAttachArgs {
...
There is also a typographical error in the method description where the wrong parameter name is used. This:
Attaches the current thread to a Java VM. Returns a JNI interface pointer in the
JNIEnv
argument.
should say the p_env
argument.
- csr of
-
JDK-8288648 (jni spec) Description of 3rd parameter to AttachCurrentThread is confusing
-
- Resolved
-
- relates to
-
JDK-8289253 JNI AttachCurrentThread should declare the correct parameter types
-
- Closed
-