ADDITIONAL SYSTEM INFORMATION :
Linux and Win10
JDK: 11,12,14
A DESCRIPTION OF THE PROBLEM :
javac -h "forgets" to include the magic 00024 before the inner class as passed arg
The important bit is the second 00024 in the method name Java_p_A_00024B_call__Lp_A_00024B_2.
At runtime the resolver looks only for Java_p_A_00024B_call__Lp_A_00024B_2 and not for Java_p_A_00024B_call__Lp_A_B_2 so accessing b.call(b) will result in an UNsatisfiedLinkError.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
execute: javac A.java -h .
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class p_A_00024B */
#ifndef _Included_p_A_00024B
#define _Included_p_A_00024B
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: p_A_00024B
* Method: call
* Signature: ()Lp/A$B;
*/
JNIEXPORT jobject JNICALL Java_p_A_00024B_call__
(JNIEnv *, jclass);
/*
* Class: p_A_00024B
* Method: call
* Signature: (Lp/A$B;)V
*/
JNIEXPORT void JNICALL Java_p_A_00024B_call__Lp_A_00024B_2
(JNIEnv *, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif
ACTUAL -
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class p_A_B */
#ifndef _Included_p_A_B
#define _Included_p_A_B
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: p_A_B
* Method: call
* Signature: ()Lp/A/B;
*/
JNIEXPORT jobject JNICALL Java_p_A_00024B_call__
(JNIEnv *, jobject);
/*
* Class: p_A_B
* Method: call
* Signature: (Lp/A/B;)V
*/
JNIEXPORT void JNICALL Java_p_A_00024B_call__Lp_A_B_2
(JNIEnv *, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif
---------- BEGIN SOURCE ----------
package p;
class A {
class B {
native B call();
native void call(B b);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
ignore or manually fix (in the c sources) the genrated javac -h header.
FREQUENCY : always
Linux and Win10
JDK: 11,12,14
A DESCRIPTION OF THE PROBLEM :
javac -h "forgets" to include the magic 00024 before the inner class as passed arg
The important bit is the second 00024 in the method name Java_p_A_00024B_call__Lp_A_00024B_2.
At runtime the resolver looks only for Java_p_A_00024B_call__Lp_A_00024B_2 and not for Java_p_A_00024B_call__Lp_A_B_2 so accessing b.call(b) will result in an UNsatisfiedLinkError.
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
execute: javac A.java -h .
EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class p_A_00024B */
#ifndef _Included_p_A_00024B
#define _Included_p_A_00024B
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: p_A_00024B
* Method: call
* Signature: ()Lp/A$B;
*/
JNIEXPORT jobject JNICALL Java_p_A_00024B_call__
(JNIEnv *, jclass);
/*
* Class: p_A_00024B
* Method: call
* Signature: (Lp/A$B;)V
*/
JNIEXPORT void JNICALL Java_p_A_00024B_call__Lp_A_00024B_2
(JNIEnv *, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif
ACTUAL -
/* DO NOT EDIT THIS FILE - it is machine generated */
#include <jni.h>
/* Header for class p_A_B */
#ifndef _Included_p_A_B
#define _Included_p_A_B
#ifdef __cplusplus
extern "C" {
#endif
/*
* Class: p_A_B
* Method: call
* Signature: ()Lp/A/B;
*/
JNIEXPORT jobject JNICALL Java_p_A_00024B_call__
(JNIEnv *, jobject);
/*
* Class: p_A_B
* Method: call
* Signature: (Lp/A/B;)V
*/
JNIEXPORT void JNICALL Java_p_A_00024B_call__Lp_A_B_2
(JNIEnv *, jobject, jobject);
#ifdef __cplusplus
}
#endif
#endif
---------- BEGIN SOURCE ----------
package p;
class A {
class B {
native B call();
native void call(B b);
}
}
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
ignore or manually fix (in the c sources) the genrated javac -h header.
FREQUENCY : always