Вопрос

In JDI, there is a method

 Value ObjectReference.invokeMethod(ThreadReference, Method, args list, int options)

that invokes a method in the target (debuggee) VM.

But how can I call a static method? In such a case, I don't have an object reference.

TIL Java lets you call static methods on null, but this does not work here.

What would make sense is

 static Value ReferenceType.invokeStaticMethod(ThreadReference, Method, etc)

but no such thing exists, and I cannot for the life of me figure out a way to do by any other means either.

Это было полезно?

Решение

ClassType extends ReferenceType which should give you what you want. See ClassType.invokeMethod.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top