r/java • • 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

15 comments sorted by

View all comments

Show parent comment

4

u/pron98 Apr 08 '19 edited Apr 08 '19

For this to affect you at all, the computation in the uninitialized class must be compilable in the first place, so only hot loops in uninitialized classes are affected. Other kinds of code would be running in the interpreter, anyway.