ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <co...@cortexebusiness.com.au>
Subject Re: ClassFileSet method of loading classes
Date Wed, 18 Dec 2002 14:37:36 GMT
Frank-Michael Moser wrote:
> 
> When you examine at the bytecode of your (root-)class you will see that 
> writing
> 
>   MyClass.class
> 
> is totally equivalent to
> 
>   Class.forName("package-of-myclass.MyClass");
> 
> In fact, in bytecode it is coded much more near to the latter form, such 
> that looking the bytecode can't result in finding any dependencies to 
> MyClass.

I'm not sure on what you are basing this information. When the VM loads a 
class it looks through its class dependencies as defined in the constant 
pool entries. It may well use something similar to the Class.forName to 
actually load the classes but you will not see this in the bytecode at all. 
It all happens in the VM's class resolution code.

Looking at the bytecode will most certainly reveal a dependency on the class 
MyClass. It is not encoded as a string but as a class reference entry in the 
constant pool (which in turn uses a string).

Look at these elements for more info
http://java.sun.com/docs/books/vmspec/2nd-edition/html/ClassFile.doc.html#42041

Conor


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message