-
Bug
-
Resolution: Fixed
-
P4
-
1.1, 1.1.3, 1.1.5, 1.2.0
-
1.2fcs
-
generic, x86
-
solaris_2.5.1, windows_95, windows_nt
-
Not verified
Name: sg39081 Date: 08/22/97
From the VM specification section 2.16.4-
Initialization of a class consists of executing its static initializers
and the initializers for static fields declared in the class... A class
or interface of type T will be initialized at its first active use,
which occurs if
T is a class and a method declared in T is invoked
T is a class and a constructor for class T is invoked
A non constant field declared in T is used or assigned.
The current JDK (on all platforms) executes the
static initializer blocks at class load time
rather than under one of the conditions given
above. This has the effect that under JavaSoft's
VM a Class.forName() will cause the static
intializer block to be executed in the loaded
class while under VMs that are correctly
implemented, this does not happen.
======================================================================
- duplicates
-
JDK-4035125 <clinit> being called on Class.forName and Class.getDeclaredMethod
- Closed