Bug 1613 - AntClassLoader doesn't run static initializer blocks
Summary: AntClassLoader doesn't run static initializer blocks
Status: RESOLVED FIXED
Alias: None
Product: Ant
Classification: Unclassified
Component: Core (show other bugs)
Version: 1.3
Hardware: All All
: P3 major (vote)
Target Milestone: ---
Assignee: Ant Notifications List
URL:
Keywords:
: 1066 1362 (view as bug list)
Depends on:
Blocks:
 
Reported: 2001-05-03 06:27 UTC by Stefan Bodewig
Modified: 2008-02-22 12:18 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Bodewig 2001-05-03 06:27:30 UTC
A couple of bug reports boil down to this punch line - use this report to
collect them in one place.
Comment 1 Stefan Bodewig 2001-05-03 06:30:17 UTC
*** Bug 1066 has been marked as a duplicate of this bug. ***
Comment 2 Stefan Bodewig 2001-05-03 06:32:53 UTC
*** Bug 1362 has been marked as a duplicate of this bug. ***
Comment 3 Conor MacNeill 2001-05-10 06:43:54 UTC
I've investigated this issue and it is not an Ant specific limitation. Firstly 
it is not the classloader's responsibility to initialize classes (run static 
initializers). It seems that the JDK's Class.forName does initialize the class 
but when a class is loaded through a classloader it is not. Under JDK1.1 there 
is no clean way to force initialization. Attempting to create an instance via 
newInstance does work, even if the instance cannot be created. This will be the 
workaround adopted for Ant 1.x
Comment 4 Conor MacNeill 2001-05-10 07:28:52 UTC
I have added the newInstance call to force inirtialization of the loaded class.