> Does anyone know how to get a Method or Constructor object for <clinit>
> (which we know
> isn't either), to be able use it in JVMTI's SetBreakpoint() in order to
> set a breakpoint in
> <clinit>? Or how to otherwise obtain a jmethodID for <clinit>?
As far as the JVM is concerned, <clinit> is just another static method (albeit
one with special rules about how and when it must[n't] be called). So I
imagine that you can get a handle on the method in just the same was as you
would for any other static method. I haven't tried it with JVMTI, but in JNI
calling
GetStaticMethodID(jclass, '<clinit>', '()V').
returns an apparently valid method ID.
-- chris
darthmind@gmail.com - 26 Apr 2006 13:41 GMT
<clinit> is a special method. And, no, Class.getMethods() and the like
explicitly exclude <clinit>. The problem with GetStaticMethodID() is
that it initializes an uninitialized class, which is not desired in
this case.
Anyone else have any other thoughts?