FULL PRODUCT VERSION :
JDK6-rc-b104
FULL OS VERSION :
Solaris 2.9
A DESCRIPTION OF THE PROBLEM :
This problem exists in both JDK 5 and 6 under Solaris. If you overload a static native function, the VM is not generating the correct signature for the overloaded function when it tries to resolve it. I built a debug version of JDK 6 to verify this, stopping in the routine that is called to resolve the link. The name it is passing in to that routine does not match the name generated by javah for the function. It appears to have omitted the encoded argument information that distinguishes the overloaded functions.
Here is a code snippet to better illustrate the problem.
public class Type1 {}
public class Type2 {}
public static native String Image(Type1 t);
public static native String Image(Type2 t);
...
Type1 t1 = new Type1();
Type2 t2 = new Type2();
String i1 = Image(t1);
String i2 = Image(t2);
When the first Image function is called, an unsatisfied link error will occur (and yes, in my actual code I did load the library containing the native function definitions and I have verified that the library contains and entry for each function as generated by javah). This is definitely a bug in how the VM generates the encoded signature for these function calls.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See description
EXPECTED VERSUS ACTUAL BEHAVIOR :
See description
ERROR MESSAGES/STACK TRACES THAT OCCUR :
See description
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
See description
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use unique function names
JDK6-rc-b104
FULL OS VERSION :
Solaris 2.9
A DESCRIPTION OF THE PROBLEM :
This problem exists in both JDK 5 and 6 under Solaris. If you overload a static native function, the VM is not generating the correct signature for the overloaded function when it tries to resolve it. I built a debug version of JDK 6 to verify this, stopping in the routine that is called to resolve the link. The name it is passing in to that routine does not match the name generated by javah for the function. It appears to have omitted the encoded argument information that distinguishes the overloaded functions.
Here is a code snippet to better illustrate the problem.
public class Type1 {}
public class Type2 {}
public static native String Image(Type1 t);
public static native String Image(Type2 t);
...
Type1 t1 = new Type1();
Type2 t2 = new Type2();
String i1 = Image(t1);
String i2 = Image(t2);
When the first Image function is called, an unsatisfied link error will occur (and yes, in my actual code I did load the library containing the native function definitions and I have verified that the library contains and entry for each function as generated by javah). This is definitely a bug in how the VM generates the encoded signature for these function calls.
THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Yes
THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Yes
STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
See description
EXPECTED VERSUS ACTUAL BEHAVIOR :
See description
ERROR MESSAGES/STACK TRACES THAT OCCUR :
See description
REPRODUCIBILITY :
This bug can be reproduced always.
---------- BEGIN SOURCE ----------
See description
---------- END SOURCE ----------
CUSTOMER SUBMITTED WORKAROUND :
Use unique function names