From b47512c2c75b94b7c5945985306fa303576bf90d Mon Sep 17 00:00:00 2001 From: Neville Li Date: Fri, 30 May 2014 17:44:34 -0400 Subject: [PATCH] support mutable BitSet --- .../main/scala/com/twitter/chill/ScalaKryoInstantiator.scala | 2 ++ chill-scala/src/test/scala/com/twitter/chill/KryoSpec.scala | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/chill-scala/src/main/scala/com/twitter/chill/ScalaKryoInstantiator.scala b/chill-scala/src/main/scala/com/twitter/chill/ScalaKryoInstantiator.scala index 3feed9f8..7fb02a7b 100644 --- a/chill-scala/src/main/scala/com/twitter/chill/ScalaKryoInstantiator.scala +++ b/chill-scala/src/main/scala/com/twitter/chill/ScalaKryoInstantiator.scala @@ -31,6 +31,7 @@ import scala.collection.immutable.{ import scala.collection.mutable.{ WrappedArray, + BitSet => MBitSet, Map => MMap, HashMap => MHashMap, Set => MSet, @@ -150,6 +151,7 @@ class ScalaCollectionsRegistrar extends IKryoRegistrar { // The above ListMap/HashMap must appear before this: .forTraversableSubclass(Map.empty[Any,Any]) // here are the mutable ones: + .forTraversableClass(MBitSet.empty, isImmutable = false) .forTraversableClass(MHashMap.empty[Any,Any], isImmutable = false) .forTraversableClass(MHashSet.empty[Any], isImmutable = false) .forTraversableSubclass(MQueue.empty[Any], isImmutable = false) diff --git a/chill-scala/src/test/scala/com/twitter/chill/KryoSpec.scala b/chill-scala/src/test/scala/com/twitter/chill/KryoSpec.scala index f2dade91..a990cdde 100644 --- a/chill-scala/src/test/scala/com/twitter/chill/KryoSpec.scala +++ b/chill-scala/src/test/scala/com/twitter/chill/KryoSpec.scala @@ -20,7 +20,7 @@ import org.specs._ import org.specs.matcher.Matcher import scala.collection.immutable.{SortedSet, BitSet, ListSet, HashSet, SortedMap, ListMap, HashMap} -import scala.collection.mutable.{ArrayBuffer => MArrayBuffer, HashMap => MHashMap} +import scala.collection.mutable.{ArrayBuffer => MArrayBuffer, BitSet => MBitSet, HashMap => MHashMap} import _root_.java.util.PriorityQueue import _root_.java.util.Locale import scala.collection.mutable @@ -83,6 +83,8 @@ class KryoSpec extends Specification with BaseProperties { SortedSet(1L, 2L, 3L, 4L), BitSet(), BitSet((0 until 1000).map{ x : Int => x*x } : _*), + MBitSet(), + MBitSet((0 until 1000).map{ x : Int => x*x } : _*), SortedMap[Long, String](), SortedMap("b" -> 2, "a" -> 1), ListMap("good" -> 0.5, "bad" -> -1.0),