سؤال

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