On Monday 22 October 2001 22:21, you wrote:
Hi,

> When writing JNI code which references Java classes, one has to use
> special markup on the fully qualified class names.
> I.e. "Lorg/apache/turbine/Turbine;" would be the string literal
> corresponding to the class org.apache.turbine.Turbine, and something
> like "(Ljava/lang/String;Ljava/lang/String;)V" to denote a method
> which takes two String parameters.  Looking at some bytecode using
> `strings`, I notice that this seems to apply to at least part of a
> method signature.  Not a lot of help here, but maybe something to
> think about.  <shrug/>

ok, here's my two cents (or was it dimes?): There are two ways how classes 
can be referenced in class files: either through a direct reference to a 
ConstantClass object in the constant pool, or through the signature of a 
method/field. The former case is easy to detect, because you just have to 
scan the constant pool. The latter is a little more difficult to detect, but 
I think you can do it by scanning the byte code and just take only those 
constant pool entries (i.e. strings) into account that are referenced by a, 
say, GETFIELD instruction. I think I even introduced an interface into BCEL 
to denote such instructions named "LoadClass".
It takes a little more time than the heuristic method, but is still O(n) ;-)

Cheers
        Markus
-- 
Email:  [EMAIL PROTECTED]           Phone: +49 30 838 75141
WWW:    http://www.berlin.de/~markus.dahm/

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to