ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Re: Taskdef Classloader change (was RE: Custom Ant tasks and classpath issue)
Date Thu, 28 Feb 2002 11:12:52 GMT
On Thu, 28 Feb 2002, Vincent Massol <vmassol@octo.com> wrote:

> My understanding is that there is a hierarchy in CL : there is a
> parent and there are children CL.

correct.

> When a children CL is asked to load a class, it looks first if it
> can find it. If it cannot it delegates the load to its parent
> classloader. Up until the system classloader.

No - the other way around, the child first asks the parent.  See the
API documentation of ClassLoader:

>>  The ClassLoader class uses a delegation model to search for
>>  classes and resources. Each instance of ClassLoader has an
>>  associated parent class loader. When called upon to find a class
>>  or resource, a ClassLoader instance will delegate the search for
>>  the class or resource to its parent class loader before attempting
>>  to find the class or resource itself.

That way, if two loaders, which are children of the same class loader,
try to load a class that can be found by the parent class loader as
well as the child loaders will both get the class from the parent
class loader instead of two incompatible version loaded by the
children.

Stefan

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


Mime
View raw message