After the introduction of Java Memory Model, the Swing guidelines were changed to state that any Swing components need to be instantiated on the EDT in order to avoid non-published instance state.
What I could not find anywhere is whether the classloading is also mandated to be on the EDT or can we pre-load key Swing classes in a background thread? Is there any official statement from Sun/Oracle on this? Are there any classes that are known to hold non-threadsafe static state, hence need to be loaded on EDT?
Clarification to address Nemi's question: this is a practical issue. A sizable portion of our application's startup time, is spent classloading, and font/image-loading on the EDT. Most of this can be attributed to Swing and related libraries.
Here is som background: As many other Swing apps, on startup we are pre-constructing many forms, in order to make the UI more responsive. After profiling, we found that the actual time for form construction is relatively fast - what's slow is loading of all classes and fonts (disk reads are slow in corporate setup with on-access virus scanner, surveilance scanner, audit tracker and god knows what else tacked on the HDD driver).
We tried to construct the same forms in a background thread (violating Swing's rules) and then throw them away. Once we are done we construct the same forms on the EDT, which is much faster as all classes are loaded and any other files are in the disk cache. It works for us, and we'll probably keep doing it unless something really bad happens.
What I'm asking is whether this is a safe practice, a good practice or a hack?