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:31:03 GMT
Aaron Kelley wrote:
> Does anyone know how the ClassFileSet determines a dependency? 

I do :-)

ClassFileSet works as follows. Firstly it determines a set of root classes. 
This is either the single class specified by a root element or the set 
classes included in a rootfileset.

These root classes are used as the starting points for the dependency 
search. ClassfileSet uses BCEL to analyze each class. The bytecode for each 
class includes a structure known as the constant pool which contains 
structures such as classrefs, method refs and fieldrefs. Each of these 
identifies another class upon which the class depends. All of these refs are 
gathered up as the dependencies of the class being examined. These are 
examined in turn until the closure of all dependencies is achieved.

The search is limited to classes within the classfileset's basedir. The 
includes element on the classfileset is not used - it is ignored.

When the classfileset is scanned the root classes and their dependencies are 
returned.

> I still
> cannot get the ClassFileSet to work, so maybe it does not work how I
> think it should.  I am not instantiating my classes directly.  Instead I
> have a factory that will return an instance, given the class of the
> Object.  Here is an example:
>  
> MyClass myclass = MyFactory.create(MyClass.class);
>  
> I would think that MyClass should be seen as a dependency (given that
> this line exists in my rootfileset).  

This will show up as a dependency (a class reference). It should be picked up.

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