Skip to content

Commit 6b35b58

Browse files
committed
Only look up the system prop controlling class tag caching once
1 parent 3c5e1a8 commit 6b35b58

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/src/scala/reflect/ClassTag.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ object ClassTag {
137137
val Nothing : ClassTag[scala.Nothing] = Manifest.Nothing
138138
val Null : ClassTag[scala.Null] = Manifest.Null
139139

140-
private val cacheDisabledProp = scala.sys.Prop[String]("scala.reflect.classtag.cache.disable")
140+
private val cacheDisabled = java.lang.Boolean.getBoolean("scala.reflect.classtag.cache.disable")
141141
private[this] object cache extends ClassValue[jWeakReference[ClassTag[_]]] {
142142
override def computeValue(runtimeClass: jClass[_]): jWeakReference[ClassTag[_]] =
143143
new jWeakReference(computeTag(runtimeClass))
@@ -173,9 +173,9 @@ object ClassTag {
173173
}
174174

175175
def apply[T](runtimeClass1: jClass[_]): ClassTag[T] = {
176-
if (cacheDisabledProp.isSet)
176+
if (cacheDisabled) {
177177
cache.computeTag(runtimeClass1).asInstanceOf[ClassTag[T]]
178-
else {
178+
} else {
179179
val ref = cache.get(runtimeClass1).asInstanceOf[jWeakReference[ClassTag[T]]]
180180
var tag = ref.get
181181
if (tag == null) {

0 commit comments

Comments
 (0)