You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -149,7 +151,7 @@ abstract class WeakHashSet[A <: AnyRef](initialCapacity: Int = 8, loadFactor: Do
149
151
casenull=>null
150
152
case _ =>
151
153
valentryElem= entry.get
152
-
if (isEqual(elem, entryElem.asInstanceOf[A])) entryElem
154
+
if (isEqual(elem, entryElem)) entryElem
153
155
else linkedListLoop(entry.tail)
154
156
}
155
157
@@ -165,8 +167,6 @@ abstract class WeakHashSet[A <: AnyRef](initialCapacity: Int = 8, loadFactor: Do
165
167
}
166
168
167
169
defput(elem: A):A= {
168
-
// case null => throw new NullPointerException("WeakHashSet cannot hold nulls")
169
-
// case _ =>
170
170
Stats.record(statsItem("put"))
171
171
removeStaleEntries()
172
172
valh= hash(elem)
@@ -177,8 +177,8 @@ abstract class WeakHashSet[A <: AnyRef](initialCapacity: Int = 8, loadFactor: Do
177
177
deflinkedListLoop(entry: Entry[A] |Null):A= entry match {
178
178
casenull=> addEntryAt(bucket, elem, h, oldHead)
179
179
case _ =>
180
-
valentryElem= entry.get.asInstanceOf[A]
181
-
if (isEqual(elem, entryElem)) entryElem
180
+
valentryElem= entry.get
181
+
if (isEqual(elem, entryElem)) entryElem.uncheckedNN
182
182
else linkedListLoop(entry.tail)
183
183
}
184
184
@@ -294,7 +294,7 @@ abstract class WeakHashSet[A <: AnyRef](initialCapacity: Int = 8, loadFactor: Do
294
294
assert(entry.get !=null, s"$entry had a null value indicated that gc activity was happening during diagnostic validation or that a null value was inserted")
295
295
computedCount +=1
296
296
valcachedHash= entry.hash
297
-
valrealHash= hash(entry.get)
297
+
valrealHash= hash(entry.get.uncheckedNN)
298
298
assert(cachedHash == realHash, s"for $entry cached hash was $cachedHash but should have been $realHash")
299
299
valcomputedBucket= index(realHash)
300
300
assert(computedBucket == bucket, s"for $entry the computed bucket was $computedBucket but should have been $bucket")
0 commit comments