From daf1dcd0bc82c9ce84dbfe466cb74c1bdec49811 Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Tue, 14 Jul 2020 22:11:02 +0100 Subject: [PATCH 1/8] Update to scala 2.13.3 --- .../ScalaCollectionsRegistrarCompat.scala | 6 +- .../chill/RegistrationIdsSpecData.scala | 113 +++++++++-------- .../chill/SerializedExamplesData.scala | 118 +++++++++--------- ...SerializedExamplesOfStandardDataSpec.scala | 30 ++--- 4 files changed, 138 insertions(+), 129 deletions(-) diff --git a/chill-scala/src/main/scala-2.13+/com/twitter/chill/ScalaCollectionsRegistrarCompat.scala b/chill-scala/src/main/scala-2.13+/com/twitter/chill/ScalaCollectionsRegistrarCompat.scala index 831449da..eb3404bf 100644 --- a/chill-scala/src/main/scala-2.13+/com/twitter/chill/ScalaCollectionsRegistrarCompat.scala +++ b/chill-scala/src/main/scala-2.13+/com/twitter/chill/ScalaCollectionsRegistrarCompat.scala @@ -26,6 +26,10 @@ import scala.collection.immutable.Range * provided registrations. */ class ScalaCollectionsRegistrarCompat extends IKryoRegistrar { - override def apply(newK: Kryo): Unit = + override def apply(newK: Kryo): Unit = { newK.register(classOf[Range.Exclusive]) + newK + .forConcreteTraversableClass(Vector[Any]()) + .forConcreteTraversableClass(Vector('a)) + } } diff --git a/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala b/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala index b647967f..143bd225 100644 --- a/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala +++ b/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala @@ -1,11 +1,11 @@ /* -Copyright 2019 Twitter, Inc. +Copyright 2020 Twitter, Inc. -Licensed under the Apache License, Version 2.0 (the "License"); +Licensed under the Apache License, Version 3.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-2.0 +http://www.apache.org/licenses/LICENSE-3.1 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -111,60 +111,63 @@ object RegistrationIdsSpecData { |90 -> class java.util.Collections$UnmodifiableSortedMap |91 -> class java.util.Collections$UnmodifiableSortedSet |92 -> class com.esotericsoftware.kryo.serializers.ClosureSerializer$Closure - |93 -> class scala.collection.immutable.Range$Exclusive""".stripMargin.linesIterator.mkString("\n") + |93 -> class scala.collection.immutable.Range$Exclusive + |94 -> class scala.collection.immutable.Vector0$ + |95 -> class scala.collection.immutable.Vector1""".stripMargin.linesIterator.mkString("\n") val RecentEntries = - """94 -> class [B - |95 -> class [S - |96 -> class [I - |97 -> class [J - |98 -> class [F - |99 -> class [D - |100 -> class [Z - |101 -> class [C - |102 -> class [Ljava.lang.String; - |103 -> class [Ljava.lang.Object; - |104 -> class java.lang.Class - |105 -> class java.lang.Object - |106 -> class scala.collection.mutable.ArraySeq$ofByte - |107 -> class scala.collection.mutable.ArraySeq$ofShort - |108 -> class scala.collection.mutable.ArraySeq$ofInt - |109 -> class scala.collection.mutable.ArraySeq$ofLong - |110 -> class scala.collection.mutable.ArraySeq$ofFloat - |111 -> class scala.collection.mutable.ArraySeq$ofDouble - |112 -> class scala.collection.mutable.ArraySeq$ofBoolean - |113 -> class scala.collection.mutable.ArraySeq$ofChar - |114 -> class scala.collection.mutable.ArraySeq$ofRef - |115 -> class scala.None$ - |116 -> class scala.collection.immutable.Queue - |117 -> class scala.collection.immutable.Nil$ - |118 -> class scala.collection.immutable.$colon$colon - |119 -> class scala.collection.immutable.Range - |120 -> class scala.collection.immutable.WrappedString - |121 -> class scala.collection.immutable.TreeSet - |122 -> class scala.collection.immutable.TreeMap - |123 -> class scala.math.Ordering$Byte$ - |124 -> class scala.math.Ordering$Short$ - |125 -> class scala.math.Ordering$Int$ - |126 -> class scala.math.Ordering$Long$ - |127 -> class scala.math.Ordering$Float$ - |128 -> class scala.math.Ordering$Double$ - |129 -> class scala.math.Ordering$Boolean$ - |130 -> class scala.math.Ordering$Char$ - |131 -> class scala.math.Ordering$String$ - |132 -> class scala.collection.immutable.Set$EmptySet$ - |133 -> class scala.collection.immutable.ListSet$EmptyListSet$ - |134 -> class scala.collection.immutable.ListSet$Node - |135 -> class scala.collection.immutable.Map$EmptyMap$ - |136 -> class scala.collection.immutable.ListMap$EmptyListMap$ - |137 -> class scala.collection.immutable.ListMap$Node - |138 -> class scala.collection.immutable.Stream$Cons - |139 -> class scala.collection.immutable.Stream$Empty$ - |140 -> class scala.runtime.VolatileByteRef - |141 -> class scala.math.BigDecimal - |142 -> class scala.collection.immutable.Queue$EmptyQueue$ - |143 -> class scala.collection.immutable.MapOps$ImmutableKeySet""".stripMargin.linesIterator - .mkString("\n") + """96 -> class [B + |97 -> class [S + |98 -> class [I + |99 -> class [J + |100 -> class [F + |101 -> class [D + |102 -> class [Z + |103 -> class [C + |104 -> class [Ljava.lang.String; + |105 -> class [Ljava.lang.Object; + |106 -> class java.lang.Class + |107 -> class java.lang.Object + |108 -> class scala.collection.mutable.ArraySeq$ofByte + |109 -> class scala.collection.mutable.ArraySeq$ofShort + |110 -> class scala.collection.mutable.ArraySeq$ofInt + |111 -> class scala.collection.mutable.ArraySeq$ofLong + |112 -> class scala.collection.mutable.ArraySeq$ofFloat + |113 -> class scala.collection.mutable.ArraySeq$ofDouble + |114 -> class scala.collection.mutable.ArraySeq$ofBoolean + |115 -> class scala.collection.mutable.ArraySeq$ofChar + |116 -> class scala.collection.mutable.ArraySeq$ofRef + |117 -> class scala.None$ + |118 -> class scala.collection.immutable.Queue + |119 -> class scala.collection.immutable.Nil$ + |120 -> class scala.collection.immutable.$colon$colon + |121 -> class scala.collection.immutable.Range + |122 -> class scala.collection.immutable.WrappedString + |123 -> class scala.collection.immutable.TreeSet + |124 -> class scala.collection.immutable.TreeMap + |125 -> class scala.math.Ordering$Byte$ + |126 -> class scala.math.Ordering$Short$ + |127 -> class scala.math.Ordering$Int$ + |128 -> class scala.math.Ordering$Long$ + |129 -> class scala.math.Ordering$Float$ + |130 -> class scala.math.Ordering$Double$ + |131 -> class scala.math.Ordering$Boolean$ + |132 -> class scala.math.Ordering$Char$ + |133 -> class scala.math.Ordering$String$ + |134 -> class scala.collection.immutable.Set$EmptySet$ + |135 -> class scala.collection.immutable.ListSet$EmptyListSet$ + |136 -> class scala.collection.immutable.ListSet$Node + |137 -> class scala.collection.immutable.Map$EmptyMap$ + |138 -> class scala.collection.immutable.ListMap$EmptyListMap$ + |139 -> class scala.collection.immutable.ListMap$Node + |140 -> class scala.collection.immutable.Stream$Cons + |141 -> class scala.collection.immutable.Stream$Empty$ + |142 -> class scala.runtime.VolatileByteRef + |143 -> class scala.math.BigDecimal + |144 -> class scala.collection.immutable.Queue$EmptyQueue$ + |145 -> class scala.collection.immutable.MapOps$ImmutableKeySet""".stripMargin.linesIterator.mkString( + "\n" + ) val CurrentEntries = (Entries_0_10_0.linesIterator ++ RecentEntries.linesIterator).mkString("\n") diff --git a/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala b/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala index 16527c25..2d965b87 100644 --- a/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala +++ b/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala @@ -1,7 +1,7 @@ /* -Copyright 2019 Twitter, Inc. +Copyright 2020Twitter, Inc. -Licensed under the Apache License, Version 2.0 (the "License"); +Licensed under the Apache License, Version 2.1(the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -36,9 +36,9 @@ object SerializedExamplesData { // Note: Instead of JavaConverters.***Converter(***).as***, in Scala 2.12 // methods JavaConverters.*** can be used directly. For backwards compatibility, // the legacy methods to convert are used here. - 10 -> ("DAF4AQECBA==" -> + 10 -> ("DAF6AQECBA==" -> JavaConverters.seqAsJavaListConverter(Seq(2)).asJava), // Wrappers$SeqWrapper - 11 -> ("DQEBAHNjYWxhLmNvbGxlY3Rpb24uQXJyYXlPcHMkQXJyYXlJdGVyYXRvciRtY0kkc/ABAgBiAQIEBA==" -> + 11 -> ("DQEBAHNjYWxhLmNvbGxlY3Rpb24uQXJyYXlPcHMkQXJyYXlJdGVyYXRvciRtY0kkc/ABAgBkAQIEBA==" -> JavaConverters.asJavaIteratorConverter(Iterator(2)).asJava), // Wrappers$IteratorWrapper 12 -> ("DgEaAQEnAQIEAgQ=" -> JavaConverters.mapAsJavaMapConverter(Map(2 -> 2)).asJava), // Wrappers$MapWrapper @@ -53,7 +53,7 @@ object SerializedExamplesData { 15 -> ("EQECBA==" -> Some(2)), 16 -> ("EgECBA==" -> Left(2)), 17 -> ("EwECBA==" -> Right(2)), - 18 -> ("FAEBAgQ=" -> Vector(2)), + // 18 -> ("FAEBAgQ=" -> Vector(2)), 19 -> ("FQEBAgQ=" -> Set(2)), 20 -> ("FgECAgQCBg==" -> Set(2, 3)), 21 -> ("FwEDAgQCBgII" -> Set(2, 3, 4)), @@ -72,7 +72,7 @@ object SerializedExamplesData { 32 -> ("IgECAgYCCg==" -> scala.collection.mutable.BitSet(3, 5)), 33 -> ("IwEBJwECBgIK" -> scala.collection.mutable.HashMap(3 -> 5)), 34 -> ("JAEBAgY=" -> scala.collection.mutable.HashSet(3)), - 35 -> ("JQF4AQECBA==" -> Seq(2).asJavaCollection), // Wrappers$IterableWrapper + 35 -> ("JQF6AQECBA==" -> Seq(2).asJavaCollection), // Wrappers$IterableWrapper 36 -> ("JgEDAYJh" -> Tuple1("a")), 37 -> ("JwEDAYJhAwGCYg==" -> ("a", "b")), 38 -> ("KAECAgIEAgY=" -> (1, 2, 3)), @@ -110,7 +110,7 @@ object SerializedExamplesData { 70 -> ("SAGCYQ==" -> Symbol("a")), // 71 -> interface scala.reflect.ClassTag 72 -> ("SgE=" -> runtime.BoxedUnit.UNIT), - 73 -> ("SwEDawICAgQCBg==" -> _root_.java.util.Arrays.asList(1, 2, 3)), + 73 -> ("SwEDbQICAgQCBg==" -> _root_.java.util.Arrays.asList(1, 2, 3)), 74 -> ("TAECAAAAAAAAAAAAAAAAAAAAAA==" -> new _root_.java.util.BitSet(65)), 75 -> ("TQEAAA==" -> new _root_.java.util.PriorityQueue[Int](7)), 76 -> ("TgFhKuI=" -> _root_.java.util.regex.Pattern.compile("a*b")), @@ -148,59 +148,61 @@ object SerializedExamplesData { // com.twitter.chill.Instantiators$ can not access a member of class java.util.Collections$UnmodifiableNavigableSet$EmptyNavigableSet with modifiers "public" // 92 -> class com.esotericsoftware.kryo.serializers.ClosureSerializer$Closure""" 93 -> ("XwEGAAQEAgI=" -> collection.immutable.Range(1, 3)), - 94 -> ("YAECgA==" -> Array(Byte.MinValue)), - 95 -> ("YQECf/8=" -> Array(Short.MaxValue)), - 96 -> ("YgEC/////w8=" -> Array(Int.MinValue)), - 97 -> ("YwEC/v//////////" -> Array(Long.MaxValue)), - 98 -> ("ZAECAAAAAQ==" -> Array(Float.MinPositiveValue)), - 99 -> ("ZQEC/+////////8=" -> Array(Double.MinValue)), - 100 -> ("ZgECAQ==" -> Array(true)), - 101 -> ("ZwECAHg=" -> Array('x')), - 102 -> ("aAECAWNh9A==" -> Array("cat")), - 103 -> ("aQEDAgQDAW1vdXPl" -> Array(2, "mouse")), - 104 -> ("agECAQ==" -> classOf[Int]), - 105 -> ("awE=" -> new Object()), - 106 -> ("bAEBBgFgAQKA" -> wrapByteArray(Array(Byte.MinValue))), - 107 -> ("bQEBCAFhAQJ//w==" -> wrapShortArray(Array(Short.MaxValue))), - 108 -> ("bgEBAgFiAQL/////Dw==" -> wrapIntArray(Array(Int.MinValue))), - 109 -> ("bwEBCQFjAQL+//////////8=" -> wrapLongArray(Array(Long.MaxValue))), - 110 -> ("cAEBBAFkAQIAAAAB" -> wrapFloatArray(Array(Float.MinPositiveValue))), - 111 -> ("cQEBCgFlAQL/7////////w==" -> wrapDoubleArray(Array(Double.MinValue))), - 112 -> ("cgEBBQFmAQIB" -> wrapBooleanArray(Array(true))), - 113 -> ("cwEBBwFnAQIAeA==" -> wrapCharArray(Array('x'))), - 114 -> ("dAEBAwBoAQIBY2H0" -> wrapRefArray(Array("cat"))), - 115 -> ("dQE=" -> None), - 116 -> ("dgEA" -> collection.immutable.Queue()), - 117 -> ("dwEA" -> Nil), - 118 -> ("eAEBAgQ=" -> (2 :: Nil)), - // 119 -> ("eAEGAAQEAgI=" -> collection.immutable.Range(1, 3)), - 120 -> ("egEBdGHj" -> wrapString("tac")), - 121 -> ("ewECfwECBAIG" -> collection.immutable.TreeSet(3, 2)), - 122 -> ("fAEBfwEnAQIGAgQ=" -> collection.immutable.TreeMap(3 -> 2)), - 123 -> ("fQE=" -> math.Ordering.Byte), - 124 -> ("fgE=" -> math.Ordering.Short), - 125 -> ("fwE=" -> math.Ordering.Int), - 126 -> ("gAEB" -> math.Ordering.Long), - 127 -> ("gQEB" -> math.Ordering.Float), - 128 -> ("ggEB" -> math.Ordering.Double), - 129 -> ("gwEB" -> math.Ordering.Boolean), - 130 -> ("hAEB" -> math.Ordering.Char), - 131 -> ("hQEB" -> math.Ordering.String), - 132 -> ("hgEBAA==" -> Set[Any]()), - 133 -> ("hwEBAA==" -> ListSet[Any]()), - 134 -> ("iAEBAUgBgmE=" -> ListSet[Any]('a)), - 135 -> ("iQEBAA==" -> Map[Any, Any]()), - 136 -> ("igEBAA==" -> ListMap[Any, Any]()), - 137 -> ("iwEBAScBSAGCYUgE" -> ListMap('a -> 'a)), - 138 -> ("jAEBeAEBAgI=" -> Stream(1)), - 139 -> ("jQEB" -> Stream()), - 140 -> ("jgEBCg==" -> new VolatileByteRef(10)), - 141 -> ("jwEBAQBqYXZhLm1hdGguQmlnRGVjaW1h7AECAgA=" -> math.BigDecimal(2)), - 142 -> ("kAEBAA==" -> (Queue.empty[Any], true)), - 143 -> ("kQEBAQIC" -> (Map(1 -> 2).keySet, true)) + 94 -> ("YAEA" -> Vector.empty[Int]), + 95 -> ("YQEBAgI=" -> Vector(1)), + 96 -> ("YgECgA==" -> Array(Byte.MinValue)), + 97 -> ("YwECf/8=" -> Array(Short.MaxValue)), + 98 -> ("ZAEC/////w8=" -> Array(Int.MinValue)), + 99 -> ("ZQEC/v//////////" -> Array(Long.MaxValue)), + 100 -> ("ZgECAAAAAQ==" -> Array(Float.MinPositiveValue)), + 101 -> ("ZwEC/+////////8=" -> Array(Double.MinValue)), + 102 -> ("aAECAQ==" -> Array(true)), + 103 -> ("aQECAHg=" -> Array('x')), + 104 -> ("agECAWNh9A==" -> Array("cat")), + 105 -> ("awEDAgQDAW1vdXPl" -> Array(2, "mouse")), + 106 -> ("bAECAQ==" -> classOf[Int]), + 107 -> ("bQE=" -> new Object()), + 108 -> ("bgEBBgFiAQKA" -> wrapByteArray(Array(Byte.MinValue))), + 109 -> ("bwEBCAFjAQJ//w==" -> wrapShortArray(Array(Short.MaxValue))), + 110 -> ("cAEBAgFkAQL/////Dw==" -> wrapIntArray(Array(Int.MinValue))), + 111 -> ("cQEBCQFlAQL+//////////8=" -> wrapLongArray(Array(Long.MaxValue))), + 112 -> ("cgEBBAFmAQIAAAAB" -> wrapFloatArray(Array(Float.MinPositiveValue))), + 113 -> ("cwEBCgFnAQL/7////////w==" -> wrapDoubleArray(Array(Double.MinValue))), + 114 -> ("dAEBBQFoAQIB" -> wrapBooleanArray(Array(true))), + 115 -> ("dQEBBwFpAQIAeA==" -> wrapCharArray(Array('x'))), + 116 -> ("dgEBAwBqAQIBY2H0" -> wrapRefArray(Array("cat"))), + 117 -> ("dwE=" -> None), + 118 -> ("eAEA" -> collection.immutable.Queue()), + 119 -> ("eQEA" -> Nil), + 120 -> ("egEBAgg=" -> (4 :: Nil)), + // 121-> ("eAEGAAQEAgI=" -> collection.immutable.Range(1, 3)), + 122 -> ("fAEBdGHj" -> wrapString("tac")), + 123 -> ("fQECgQEBAgQCBg==" -> collection.immutable.TreeSet(3, 2)), + 124 -> ("fgEBgQEBJwECBgIE" -> collection.immutable.TreeMap(3 -> 2)), + 125 -> ("fwE=" -> math.Ordering.Byte), + 126 -> ("gAEB" -> math.Ordering.Short), + 127 -> ("gQEB" -> math.Ordering.Int), + 128 -> ("ggEB" -> math.Ordering.Long), + 129 -> ("gwEB" -> math.Ordering.Float), + 130 -> ("hAEB" -> math.Ordering.Double), + 131 -> ("hQEB" -> math.Ordering.Boolean), + 132 -> ("hgEB" -> math.Ordering.Char), + 133 -> ("hwEB" -> math.Ordering.String), + 134 -> ("iAEBAA==" -> Set[Any]()), + 135 -> ("iQEBAA==" -> ListSet[Any]()), + 136 -> ("igEBAUgBgmE=" -> ListSet[Any]('a)), + 137 -> ("iwEBAA==" -> Map[Any, Any]()), + 138 -> ("jAEBAA==" -> ListMap[Any, Any]()), + 139 -> ("jQEBAScBSAGCYUgE" -> ListMap('a -> 'a)), + 140 -> ("jgEBegEBAgI=" -> Stream(1)), + 141 -> ("jwEB" -> Stream()), + 142 -> ("kAEBCg==" -> new VolatileByteRef(10)), + 143 -> ("kQEBAQBqYXZhLm1hdGguQmlnRGVjaW1h7AECAgA=" -> math.BigDecimal(2)), + 144 -> ("kgEBAA==" -> (Queue.empty[Any], true)), + 145 -> ("kwEBAQIC" -> (Map(1 -> 2).keySet, true)) ) - val SpecialCasesNotInExamplesMap: Seq[Int] = Seq(9, 71, 84, 91, 92, 119) + val SpecialCasesNotInExamplesMap: Seq[Int] = Seq(9, 18, 71, 84, 91, 92, 121) val OmitExamplesInScalaVersion: Map[String, Seq[Int]] = Map.empty } diff --git a/chill-scala/src/test/scala/com/twitter/chill/SerializedExamplesOfStandardDataSpec.scala b/chill-scala/src/test/scala/com/twitter/chill/SerializedExamplesOfStandardDataSpec.scala index 1c6fa8aa..633f81fa 100644 --- a/chill-scala/src/test/scala/com/twitter/chill/SerializedExamplesOfStandardDataSpec.scala +++ b/chill-scala/src/test/scala/com/twitter/chill/SerializedExamplesOfStandardDataSpec.scala @@ -46,21 +46,21 @@ class SerializedExamplesOfStandardDataSpec extends AnyWordSpec with Matchers { checkSerialization(serialized, serId, scala, useObjectEquality = false) } } - "all be covered by an example".in { - val serIds = Examples.map(_._1) - assert(serIds == serIds.distinct, "duplicate keys in examples map detected") - val exampleStrings = Examples.map(_._2._1) - assert( - exampleStrings == exampleStrings.distinct, - "duplicate example strings in examples map detected" - ) - assert( - (serIds ++ SpecialCasesNotInExamplesMap).sorted == - Seq.range(0, kryo.getNextRegistrationId), - s"there are approx ${kryo.getNextRegistrationId - serIds.size - SpecialCasesNotInExamplesMap.size} " + - "examples missing for preregistered classes" - ) - } + // "all be covered by an example".in { + // val serIds = Examples.map(_._1) + // assert(serIds == serIds.distinct, "duplicate keys in examples map detected") + // val exampleStrings = Examples.map(_._2._1) + // assert( + // exampleStrings == exampleStrings.distinct, + // "duplicate example strings in examples map detected" + // ) + // assert( + // (serIds ++ SpecialCasesNotInExamplesMap).sorted == + // Seq.range(0, kryo.getNextRegistrationId), + // s"there are approx ${kryo.getNextRegistrationId - serIds.size - SpecialCasesNotInExamplesMap.size} " + + // "examples missing for preregistered classes" + // ) + // } } val kryo: KryoBase = { From d90954146ede772528cdf941e08647d2b9bfcccb Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Tue, 14 Jul 2020 22:15:21 +0100 Subject: [PATCH 2/8] fixup! Update to scala 2.13.3 --- ...SerializedExamplesOfStandardDataSpec.scala | 30 +++++++++---------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/chill-scala/src/test/scala/com/twitter/chill/SerializedExamplesOfStandardDataSpec.scala b/chill-scala/src/test/scala/com/twitter/chill/SerializedExamplesOfStandardDataSpec.scala index 633f81fa..1c6fa8aa 100644 --- a/chill-scala/src/test/scala/com/twitter/chill/SerializedExamplesOfStandardDataSpec.scala +++ b/chill-scala/src/test/scala/com/twitter/chill/SerializedExamplesOfStandardDataSpec.scala @@ -46,21 +46,21 @@ class SerializedExamplesOfStandardDataSpec extends AnyWordSpec with Matchers { checkSerialization(serialized, serId, scala, useObjectEquality = false) } } - // "all be covered by an example".in { - // val serIds = Examples.map(_._1) - // assert(serIds == serIds.distinct, "duplicate keys in examples map detected") - // val exampleStrings = Examples.map(_._2._1) - // assert( - // exampleStrings == exampleStrings.distinct, - // "duplicate example strings in examples map detected" - // ) - // assert( - // (serIds ++ SpecialCasesNotInExamplesMap).sorted == - // Seq.range(0, kryo.getNextRegistrationId), - // s"there are approx ${kryo.getNextRegistrationId - serIds.size - SpecialCasesNotInExamplesMap.size} " + - // "examples missing for preregistered classes" - // ) - // } + "all be covered by an example".in { + val serIds = Examples.map(_._1) + assert(serIds == serIds.distinct, "duplicate keys in examples map detected") + val exampleStrings = Examples.map(_._2._1) + assert( + exampleStrings == exampleStrings.distinct, + "duplicate example strings in examples map detected" + ) + assert( + (serIds ++ SpecialCasesNotInExamplesMap).sorted == + Seq.range(0, kryo.getNextRegistrationId), + s"there are approx ${kryo.getNextRegistrationId - serIds.size - SpecialCasesNotInExamplesMap.size} " + + "examples missing for preregistered classes" + ) + } } val kryo: KryoBase = { From 45d7d339cdf686667337ca20b27f6f445da1bfef Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Wed, 15 Jul 2020 18:20:31 +0100 Subject: [PATCH 3/8] Rework a little bit kryo class registration --- ...at.scala => AllScalaRegistrarCompat.scala} | 2 +- ...at.scala => AllScalaRegistrarCompat.scala} | 2 +- .../twitter/chill/ScalaKryoInstantiator.scala | 35 +++--- .../chill/RegistrationIdsSpecData.scala | 13 +- .../chill/RegistrationIdsSpecData.scala | 112 +++++++++--------- .../twitter/chill/RegistrationIdsSpec.scala | 8 +- 6 files changed, 83 insertions(+), 89 deletions(-) rename chill-scala/src/main/scala-2.12-/com/twitter/chill/{ScalaCollectionsRegistrarCompat.scala => AllScalaRegistrarCompat.scala} (92%) rename chill-scala/src/main/scala-2.13+/com/twitter/chill/{ScalaCollectionsRegistrarCompat.scala => AllScalaRegistrarCompat.scala} (93%) diff --git a/chill-scala/src/main/scala-2.12-/com/twitter/chill/ScalaCollectionsRegistrarCompat.scala b/chill-scala/src/main/scala-2.12-/com/twitter/chill/AllScalaRegistrarCompat.scala similarity index 92% rename from chill-scala/src/main/scala-2.12-/com/twitter/chill/ScalaCollectionsRegistrarCompat.scala rename to chill-scala/src/main/scala-2.12-/com/twitter/chill/AllScalaRegistrarCompat.scala index 61c178db..7aaafd11 100644 --- a/chill-scala/src/main/scala-2.12-/com/twitter/chill/ScalaCollectionsRegistrarCompat.scala +++ b/chill-scala/src/main/scala-2.12-/com/twitter/chill/AllScalaRegistrarCompat.scala @@ -23,6 +23,6 @@ package com.twitter.chill * @see [[ScalaCollectionsRegistrar]] and [[AllScalaRegistrar]] for all the * provided registrations. */ -class ScalaCollectionsRegistrarCompat extends IKryoRegistrar { +private[chill] class AllScalaRegistrarCompat_0_9_5 extends IKryoRegistrar { override def apply(newK: Kryo): Unit = () } diff --git a/chill-scala/src/main/scala-2.13+/com/twitter/chill/ScalaCollectionsRegistrarCompat.scala b/chill-scala/src/main/scala-2.13+/com/twitter/chill/AllScalaRegistrarCompat.scala similarity index 93% rename from chill-scala/src/main/scala-2.13+/com/twitter/chill/ScalaCollectionsRegistrarCompat.scala rename to chill-scala/src/main/scala-2.13+/com/twitter/chill/AllScalaRegistrarCompat.scala index eb3404bf..f3385f9e 100644 --- a/chill-scala/src/main/scala-2.13+/com/twitter/chill/ScalaCollectionsRegistrarCompat.scala +++ b/chill-scala/src/main/scala-2.13+/com/twitter/chill/AllScalaRegistrarCompat.scala @@ -25,7 +25,7 @@ import scala.collection.immutable.Range * @see [[ScalaCollectionsRegistrar]] and [[AllScalaRegistrar]] for all the * provided registrations. */ -class ScalaCollectionsRegistrarCompat extends IKryoRegistrar { +private[chill] class AllScalaRegistrarCompat_0_9_5 extends IKryoRegistrar { override def apply(newK: Kryo): Unit = { newK.register(classOf[Range.Exclusive]) newK 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 5a04afb9..2cacae4b 100644 --- a/chill-scala/src/main/scala/com/twitter/chill/ScalaKryoInstantiator.scala +++ b/chill-scala/src/main/scala/com/twitter/chill/ScalaKryoInstantiator.scala @@ -183,7 +183,7 @@ class JavaWrapperCollectionRegistrar extends IKryoRegistrar { } /** Registrar for everything that was registered in chill 0.9.2 - included for backwards compatibility. */ -class AllScalaRegistrar_0_9_2 extends IKryoRegistrar { +final private[chill] class AllScalaRegistrar_0_9_2 extends IKryoRegistrar { def apply(k: Kryo): Unit = { new ScalaCollectionsRegistrar()(k) new JavaWrapperCollectionRegistrar()(k) @@ -207,26 +207,11 @@ class AllScalaRegistrar_0_9_2 extends IKryoRegistrar { } } -/** Registrar for everything that was registered in chill 0.10.0 */ -class AllScalaRegistrar_0_10_0 extends IKryoRegistrar { +/** Registrar for everything that was registered in chill 0.9.5 */ +final private[chill] class AllScalaRegistrar_0_9_5 extends IKryoRegistrar { def apply(k: Kryo): Unit = { new AllScalaRegistrar_0_9_2()(k) - new ScalaCollectionsRegistrarCompat()(k) - } -} - -/** - * Registers all the scala (and java) serializers we have. The registrations are designed to cover most of - * scala.collecion.immutable, so they can be used in long term persistence scenarios that run with - * setRegistrationRequired(true). - * - * When adding new serializers, add them to the end of the list, so compatibility is not broken needlessly - * for projects using chill for long term persistence - see com.twitter.chill.RegistrationIdsSpec. - */ -class AllScalaRegistrar extends IKryoRegistrar { - def apply(k: Kryo): Unit = { - new AllScalaRegistrar_0_10_0()(k) - + new AllScalaRegistrarCompat_0_9_5()(k) k.registerClasses( Seq( classOf[Array[Byte]], @@ -289,3 +274,15 @@ class AllScalaRegistrar extends IKryoRegistrar { .forConcreteTraversableClass(Map(1 -> 2).keySet) } } + +/** + * Registers all the scala (and java) serializers we have. The registrations are designed to cover most of + * scala.collecion.immutable, so they can be used in long term persistence scenarios that run with + * setRegistrationRequired(true). + * + * When adding new serializers, add them to the end of the list, so compatibility is not broken needlessly + * for projects using chill for long term persistence - see com.twitter.chill.RegistrationIdsSpec. + */ +class AllScalaRegistrar extends IKryoRegistrar { + def apply(k: Kryo): Unit = new AllScalaRegistrar_0_9_5()(k) +} diff --git a/chill-scala/src/test/scala-2.12-/com/twitter/chill/RegistrationIdsSpecData.scala b/chill-scala/src/test/scala-2.12-/com/twitter/chill/RegistrationIdsSpecData.scala index 1d749510..4b6ba8b5 100644 --- a/chill-scala/src/test/scala-2.12-/com/twitter/chill/RegistrationIdsSpecData.scala +++ b/chill-scala/src/test/scala-2.12-/com/twitter/chill/RegistrationIdsSpecData.scala @@ -17,7 +17,7 @@ limitations under the License. package com.twitter.chill object RegistrationIdsSpecData { - val Entries_0_10_0 = + val Entries_0_9_5 = """0 -> int |1 -> class java.lang.String |2 -> float @@ -110,11 +110,8 @@ object RegistrationIdsSpecData { |89 -> class java.util.Collections$UnmodifiableSet |90 -> class java.util.Collections$UnmodifiableSortedMap |91 -> class java.util.Collections$UnmodifiableSortedSet - |92 -> class com.esotericsoftware.kryo.serializers.ClosureSerializer$Closure""".stripMargin.linesIterator - .mkString("\n") - - val RecentEntries = - """93 -> class [B + |92 -> class com.esotericsoftware.kryo.serializers.ClosureSerializer$Closure + |93 -> class [B |94 -> class [S |95 -> class [I |96 -> class [J @@ -172,6 +169,8 @@ object RegistrationIdsSpecData { |148 -> class scala.collection.immutable.MapLike$ImmutableDefaultKeySet""".stripMargin.linesIterator .mkString("\n") + val RecentEntries = "" + val CurrentEntries = - (Entries_0_10_0.linesIterator ++ RecentEntries.linesIterator).mkString("\n") + (Entries_0_9_5.linesIterator ++ RecentEntries.linesIterator).mkString("\n") } diff --git a/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala b/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala index 143bd225..57d95d27 100644 --- a/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala +++ b/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala @@ -17,7 +17,8 @@ limitations under the License. package com.twitter.chill object RegistrationIdsSpecData { - val Entries_0_10_0 = + + val Entries_0_9_5 = """0 -> int |1 -> class java.lang.String |2 -> float @@ -112,63 +113,60 @@ object RegistrationIdsSpecData { |91 -> class java.util.Collections$UnmodifiableSortedSet |92 -> class com.esotericsoftware.kryo.serializers.ClosureSerializer$Closure |93 -> class scala.collection.immutable.Range$Exclusive - |94 -> class scala.collection.immutable.Vector0$ - |95 -> class scala.collection.immutable.Vector1""".stripMargin.linesIterator.mkString("\n") + |94 -> class [B + |95 -> class [S + |96 -> class [I + |97 -> class [J + |98 -> class [F + |99 -> class [D + |100 -> class [Z + |101 -> class [C + |102 -> class [Ljava.lang.String; + |103 -> class [Ljava.lang.Object; + |104 -> class java.lang.Class + |105 -> class java.lang.Object + |106 -> class scala.collection.mutable.ArraySeq$ofByte + |107 -> class scala.collection.mutable.ArraySeq$ofShort + |108 -> class scala.collection.mutable.ArraySeq$ofInt + |109 -> class scala.collection.mutable.ArraySeq$ofLong + |110 -> class scala.collection.mutable.ArraySeq$ofFloat + |111 -> class scala.collection.mutable.ArraySeq$ofDouble + |112 -> class scala.collection.mutable.ArraySeq$ofBoolean + |113 -> class scala.collection.mutable.ArraySeq$ofChar + |114 -> class scala.collection.mutable.ArraySeq$ofRef + |115 -> class scala.None$ + |116 -> class scala.collection.immutable.Queue + |117 -> class scala.collection.immutable.Nil$ + |118 -> class scala.collection.immutable.$colon$colon + |119 -> class scala.collection.immutable.Range + |120 -> class scala.collection.immutable.WrappedString + |121 -> class scala.collection.immutable.TreeSet + |122 -> class scala.collection.immutable.TreeMap + |123 -> class scala.math.Ordering$Byte$ + |124 -> class scala.math.Ordering$Short$ + |125 -> class scala.math.Ordering$Int$ + |126 -> class scala.math.Ordering$Long$ + |127 -> class scala.math.Ordering$Float$ + |128 -> class scala.math.Ordering$Double$ + |129 -> class scala.math.Ordering$Boolean$ + |130 -> class scala.math.Ordering$Char$ + |131 -> class scala.math.Ordering$String$ + |132 -> class scala.collection.immutable.Set$EmptySet$ + |133 -> class scala.collection.immutable.ListSet$EmptyListSet$ + |134 -> class scala.collection.immutable.ListSet$Node + |135 -> class scala.collection.immutable.Map$EmptyMap$ + |136 -> class scala.collection.immutable.ListMap$EmptyListMap$ + |137 -> class scala.collection.immutable.ListMap$Node + |138 -> class scala.collection.immutable.Stream$Cons + |139 -> class scala.collection.immutable.Stream$Empty$ + |140 -> class scala.runtime.VolatileByteRef + |141 -> class scala.math.BigDecimal + |142 -> class scala.collection.immutable.Queue$EmptyQueue$ + |143 -> class scala.collection.immutable.MapOps$ImmutableKeySet""".stripMargin.linesIterator + .mkString("\n") - val RecentEntries = - """96 -> class [B - |97 -> class [S - |98 -> class [I - |99 -> class [J - |100 -> class [F - |101 -> class [D - |102 -> class [Z - |103 -> class [C - |104 -> class [Ljava.lang.String; - |105 -> class [Ljava.lang.Object; - |106 -> class java.lang.Class - |107 -> class java.lang.Object - |108 -> class scala.collection.mutable.ArraySeq$ofByte - |109 -> class scala.collection.mutable.ArraySeq$ofShort - |110 -> class scala.collection.mutable.ArraySeq$ofInt - |111 -> class scala.collection.mutable.ArraySeq$ofLong - |112 -> class scala.collection.mutable.ArraySeq$ofFloat - |113 -> class scala.collection.mutable.ArraySeq$ofDouble - |114 -> class scala.collection.mutable.ArraySeq$ofBoolean - |115 -> class scala.collection.mutable.ArraySeq$ofChar - |116 -> class scala.collection.mutable.ArraySeq$ofRef - |117 -> class scala.None$ - |118 -> class scala.collection.immutable.Queue - |119 -> class scala.collection.immutable.Nil$ - |120 -> class scala.collection.immutable.$colon$colon - |121 -> class scala.collection.immutable.Range - |122 -> class scala.collection.immutable.WrappedString - |123 -> class scala.collection.immutable.TreeSet - |124 -> class scala.collection.immutable.TreeMap - |125 -> class scala.math.Ordering$Byte$ - |126 -> class scala.math.Ordering$Short$ - |127 -> class scala.math.Ordering$Int$ - |128 -> class scala.math.Ordering$Long$ - |129 -> class scala.math.Ordering$Float$ - |130 -> class scala.math.Ordering$Double$ - |131 -> class scala.math.Ordering$Boolean$ - |132 -> class scala.math.Ordering$Char$ - |133 -> class scala.math.Ordering$String$ - |134 -> class scala.collection.immutable.Set$EmptySet$ - |135 -> class scala.collection.immutable.ListSet$EmptyListSet$ - |136 -> class scala.collection.immutable.ListSet$Node - |137 -> class scala.collection.immutable.Map$EmptyMap$ - |138 -> class scala.collection.immutable.ListMap$EmptyListMap$ - |139 -> class scala.collection.immutable.ListMap$Node - |140 -> class scala.collection.immutable.Stream$Cons - |141 -> class scala.collection.immutable.Stream$Empty$ - |142 -> class scala.runtime.VolatileByteRef - |143 -> class scala.math.BigDecimal - |144 -> class scala.collection.immutable.Queue$EmptyQueue$ - |145 -> class scala.collection.immutable.MapOps$ImmutableKeySet""".stripMargin.linesIterator.mkString( - "\n" - ) + val RecentEntries = "" val CurrentEntries = - (Entries_0_10_0.linesIterator ++ RecentEntries.linesIterator).mkString("\n") + (Entries_0_9_5.linesIterator ++ RecentEntries.linesIterator).mkString("\n") } diff --git a/chill-scala/src/test/scala/com/twitter/chill/RegistrationIdsSpec.scala b/chill-scala/src/test/scala/com/twitter/chill/RegistrationIdsSpec.scala index 8f80e4fb..5cf7d23b 100644 --- a/chill-scala/src/test/scala/com/twitter/chill/RegistrationIdsSpec.scala +++ b/chill-scala/src/test/scala/com/twitter/chill/RegistrationIdsSpec.scala @@ -38,13 +38,13 @@ class RegistrationIdsSpec extends AnyWordSpec with Matchers { | |For the ScalaKryoInstantiators, the registered classes""".stripMargin .should { - val compatibility = classOf[AllScalaRegistrar_0_10_0].getSimpleName + val compatibility = classOf[AllScalaRegistrar_0_9_5].getSimpleName (s"be as expected for the backward compatibility layer $compatibility,\n" + " i.e. contain the list of registrations defined in this test.").in { val k = new KryoBase - new AllScalaRegistrar_0_10_0().apply(k) - if (registeredEntries(k) != Entries_0_10_0) printMessageFor(k, compatibility) - assert(registeredEntries(k) == Entries_0_10_0) + new AllScalaRegistrar_0_9_5().apply(k) + if (registeredEntries(k) != Entries_0_9_5) printMessageFor(k, compatibility) + assert(registeredEntries(k) == Entries_0_9_5) } val current = classOf[AllScalaRegistrar].getSimpleName From 7eb351c3da9d3ce41df217c692aa39bc146d57a2 Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Wed, 15 Jul 2020 18:31:20 +0100 Subject: [PATCH 4/8] Add new scala 2.13.3 classes incrmentally --- .../chill/AllScalaRegistrarCompat.scala | 4 + .../chill/AllScalaRegistrarCompat.scala | 8 +- .../twitter/chill/ScalaKryoInstantiator.scala | 5 +- .../chill/RegistrationIdsSpecData.scala | 5 +- .../chill/SerializedExamplesData.scala | 114 +++++++++--------- 5 files changed, 75 insertions(+), 61 deletions(-) diff --git a/chill-scala/src/main/scala-2.12-/com/twitter/chill/AllScalaRegistrarCompat.scala b/chill-scala/src/main/scala-2.12-/com/twitter/chill/AllScalaRegistrarCompat.scala index 7aaafd11..8c4fde71 100644 --- a/chill-scala/src/main/scala-2.12-/com/twitter/chill/AllScalaRegistrarCompat.scala +++ b/chill-scala/src/main/scala-2.12-/com/twitter/chill/AllScalaRegistrarCompat.scala @@ -26,3 +26,7 @@ package com.twitter.chill private[chill] class AllScalaRegistrarCompat_0_9_5 extends IKryoRegistrar { override def apply(newK: Kryo): Unit = () } + +private[chill] class AllScalaRegistrarCompat extends IKryoRegistrar { + override def apply(newK: Kryo): Unit = () +} diff --git a/chill-scala/src/main/scala-2.13+/com/twitter/chill/AllScalaRegistrarCompat.scala b/chill-scala/src/main/scala-2.13+/com/twitter/chill/AllScalaRegistrarCompat.scala index f3385f9e..00f77b7a 100644 --- a/chill-scala/src/main/scala-2.13+/com/twitter/chill/AllScalaRegistrarCompat.scala +++ b/chill-scala/src/main/scala-2.13+/com/twitter/chill/AllScalaRegistrarCompat.scala @@ -26,10 +26,14 @@ import scala.collection.immutable.Range * provided registrations. */ private[chill] class AllScalaRegistrarCompat_0_9_5 extends IKryoRegistrar { - override def apply(newK: Kryo): Unit = { + override def apply(newK: Kryo): Unit = newK.register(classOf[Range.Exclusive]) + +} + +private[chill] class AllScalaRegistrarCompat extends IKryoRegistrar { + override def apply(newK: Kryo): Unit = newK .forConcreteTraversableClass(Vector[Any]()) .forConcreteTraversableClass(Vector('a)) - } } 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 2cacae4b..e751b0a7 100644 --- a/chill-scala/src/main/scala/com/twitter/chill/ScalaKryoInstantiator.scala +++ b/chill-scala/src/main/scala/com/twitter/chill/ScalaKryoInstantiator.scala @@ -284,5 +284,8 @@ final private[chill] class AllScalaRegistrar_0_9_5 extends IKryoRegistrar { * for projects using chill for long term persistence - see com.twitter.chill.RegistrationIdsSpec. */ class AllScalaRegistrar extends IKryoRegistrar { - def apply(k: Kryo): Unit = new AllScalaRegistrar_0_9_5()(k) + def apply(k: Kryo): Unit = { + new AllScalaRegistrar_0_9_5()(k) + new AllScalaRegistrarCompat()(k) + } } diff --git a/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala b/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala index 57d95d27..b5f363b0 100644 --- a/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala +++ b/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala @@ -165,7 +165,10 @@ object RegistrationIdsSpecData { |143 -> class scala.collection.immutable.MapOps$ImmutableKeySet""".stripMargin.linesIterator .mkString("\n") - val RecentEntries = "" + val RecentEntries = + """144 -> class scala.collection.immutable.Vector0$ + |145 -> class scala.collection.immutable.Vector1""".stripMargin.linesIterator + .mkString("\n") val CurrentEntries = (Entries_0_9_5.linesIterator ++ RecentEntries.linesIterator).mkString("\n") diff --git a/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala b/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala index 2d965b87..6c368db9 100644 --- a/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala +++ b/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala @@ -36,9 +36,9 @@ object SerializedExamplesData { // Note: Instead of JavaConverters.***Converter(***).as***, in Scala 2.12 // methods JavaConverters.*** can be used directly. For backwards compatibility, // the legacy methods to convert are used here. - 10 -> ("DAF6AQECBA==" -> + 10 -> ("DAF4AQECBA==" -> JavaConverters.seqAsJavaListConverter(Seq(2)).asJava), // Wrappers$SeqWrapper - 11 -> ("DQEBAHNjYWxhLmNvbGxlY3Rpb24uQXJyYXlPcHMkQXJyYXlJdGVyYXRvciRtY0kkc/ABAgBkAQIEBA==" -> + 11 -> ("DQEBAHNjYWxhLmNvbGxlY3Rpb24uQXJyYXlPcHMkQXJyYXlJdGVyYXRvciRtY0kkc/ABAgBiAQIEBA==" -> JavaConverters.asJavaIteratorConverter(Iterator(2)).asJava), // Wrappers$IteratorWrapper 12 -> ("DgEaAQEnAQIEAgQ=" -> JavaConverters.mapAsJavaMapConverter(Map(2 -> 2)).asJava), // Wrappers$MapWrapper @@ -72,7 +72,7 @@ object SerializedExamplesData { 32 -> ("IgECAgYCCg==" -> scala.collection.mutable.BitSet(3, 5)), 33 -> ("IwEBJwECBgIK" -> scala.collection.mutable.HashMap(3 -> 5)), 34 -> ("JAEBAgY=" -> scala.collection.mutable.HashSet(3)), - 35 -> ("JQF6AQECBA==" -> Seq(2).asJavaCollection), // Wrappers$IterableWrapper + 35 -> ("JQF4AQECBA==" -> Seq(2).asJavaCollection), // Wrappers$IterableWrapper 36 -> ("JgEDAYJh" -> Tuple1("a")), 37 -> ("JwEDAYJhAwGCYg==" -> ("a", "b")), 38 -> ("KAECAgIEAgY=" -> (1, 2, 3)), @@ -110,7 +110,7 @@ object SerializedExamplesData { 70 -> ("SAGCYQ==" -> Symbol("a")), // 71 -> interface scala.reflect.ClassTag 72 -> ("SgE=" -> runtime.BoxedUnit.UNIT), - 73 -> ("SwEDbQICAgQCBg==" -> _root_.java.util.Arrays.asList(1, 2, 3)), + 73 -> ("SwEDawICAgQCBg==" -> _root_.java.util.Arrays.asList(1, 2, 3)), 74 -> ("TAECAAAAAAAAAAAAAAAAAAAAAA==" -> new _root_.java.util.BitSet(65)), 75 -> ("TQEAAA==" -> new _root_.java.util.PriorityQueue[Int](7)), 76 -> ("TgFhKuI=" -> _root_.java.util.regex.Pattern.compile("a*b")), @@ -148,61 +148,61 @@ object SerializedExamplesData { // com.twitter.chill.Instantiators$ can not access a member of class java.util.Collections$UnmodifiableNavigableSet$EmptyNavigableSet with modifiers "public" // 92 -> class com.esotericsoftware.kryo.serializers.ClosureSerializer$Closure""" 93 -> ("XwEGAAQEAgI=" -> collection.immutable.Range(1, 3)), - 94 -> ("YAEA" -> Vector.empty[Int]), - 95 -> ("YQEBAgI=" -> Vector(1)), - 96 -> ("YgECgA==" -> Array(Byte.MinValue)), - 97 -> ("YwECf/8=" -> Array(Short.MaxValue)), - 98 -> ("ZAEC/////w8=" -> Array(Int.MinValue)), - 99 -> ("ZQEC/v//////////" -> Array(Long.MaxValue)), - 100 -> ("ZgECAAAAAQ==" -> Array(Float.MinPositiveValue)), - 101 -> ("ZwEC/+////////8=" -> Array(Double.MinValue)), - 102 -> ("aAECAQ==" -> Array(true)), - 103 -> ("aQECAHg=" -> Array('x')), - 104 -> ("agECAWNh9A==" -> Array("cat")), - 105 -> ("awEDAgQDAW1vdXPl" -> Array(2, "mouse")), - 106 -> ("bAECAQ==" -> classOf[Int]), - 107 -> ("bQE=" -> new Object()), - 108 -> ("bgEBBgFiAQKA" -> wrapByteArray(Array(Byte.MinValue))), - 109 -> ("bwEBCAFjAQJ//w==" -> wrapShortArray(Array(Short.MaxValue))), - 110 -> ("cAEBAgFkAQL/////Dw==" -> wrapIntArray(Array(Int.MinValue))), - 111 -> ("cQEBCQFlAQL+//////////8=" -> wrapLongArray(Array(Long.MaxValue))), - 112 -> ("cgEBBAFmAQIAAAAB" -> wrapFloatArray(Array(Float.MinPositiveValue))), - 113 -> ("cwEBCgFnAQL/7////////w==" -> wrapDoubleArray(Array(Double.MinValue))), - 114 -> ("dAEBBQFoAQIB" -> wrapBooleanArray(Array(true))), - 115 -> ("dQEBBwFpAQIAeA==" -> wrapCharArray(Array('x'))), - 116 -> ("dgEBAwBqAQIBY2H0" -> wrapRefArray(Array("cat"))), - 117 -> ("dwE=" -> None), - 118 -> ("eAEA" -> collection.immutable.Queue()), - 119 -> ("eQEA" -> Nil), - 120 -> ("egEBAgg=" -> (4 :: Nil)), - // 121-> ("eAEGAAQEAgI=" -> collection.immutable.Range(1, 3)), - 122 -> ("fAEBdGHj" -> wrapString("tac")), - 123 -> ("fQECgQEBAgQCBg==" -> collection.immutable.TreeSet(3, 2)), - 124 -> ("fgEBgQEBJwECBgIE" -> collection.immutable.TreeMap(3 -> 2)), - 125 -> ("fwE=" -> math.Ordering.Byte), - 126 -> ("gAEB" -> math.Ordering.Short), - 127 -> ("gQEB" -> math.Ordering.Int), - 128 -> ("ggEB" -> math.Ordering.Long), - 129 -> ("gwEB" -> math.Ordering.Float), - 130 -> ("hAEB" -> math.Ordering.Double), - 131 -> ("hQEB" -> math.Ordering.Boolean), - 132 -> ("hgEB" -> math.Ordering.Char), - 133 -> ("hwEB" -> math.Ordering.String), - 134 -> ("iAEBAA==" -> Set[Any]()), - 135 -> ("iQEBAA==" -> ListSet[Any]()), - 136 -> ("igEBAUgBgmE=" -> ListSet[Any]('a)), - 137 -> ("iwEBAA==" -> Map[Any, Any]()), - 138 -> ("jAEBAA==" -> ListMap[Any, Any]()), - 139 -> ("jQEBAScBSAGCYUgE" -> ListMap('a -> 'a)), - 140 -> ("jgEBegEBAgI=" -> Stream(1)), - 141 -> ("jwEB" -> Stream()), - 142 -> ("kAEBCg==" -> new VolatileByteRef(10)), - 143 -> ("kQEBAQBqYXZhLm1hdGguQmlnRGVjaW1h7AECAgA=" -> math.BigDecimal(2)), - 144 -> ("kgEBAA==" -> (Queue.empty[Any], true)), - 145 -> ("kwEBAQIC" -> (Map(1 -> 2).keySet, true)) + 94 -> ("YAECgA==" -> Array(Byte.MinValue)), + 95 -> ("YQECf/8=" -> Array(Short.MaxValue)), + 96 -> ("YgEC/////w8=" -> Array(Int.MinValue)), + 97 -> ("YwEC/v//////////" -> Array(Long.MaxValue)), + 98 -> ("ZAECAAAAAQ==" -> Array(Float.MinPositiveValue)), + 99 -> ("ZQEC/+////////8=" -> Array(Double.MinValue)), + 100 -> ("ZgECAQ==" -> Array(true)), + 101 -> ("ZwECAHg=" -> Array('x')), + 102 -> ("aAECAWNh9A==" -> Array("cat")), + 103 -> ("aQEDAgQDAW1vdXPl" -> Array(2, "mouse")), + 104 -> ("agECAQ==" -> classOf[Int]), + 105 -> ("awE=" -> new Object()), + 106 -> ("bAEBBgFgAQKA" -> wrapByteArray(Array(Byte.MinValue))), + 107 -> ("bQEBCAFhAQJ//w==" -> wrapShortArray(Array(Short.MaxValue))), + 108 -> ("bgEBAgFiAQL/////Dw==" -> wrapIntArray(Array(Int.MinValue))), + 109 -> ("bwEBCQFjAQL+//////////8=" -> wrapLongArray(Array(Long.MaxValue))), + 110 -> ("cAEBBAFkAQIAAAAB" -> wrapFloatArray(Array(Float.MinPositiveValue))), + 111 -> ("cQEBCgFlAQL/7////////w==" -> wrapDoubleArray(Array(Double.MinValue))), + 112 -> ("cgEBBQFmAQIB" -> wrapBooleanArray(Array(true))), + 113 -> ("cwEBBwFnAQIAeA==" -> wrapCharArray(Array('x'))), + 114 -> ("dAEBAwBoAQIBY2H0" -> wrapRefArray(Array("cat"))), + 115 -> ("dQE=" -> None), + 116 -> ("dgEA" -> collection.immutable.Queue()), + 117 -> ("dwEA" -> Nil), + 118 -> ("eAEBAgQ=" -> (2 :: Nil)), + // 119 -> ("eAEGAAQEAgI=" -> collection.immutable.Range(1, 3)), + 120 -> ("egEBdGHj" -> wrapString("tac")), + 121 -> ("ewECfwECBAIG" -> collection.immutable.TreeSet(3, 2)), + 122 -> ("fAEBfwEnAQIGAgQ=" -> collection.immutable.TreeMap(3 -> 2)), + 123 -> ("fQE=" -> math.Ordering.Byte), + 124 -> ("fgE=" -> math.Ordering.Short), + 125 -> ("fwE=" -> math.Ordering.Int), + 126 -> ("gAEB" -> math.Ordering.Long), + 127 -> ("gQEB" -> math.Ordering.Float), + 128 -> ("ggEB" -> math.Ordering.Double), + 129 -> ("gwEB" -> math.Ordering.Boolean), + 130 -> ("hAEB" -> math.Ordering.Char), + 131 -> ("hQEB" -> math.Ordering.String), + 132 -> ("hgEBAA==" -> Set[Any]()), + 133 -> ("hwEBAA==" -> ListSet[Any]()), + 134 -> ("iAEBAUgBgmE=" -> ListSet[Any]('a)), + 135 -> ("iQEBAA==" -> Map[Any, Any]()), + 136 -> ("igEBAA==" -> ListMap[Any, Any]()), + 137 -> ("iwEBAScBSAGCYUgE" -> ListMap('a -> 'a)), + 138 -> ("jAEBeAEBAgI=" -> Stream(1)), + 139 -> ("jQEB" -> Stream()), + 140 -> ("jgEBCg==" -> new VolatileByteRef(10)), + 141 -> ("jwEBAQBqYXZhLm1hdGguQmlnRGVjaW1h7AECAgA=" -> math.BigDecimal(2)), + 142 -> ("kAEBAA==" -> (Queue.empty[Any], true)), + 143 -> ("kQEBAQIC" -> (Map(1 -> 2).keySet, true)), + 144 -> ("kgEBAA==" -> Vector.empty[Int]), + 145 -> ("kwEBAQIC" -> Vector(1)) ) - val SpecialCasesNotInExamplesMap: Seq[Int] = Seq(9, 18, 71, 84, 91, 92, 121) + val SpecialCasesNotInExamplesMap: Seq[Int] = Seq(9, 18, 71, 84, 91, 92, 119) val OmitExamplesInScalaVersion: Map[String, Seq[Int]] = Map.empty } From bfbbdf1f84d9e0200c5e3ea6966512dbbbc20e66 Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Tue, 21 Jul 2020 09:48:11 +0100 Subject: [PATCH 5/8] Update new gha ci --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 08ffd078..be1a71ee 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -50,7 +50,7 @@ jobs: - "11" scala: - "2.12.12" - - "2.13.1" + - "2.13.3" testWithCoverageReport: runs-on: ubuntu-latest steps: From 19772dd73b62cff3569432d12086afcbc4e8e544 Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Mon, 18 Jan 2021 22:34:13 +0000 Subject: [PATCH 6/8] Update to scala 2.13.4 --- .github/workflows/ci.yaml | 2 +- .../com/twitter/chill/SerializedExamplesData.scala | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index be1a71ee..abac5d73 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -50,7 +50,7 @@ jobs: - "11" scala: - "2.12.12" - - "2.13.3" + - "2.13.4" testWithCoverageReport: runs-on: ubuntu-latest steps: diff --git a/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala b/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala index 6c368db9..be4d02ca 100644 --- a/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala +++ b/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala @@ -65,9 +65,9 @@ object SerializedExamplesData { 27 -> ("HQEEJwECBAIGJwECCAIKJwECDAIOJwECEAIS" -> Map(2 -> 3, 4 -> 5, 6 -> 7, 8 -> 9)), 28 -> ("HgEA" -> HashMap.empty[Any, Any]), 29 -> ("HwEMAAwIBgI=" -> new Range.Inclusive(3, 6, 1)), - 30 -> ("IAEBAgoAAQgBAHNjYWxhLm1hdGguTnVtZXJpYyRJbnRJc0ludGVncmFspAEBAAMCBAIC" -> + 30 -> ("IAECAgoAAAEAAQBzY2FsYS5tYXRoLk51bWVyaWMkSW50SXNJbnRlZ3JhbKQBAQADAgQCAg==" -> new NumericRange.Inclusive[Int](2, 5, 1)), - 31 -> ("IQEBAgoAAAYBAHNjYWxhLm1hdGguTnVtZXJpYyRJbnRJc0ludGVncmFspAEBAAMCBAIC" -> + 31 -> ("IQECAgoAAAAAAQBzY2FsYS5tYXRoLk51bWVyaWMkSW50SXNJbnRlZ3JhbKQBAQADAgQCAg==" -> new NumericRange.Exclusive[Int](2, 5, 1)), 32 -> ("IgECAgYCCg==" -> scala.collection.mutable.BitSet(3, 5)), 33 -> ("IwEBJwECBgIK" -> scala.collection.mutable.HashMap(3 -> 5)), From 9f8c160ec4f61902a37264e7038a4c5cb7d8cf6b Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Mon, 18 Jan 2021 23:10:16 +0000 Subject: [PATCH 7/8] Update README with compatibility --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 9002d4fa..cdf0de60 100644 --- a/README.md +++ b/README.md @@ -9,6 +9,9 @@ Extensions for the [Kryo serialization library](https://github.com/EsotericSoftw serializers and a set of classes to ease configuration of Kryo in systems like Hadoop, Storm, Akka, etc. +### Compatibility + +Serialization compatibility is **NOT** guaranteed between releases, and for this reason, we don't recommend using it for long-term storage. Serialization is highly dependent on scala version compatibility and on the underlying Kryo serializers, which take different approaches to compatibility. ### Building Chill From e1ee7aa1c1c0dc2f95073f3d202e76c11bacc625 Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Fri, 21 May 2021 09:10:59 +0100 Subject: [PATCH 8/8] fixup --- .github/workflows/ci.yaml | 2 +- .../com/twitter/chill/RegistrationIdsSpecData.scala | 6 +++--- .../com/twitter/chill/SerializedExamplesData.scala | 5 +++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index abac5d73..3d9997bb 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -50,7 +50,7 @@ jobs: - "11" scala: - "2.12.12" - - "2.13.4" + - "2.13.6" testWithCoverageReport: runs-on: ubuntu-latest steps: diff --git a/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala b/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala index b5f363b0..2d44f0fb 100644 --- a/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala +++ b/chill-scala/src/test/scala-2.13+/com/twitter/chill/RegistrationIdsSpecData.scala @@ -1,11 +1,11 @@ /* -Copyright 2020 Twitter, Inc. +Copyright 2019 Twitter, Inc. -Licensed under the Apache License, Version 3.1 (the "License"); +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at -http://www.apache.org/licenses/LICENSE-3.1 +http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, diff --git a/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala b/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala index be4d02ca..773c7de4 100644 --- a/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala +++ b/chill-scala/src/test/scala-2.13+/com/twitter/chill/SerializedExamplesData.scala @@ -1,7 +1,7 @@ /* -Copyright 2020Twitter, Inc. +Copyright 2019 Twitter, Inc. -Licensed under the Apache License, Version 2.1(the "License"); +Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at @@ -54,6 +54,7 @@ object SerializedExamplesData { 16 -> ("EgECBA==" -> Left(2)), 17 -> ("EwECBA==" -> Right(2)), // 18 -> ("FAEBAgQ=" -> Vector(2)), + // new vector classes in 2.13 see 144, 145 19 -> ("FQEBAgQ=" -> Set(2)), 20 -> ("FgECAgQCBg==" -> Set(2, 3)), 21 -> ("FwEDAgQCBgII" -> Set(2, 3, 4)),