ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <>
Subject Re: class static initialization and classloaders
Date Thu, 10 May 2001 13:27:28 GMT

----- Original Message -----
From: "Peter Donald" <>
> It is by jdks design that this is done - I have run into it heaps in past
> (Avalon/Phoenix was historically littered with hacks to force static
> resolution and initialization).
> One of the reasons I wanted resolution of all classes at loading time -
> removes this problem. The only way I know how to do it is to use
> Class.forName( "", true, null );
> or
> Class.forName( "", true, myClassLoader );
> Which was -1ed in the vote IIRC ... ;)

Resolution is not the issue, I believe. I experimented by setting the
AntClassLoader to always resolve regardles of whether it was requested by
the caller. It made no difference - the static initialisers were not run.

BTW, why did you say class resolution when you really meant class

> * force resolution of classes on loading to identify classloader
>   issues early. (At least in global classloader).

I do not believe resolveClass() and the initialize parameter of
Class.forName achieve the same thing (linking v initialization).  Besides
the latter is JDK1.2+ so generally not an option for Ant 1.x.


View raw message