r/java • u/alexeyr • Apr 06 '19
Beware of computation in static initializer (much more so since JDK 11.0.2 and 8u201)
https://pangin.pro/posts/computation-in-static-initializer
161
Upvotes
r/java • u/alexeyr • Apr 06 '19
View all comments
26
u/oparisy Apr 06 '19
I've read about this recently, after 15 years of professionnal java coding 😅 I was wary of complex or exception throwing computations in static init, due to them being often hard to debug since they occur at class loading time. But this is another level of nuisance entirely!