ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Conor MacNeill" <>
Subject RE: ExecuteJava and initializeClass
Date Wed, 16 Jan 2002 02:09:21 GMT

> -----Original Message-----
> From: Magesh Umasankar []
> Sent: Wednesday, 16 January 2002 11:03 AM
> To:
> Subject: ExecuteJava and initializeClass
> Why is AntClassLoader.initializeClass(target) being called?
> This method creates a new instance of the class by calling
> its no-arg constructor. I mean, when main.invoke is called, the
> static initializers of the class are anyway going to be invoked,
> right?

No, unfortunately not always, IIRC although I could be wrong :-) Certainly
under JDK 1.1, static initializers are not always run when you load a class
through a classloader. This causes a problem for JDBC driver loading.
Perhaps not required for ExecuteJava.

BTW, Have you read the comments in the initializeClass method? I know it is
a hack. If you want to change it - feel free. It will be good to test your
class under JDK 1.1.

I can't seem to access CVSWeb at the moment to get more history for this.

> Or is it being invoked to work around some JDK bug?
> The issue I have is that the class's constructor gets called
> twice if the main method constructs this object also.

Yes, this is a side-effect. Does this cause you problems?


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

View raw message