ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jesse Glick <>
Subject Re: classloader for 1.7
Date Thu, 31 Aug 2006 19:15:59 GMT
Peter Reilly wrote:
> I have done a prototype and the results look good:

Does indeed look safer to me.

> b) it intercepts classes with "optional" or "ScriptRunner" in the 
> name and loads these from itself rather than from the parent
> classloader.

Note that you could exclude all of .taskdefs.** if we just cleaned up 
Ant a bit so that core classes do not refer to any taskdefs. Such a 
cleanup could also be enforced using Lattix or a similar tool, or by 
rearranging Ant sources a bit so that class loader separation is 
mirrored in the physical structure of the project. Of course this kind 
of cleanup could be done at any time.

>         <appendcomponentpath>

Workable if a bit verbose. Not sure "component" is very intuitive. Want 
to emphasize analogy to -lib cmdline option.

>         <appendcomponentpath>
>             <fileset dir="${user.home}/lang/bsf" includes="*.jar"/>
>             <fileset dir="${user.home}/lang/beanshell" includes="*.jar"/>
>         </appendcomponentpath>
>         <script language="beanshell">
>             System.out.println("Hello world");
>         </script>


>          a) adding more strings to intercept (fragile)

Alternately, use a positive rather than a negative pattern. More 
specifically: enumerate all packages/classes which should be loaded by 
the core loader, e.g. the transitive closure of Project plus perhaps a 
few things. For all other classes, the component loader should use the 
same classpath entries as the core loader but not delegate. That would 
mean that the component loader would be used for

- all standard tasks
- all types (incl. filters, conditions, etc.)
- all standard optional tasks and types
- anything else given in -lib or ${ant.home}/lib etc.
- anything else specified in <appendcomponentpath>

This would prevent the problem you mention with -lib bsf.jar + 
<acp>beanshell.jar</acp>, since bsf.jar, beanshell.jar, and 
ant-apache-bsf.jar would all be loaded in the component loader.

Such a separation could also be done on a JAR basis, i.e. check the code 
source (ProtectionDomain/CodeSource) of each class and only use the core 
loader for ant.jar, ant-launcher.jar, and (perhaps) the bundled XML 
JARs. Optionally, also split ant.jar into ant-core.jar + 


--  x22801*i%29%2B1

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message