diff options
-rw-r--r-- | src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala | 11 | ||||
-rw-r--r-- | test/files/run/reflection-sync-subtypes.check | 0 | ||||
-rw-r--r-- | test/files/run/reflection-sync-subtypes.scala (renamed from test/disabled/run/reflection-sync-subtypes.scala) | 0 |
3 files changed, 9 insertions, 2 deletions
diff --git a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala index 298d0ffebd..1a232c8de1 100644 --- a/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala +++ b/src/reflect/scala/reflect/runtime/SynchronizedSymbols.scala @@ -32,8 +32,15 @@ private[reflect] trait SynchronizedSymbols extends internal.Symbols { self: Symb trait SynchronizedSymbol extends Symbol { def gilSynchronizedIfNotInited[T](body: => T): T = { - if (isFullyInitialized) body - else gilSynchronized { body } + // TODO JZ desired, but prone to race conditions. We need the runtime reflection based + // type completers to establish a memory barrier upon initialization. Maybe a volatile + // write? We need to consult with the experts here. Until them, lock pessimistically. + // + // `run/reflection-sync-subtypes.scala` fails about 1/50 times otherwise. + // + // if (isFullyInitialized) body + // else gilSynchronized { body } + gilSynchronized { body } } override def validTo = gilSynchronizedIfNotInited { super.validTo } diff --git a/test/files/run/reflection-sync-subtypes.check b/test/files/run/reflection-sync-subtypes.check new file mode 100644 index 0000000000..e69de29bb2 --- /dev/null +++ b/test/files/run/reflection-sync-subtypes.check diff --git a/test/disabled/run/reflection-sync-subtypes.scala b/test/files/run/reflection-sync-subtypes.scala index 7f75a464ac..7f75a464ac 100644 --- a/test/disabled/run/reflection-sync-subtypes.scala +++ b/test/files/run/reflection-sync-subtypes.scala |