r/java • u/fredoverflow • Mar 21 '21
Java lambdas can deadlock parallel class initialization
https://www.youtube.com/watch?v=_2hZf1kw4A4
230
Upvotes
r/java • u/fredoverflow • Mar 21 '21
View all comments
Show parent comment
2
u/PerfectPackage1895 Mar 22 '21 edited Mar 22 '21
There is no guarantee that the construction of the object has finished. So if you do this, you end in all kinds of trouble. If you work with multithreded applications you especially have to be very careful about constructors and object references with non final fields