ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <>
Subject Re: Using classloader for Junit
Date Fri, 20 Jun 2003 01:17:44 GMT
On Fri, 20 Jun 2003 01:40 am, Nick Chalko wrote:
> The
> if (resourceName.startsWith(""))
> {return useParentFirst;}
> HACK worked last night.
> I will try something a little cleaner tonight.

It might appear to work but can fail in subtle ways. I have had instances 
where the second invocation of a task would cause an error because it would 
bring classes into the VM which were there already leading to two different 
class instances with the same classname being reachable (loader constraint 

This can be quite non-deterministic. If I installed a delay, the first load of 
classes would be GC'd avoiding the constaint violation by the second 
instance. So, I urge caution :-)

> >BTW, I don;t really agree with the <classloader> task being used to modify
> > the effective classpath of running ClassLoaders. I'm sure this will cause
> > trouble too.
> Seems to break some of the "properties are  immutable" philosophy of ant.

No - not really an Ant level issue. I am concerned by the scenario where a 
classloader with a child can not find a class on the first instance causing 
the child to load the class. If that class is later added to the loader's 
classpath, it becomes possible for parent to load the class and then we have 
a parent and child loader with the same class loaded ----> bad stuff happens.



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

View raw message