So if a program does this:
static ArrayList<X> a = null;
static{
for(;;){X x = new X(); a.add(x)}
}
and the only operations called after the static initializing, on the shared list, are get() and x.t()
X x = a.get(i); x.t();
and X doesn't have access to container & is thread safe, that should mean that using Arraylist like this, without synchronization is thread safe, correct?
staticblock code provides in your example, it will throw aExceptionInInitializerError.tdo? Or istany arbitrary function we can think of?