문제

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