FULL PRODUCT VERSION :
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin xxx.xxx.org 14.5.0 Darwin Kernel Version 14.5.0: Tue Sep 1 21:23:09 PDT 2015; root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
We want to generate JNI headers for a Java class A in package p.
A has static inner classes B and C.
A method of C is native and takes an object of type B as parameter.
package p;
class A {
static class B {}
static class C {
native static long Foo(B bar);
}
}
We run:
/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/javah -jni -o jni_libA.h -classpath ./ p.A
For this native function javah should produce
//Method: Foo
//Signature: (Lp/A$B;)J
JNIEXPORT jlong JNICALL Java_p_A_00024C_Foo__Lp_A_00024B_2
But it misses the dollar sign of the inner class B and produces
//Method: Foo
//Signature: (Lp/A/B;)J
JNIEXPORT jlong JNICALL Java_p_A_00024C_Foo__Lp_A_B_2
Later, during execution, the following error is thrown:
java.lang.UnsatisfiedLinkError: p.A$C.Foo(Lp/A$B;)J
It works fine when one manually adds the missing dollar sign "00024".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
We want to generate JNI headers for a Java class A in package p.
A has static inner classes B and C.
A method of C is native and takes an object of type B as parameter.
package p;
class A {
static class B {}
static class C {
native static long Foo(B bar);
}
}
We run:
/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/javah -jni -o jni_libA.h -classpath ./ p.A
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
For this native function javah should produce
//Method: Foo
//Signature: (Lp/A$B;)J
JNIEXPORT jlong JNICALL Java_p_A_00024C_Foo__Lp_A_00024B_2
ACTUAL -
But it misses the dollar sign of the inner class B and produces
//Method: Foo
//Signature: (Lp/A/B;)J
JNIEXPORT jlong JNICALL Java_p_A_00024C_Foo__Lp_A_B_2
ERROR MESSAGES/STACK TRACES THAT OCCUR :
There are no messages/crash logs.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Sorry, no time.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Manually edit the produced header file and add dollar signs ("00024") where needed.
java version "1.8.0_65"
Java(TM) SE Runtime Environment (build 1.8.0_65-b17)
Java HotSpot(TM) 64-Bit Server VM (build 25.65-b01, mixed mode)
ADDITIONAL OS VERSION INFORMATION :
Darwin xxx.xxx.org 14.5.0 Darwin Kernel Version 14.5.0: Tue Sep 1 21:23:09 PDT 2015; root:xnu-2782.50.1~1/RELEASE_X86_64 x86_64
A DESCRIPTION OF THE PROBLEM :
We want to generate JNI headers for a Java class A in package p.
A has static inner classes B and C.
A method of C is native and takes an object of type B as parameter.
package p;
class A {
static class B {}
static class C {
native static long Foo(B bar);
}
}
We run:
/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/javah -jni -o jni_libA.h -classpath ./ p.A
For this native function javah should produce
//Method: Foo
//Signature: (Lp/A$B;)J
JNIEXPORT jlong JNICALL Java_p_A_00024C_Foo__Lp_A_00024B_2
But it misses the dollar sign of the inner class B and produces
//Method: Foo
//Signature: (Lp/A/B;)J
JNIEXPORT jlong JNICALL Java_p_A_00024C_Foo__Lp_A_B_2
Later, during execution, the following error is thrown:
java.lang.UnsatisfiedLinkError: p.A$C.Foo(Lp/A$B;)J
It works fine when one manually adds the missing dollar sign "00024".
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
We want to generate JNI headers for a Java class A in package p.
A has static inner classes B and C.
A method of C is native and takes an object of type B as parameter.
package p;
class A {
static class B {}
static class C {
native static long Foo(B bar);
}
}
We run:
/Library/Java/JavaVirtualMachines/jdk1.8.0_65.jdk/Contents/Home/bin/javah -jni -o jni_libA.h -classpath ./ p.A
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
For this native function javah should produce
//Method: Foo
//Signature: (Lp/A$B;)J
JNIEXPORT jlong JNICALL Java_p_A_00024C_Foo__Lp_A_00024B_2
ACTUAL -
But it misses the dollar sign of the inner class B and produces
//Method: Foo
//Signature: (Lp/A/B;)J
JNIEXPORT jlong JNICALL Java_p_A_00024C_Foo__Lp_A_B_2
ERROR MESSAGES/STACK TRACES THAT OCCUR :
There are no messages/crash logs.
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
Sorry, no time.
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Manually edit the produced header file and add dollar signs ("00024") where needed.