r/java • u/psychologicalX • Mar 05 '18
Top 10 Useful, Yet Paranoid Java Programming Techniques
http://blog.jooq.org/2015/08/11/top-10-useful-yet-paranoid-java-programming-techniques/
223
Upvotes
r/java • u/psychologicalX • Mar 05 '18
1
u/fforw Mar 06 '18
There's also the unfortunate fact that constructors are not necessarily thread-safe without final.
only the "ThreadSafe" variant with final ensures that other threads can't possibly access our instance without the id field having been written.