@@ -20,9 +20,7 @@ import com.esotericsoftware.kryo.Kryo
2020import com .esotericsoftware .kryo .{ Serializer => KSerializer }
2121import com .esotericsoftware .kryo .io .{ Input , Output }
2222
23- import com .twitter .bijection .{ Base64String , Bufferable , ImplicitBijection , Injection }
24-
25- import org .objenesis .strategy .StdInstantiatorStrategy
23+ import com .twitter .bijection .{ Bufferable , ImplicitBijection }
2624
2725import scala .collection .immutable .{
2826 BitSet ,
@@ -32,14 +30,14 @@ import scala.collection.immutable.{
3230}
3331
3432import scala .collection .mutable .{
35- Builder ,
3633 WrappedArray ,
3734 Map => MMap ,
3835 Set => MSet ,
3936 ListBuffer ,
4037 Queue => MQueue ,
4138 Buffer
4239}
40+ import scala .util .matching .Regex
4341
4442object KryoSerializer {
4543
@@ -88,13 +86,17 @@ object KryoSerializer {
8886 * You should go from MOST specific, to least to specific when using
8987 * default serializers. The FIRST one found is the one used
9088 */
91- // wrapper array is abstract
92- newK.forSubclass[WrappedArray [Any ]](new WrappedArraySerializer [Any ])
89+ newK
90+ .forSubclass[Regex ](new RegexSerializer )
91+ // wrapper array is abstract
92+ .forSubclass[WrappedArray [Any ]](new WrappedArraySerializer [Any ])
9393 .forSubclass[BitSet ](new BitSetSerializer )
9494 .forSubclass[java.util.PriorityQueue [AnyRef ]](new PriorityQueueSerializer [AnyRef ])
9595 .forTraversableSubclass(Queue .newBuilder[Any ])
9696 // List is a sealed class, so there are only two subclasses:
9797 .forTraversableSubclass(List .newBuilder[Any ])
98+ // add mutable Buffer before Vector, otherwise Vector is used
99+ .forTraversableSubclass(Buffer .newBuilder[Any ], isImmutable = false )
98100 // Vector is a final class
99101 .forTraversableClass(Vector .newBuilder[Any ])
100102 .forTraversableSubclass(IndexedSeq .newBuilder[Any ])
@@ -109,7 +111,6 @@ object KryoSerializer {
109111 .forTraversableSubclass(MMap .newBuilder[Any ,Any ], isImmutable = false )
110112 .forTraversableSubclass(MSet .newBuilder[Any ], isImmutable = false )
111113 .forTraversableSubclass(ListBuffer .newBuilder[Any ], isImmutable = false )
112- .forTraversableSubclass(Buffer .newBuilder[Any ], isImmutable = false )
113114 // This should be last, lots of things are seq/iterable/traversable
114115 // These are questionable and might break things.
115116 // rarely will you only expect an iterable/traversable on the reverse
0 commit comments