Skip to content

Commit 9d68149

Browse files
committed
remove dead code
writeReplace check occurs before writeObject is called, so the HashSet.writeReplace via its proxy does the correct thing previous comment was factually incorrect "references to this class are ever handed out to client code" - they are "HashTrieSet serialization takes care of the situation" - no it doesnt So these comment are probably a relic or a prior implementation
1 parent 04a7837 commit 9d68149

File tree

1 file changed

+0
-15
lines changed

1 file changed

+0
-15
lines changed

library/src/scala/collection/immutable/HashSet.scala

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -488,21 +488,6 @@ object HashSet extends ImmutableSetFactory[HashSet] {
488488
override def iterator: Iterator[A] = ks.iterator
489489
override def foreach[U](f: A => U): Unit = ks.foreach(f)
490490

491-
private def writeObject(out: java.io.ObjectOutputStream) {
492-
// this cannot work - reading things in might produce different
493-
// hash codes and remove the collision. however this is never called
494-
// because no references to this class are ever handed out to client code
495-
// and HashTrieSet serialization takes care of the situation
496-
sys.error("cannot serialize an immutable.HashSet where all items have the same 32-bit hash code")
497-
//out.writeObject(kvs)
498-
}
499-
500-
private def readObject(in: java.io.ObjectInputStream) {
501-
sys.error("cannot deserialize an immutable.HashSet where all items have the same 32-bit hash code")
502-
//kvs = in.readObject().asInstanceOf[ListSet[A]]
503-
//hash = computeHash(kvs.)
504-
}
505-
506491
}
507492

508493
/**

0 commit comments

Comments
 (0)