I can get all the interfaces of a ClassType with allInterfaces() but this results in many JDWP calls to the debuggee which is slow. Another approach would be to check this:
Collection.class.isAssignableFrom(classType)
but the method isAssignableFrom() is in java.lang.Class and so I have to call this method with invokeMethod like this:
javaLangClassReference.invokeMethod(threadRef, isAssignableFromMethod,
Arrays.asList(myClassType),
ObjectReference.INVOKE_SINGLE_THREADED);
But there are two issues here:
classTypecannot be used as parameter for the method call, it is not aValue- How do I provide the
java.util.Collectionas a param to the Method(Arrays.asList(myClassType, ...))?
Also, is there a simpler way to check if a given ClassType is a java.util.Collection?