質問

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