Phase RefCheck expanded this to the following code, which is not thread-safe:
// [[Trees after phase refcheck]]
// Scala source: bug-nested-objects.scala
final class O1() extends scala.Object() {
final class O2() extends scala.Object() {
};
private var O2$: O1.O2 = null;
final def O2: O1.O2 = {
if (null.$eq$eq(O1.O2$))
O1.O2$ = new O1.O2()
else
{
};
O1.O2$
};
private def O2_$eq(O2: O1.O2): scala.Unit = O1.O2$ = O2
};
final /*object*/ val O1: O1 = new O1();
The problem here is that if two threads access object O2 simultaneously, two instances of it might \
be created, which violates the specification. This problem is known, the aim of this report is just that we do n\
ot forget it.
|