ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jose Alberto Fernandez" <jalbe...@cellectivity.com>
Subject RE: antlibs and classloaders #2
Date Mon, 17 May 2004 13:42:13 GMT
> From: Peter Reilly [mailto:peter.reilly@corvil.com] 
> 
> Jose Alberto Fernandez wrote:
> 
> >This things sound like we are using the wrong abstraction here. 
> ><typedef/> inside an <antlib/> should use the antlib 
> classloader as the 
> >parent for any subsequent classloader.
> >  
> >
> In this case the parent is the antlib classloader (it is the default 
> classloader).
> 

So what happens if the toplevel antlib gets loaded from a different
classloader (because I defined classpaths and such). Would the
<typedef/>
inside pick-up that as the classloader? Or would it pickup some default
one?

> >I do not see why that should cause an infinite recursion.
> >  
> >
> The problem is that the <typedef 
> resource="net/.../antlib.xml"> <classpath 
> path="cpptasks.jar"/> </typedef> in the antlib will pick up 
> the antlib.xml resoure that contains <typedef 
> resource="net/.../antlib.xml">
> task which will pick up .....,
> 
> This does not happen with the current ant code, as the <typedef 
> resource="net/.../antlib.xml">
>   <classpath path="cpptasks.jar"/></typedef>
> task will not see the antlib.xml resource in the parent classloader.
> 
> Another way to work-around this is for the typedef to use a thread 
> specific stack to check
> for recursive loading of xml resources.
> This probally should be done in any case:
> 
> recursive.xml
> 
> <antlib>
>    <typedef file="recursive.xml"/>
> </antlib>
> 
> build.xml:
> <project>
>   <typedef file="recursive.xml"/>
> </project>
> 

What is the difference between this and what we do for <import/>s.
In both cases we need to make sure we do not go into an infinite loop.
It should not matter whether the XML is an import fragment or an
antlib.xml

Jose Alberto
> 
> Peter
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message