Static Initializers best practice?
Hi,
In Effective Java, Joshua Bloch recommends using static initializers instead of lazy initializers whenever possible. I see one major with that advice: exceptions.
As you can see from http://twasink.net/blog/archives/2006/07/how_not_to_hand.html there is a real lack of consensus when it comes to static initializers. In fact, I strongly suspect there is no good way to throw exceptions out of static blocks what-so-ever.
In that case, shouldn't they be avoided altogether? I'd love to hear your feedback.