Uninitialized object leaked to another thread despite no code explicitly leaking it?
Here is what I think: because b is not final, the compiler is free to reorder the operations as it likes, right? So this, fundamentally is a reordering issue and as a result a unsafe publication issue Marking the variable as final will fix the problem. More or less, it is the same example as … Read more