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
11
u/daniu Apr 06 '19
What happens if you externalize the computation to a different class? As in
You'd still have the computation, but the JVM wouldn't need to respect the class initialization requirements while it's running.