I am working on a JNI implementation using C and try to sort a list of type java/lang/List
using java/util/Collections
sort
method with a Comparator
. To get the descriptor signatures I mainly use javap
.
In this case javap does not show any descriptor for the sort methods. All I get is
$ javap -s -p java.util.Collections | grep -i sort
public static <T extends java.lang.Comparable<? super T>> void sort(java.util.List<T>);
public static <T> void sort(java.util.List<T>, java.util.Comparator<? super T>);
...
In the JNI code, I use
// Get Collections class
jclass collections_clazz = (*(px->env))->FindClass(px->env, "java/util/Collections");
if (!collections_clazz) ...
// Get sort method
jmethodID sort_mid = (*(px->env))->GetStaticMethodID(px->env, collections_clazz,
"sort", "(Ljava/lang/List;Ljava/util/Comparator;)V");
if (!sort_mid) ...
In my case sort_mid
is false (or NULL). The signature I use with GetStaticMethodID is a rough guess. I have to admit I am not deep into Java, but its enough to use with JNI though.
I am using jdk1.8.0_31
with this project.
Could anybody give me a hint whats the issue here? What I am missing?
Thanks in advance for the help!
Perhaps confusingly, standard classes like List
are not in java.lang
or even java.collections
but java.util
You need Ljava/util/List