ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Conor MacNeill <>
Subject Re: Taskdef Classloader change (was RE: Custom Ant tasks and classpath issue)
Date Thu, 28 Feb 2002 10:42:46 GMT
Vincent Massol wrote:

> Ah ok. Thanks Stefan for the clarification. Is that the way we want Ant
> to operate ? Don't you think it would be better if the "reverseloader"
> mode was the default one. It would be backward compatible in all cases
> except for persons like who were counting on their classpath was being
> picked before the system classpath.
> I do agree, it is not nice to have my jar in both places. It wasn't
> actually meant that way. I had just dropped my cactus-ant.jar in
> anthome/lib a long time ago for some quick test I did ... and had
> forgotten about it ... until 3 months later I had to change one task ...
> I think it is safer to load the user classpath before the system
> classpath, making the user classloader a child of the system
> classloader.
> What do you think ?


This is nice in theory but dangerous in practice. If you don't delegate 
to the parent loader it is possible to end up loading two different 
instances of the same class. Sometimes that is OK but sometimes, when 
there is an indirect relationship between the two classes, the JVM will 
complain and throw a LinkageError. the circumstances under which this 
happens are complicated and are enforced by a set of "loader 
constraints". It is part of the mechanism implemented in Java to ensure 
type safety.


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

View raw message