On Mon, 12 Nov 2001 10:38, Ted Neward wrote:
> If you want to be *really* technical about it, the example
>
> > URLClassLoader classLoader = new URLClassLoader( myURLs );
> >
> > where they would need to do something like
> >
> > URLClassLoader classLoader = new URLClassLoader( myURLs,
> >             this.getClass().getClassLoader() );
>
> really highlights a bug in the Java Class Libraries, and isn't an
> Ant-specific problem whatsoever--the default "parent" argument is always
> the System ClassLoader (the sun.misc.AppClassLoader), when it should be the
> ClassLoader of the class that's executing the current call
> (getCallerClassLoader()).

God no - that would be horrible. Setting the parent to ClassLoader would 
vastly increase the complexity of ClassLoader setups. This would break 
virtually every EJB/servlet engine out there and cause massive portability 
headaches. Coupling behaviour to the ClassLoader that happened to load the 
Class would be a nightmare. We already have enough of these heaches dealing 
with making sure dependent Classes are in current ClassLoader or parent 
ClassLoaders.

If you were to claim that all ClassLoaders use the ContextClassLoader then 
that may be viable but can't ever change for backwards compatibility reasons.

-- 
Cheers,

Pete

---------------------------------------------------
"Marriage, Friends, Religon -- these are the demons 
you must slay in order to suceed in business.." 
                 -- Mr. Burns, The Simpsons 
---------------------------------------------------


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to