I've got a class with only static members, designed like that:
public class Clazz {
public static final Foo foo = FooFactory.createFoo();
private static Bar bar;
public static void prepare() {
bar = new Bar(foo);
}
}
When calling Clazz.prepare(), I can see that foo is null at bar initializing. As far as I know, static initializer should be invoked just before the invocation of any static method of the class. Therefore, foo should already be initialized when prepare() is called. Am I missing something?