diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 0453ce21..3b1d5a79 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -12,25 +12,6 @@ jobs: distribution: "temurin" java-version: "17" - run: 'sbt "; +scalafmtCheckAll; scalafmtSbtCheck" "; scalafixEnable; scalafix --check; test:scalafix --check"' - mimaReport: - runs-on: ubuntu-latest - steps: - - uses: "actions/checkout@v3" - - uses: actions/setup-java@v3 - with: - cache: "sbt" - distribution: "temurin" - java-version: ${{matrix.java}} - - run: 'sbt "++${{matrix.scala}} mimaReportBinaryIssues"' - strategy: - matrix: - java: - - "8" - - "11" - - "17" - scala: - - "2.11.12" - - "2.12.17" test: runs-on: ubuntu-latest steps: @@ -44,12 +25,10 @@ jobs: strategy: matrix: java: - - "8" - "11" - "17" scala: - - "2.12.17" - - "2.13.8" + - "2.13.13" testWithCoverageReport: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/release-drafter.yml b/.github/workflows/release-drafter.yml index ba091604..a83778ef 100644 --- a/.github/workflows/release-drafter.yml +++ b/.github/workflows/release-drafter.yml @@ -3,7 +3,7 @@ name: Release Drafter on: push: branches: - - develop + - dai/develop jobs: update_release_draft: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 9e85efaf..fa8bee3a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,7 +1,7 @@ name: Release on: push: - branches: [develop] + branches: [dai/develop] tags: ["*"] jobs: publish: @@ -13,11 +13,9 @@ jobs: cache: "sbt" distribution: "temurin" java-version: "17" - - uses: olafurpg/setup-gpg@v3 - name: Publish ${{ github.ref }} - run: sbt ci-release + run: sbt publish env: - PGP_PASSPHRASE: ${{ secrets.PGP_PASSPHRASE }} - PGP_SECRET: ${{ secrets.PGP_SECRET }} - SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} - SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} + NEXUS_HOST: "nexus.xebialabs.com" + NEXUS_USERNAME: ${{ secrets.NEXUS_CI_USER }} + NEXUS_PASSWORD: ${{ secrets.NEXUS_CI_USER_PWD }} diff --git a/.gitignore b/.gitignore index 7be56abe..03587590 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,5 @@ project/build/target/ project/plugins/target/ project/plugins/lib_managed/ project/plugins/src_managed/ + +/.bsp \ No newline at end of file diff --git a/README.md b/README.md index a9b99bb5..08558dd4 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,8 @@ [![Latest version](https://index.scala-lang.org/twitter/chill/chill/latest.svg?color=orange)](https://index.scala-lang.org/twitter/chill/chill) [![Chat](https://badges.gitter.im/twitter/chill.svg)](https://gitter.im/twitter/chill?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) +IMPORTANT: This is Digital.ai fork of twitter/chill. Please do not use it in your projects unless you are Digital.ai employee. + Extensions for the [Kryo serialization library](https://github.com/EsotericSoftware/kryo) including serializers and a set of classes to ease configuration of Kryo in systems like Hadoop, Storm, Akka, etc. diff --git a/build.sbt b/build.sbt index 755831fe..fc8efc8d 100644 --- a/build.sbt +++ b/build.sbt @@ -1,9 +1,7 @@ -import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings - val akkaVersion = "2.6.20" val algebirdVersion = "0.13.9" val bijectionVersion = "0.9.7" -val kryoVersion = "4.0.2" +val kryoVersion = "5.6.0" val scroogeVersion = "21.2.0" val asmVersion = "4.16" val protobufVersion = "3.22.2" @@ -18,11 +16,12 @@ def scalaVersionSpecificFolders(srcBaseDir: java.io.File, scalaVersion: String): } val sharedSettings = Seq( - organization := "com.twitter", - scalaVersion := "2.11.12", - crossScalaVersions := Seq("2.11.12", "2.12.17", "2.13.8"), + organization := "com.xebialabs.chill", + scalaVersion := "2.13.13", + crossScalaVersions := Seq("2.11.12", "2.12.17", "2.13.13"), scalacOptions ++= Seq("-unchecked", "-deprecation"), scalacOptions ++= { + val credentialsFile = Path.userHome / ".sbt" / ".chill-credentials" scalaVersion.value match { case v if v.startsWith("2.11") => Seq("-Ywarn-unused", "-Ywarn-unused-import", "-target:jvm-1.8") case _ => Seq("-Ywarn-unused", "-release", "8") @@ -53,10 +52,10 @@ val sharedSettings = Seq( "org.scalacheck" %% "scalacheck" % "1.15.2" % "test", "org.scalatest" %% "scalatest" % "3.2.15" % "test", "org.scalatestplus" %% "scalatestplus-scalacheck" % "3.1.0.0-RC2" % "test", - "com.esotericsoftware" % "kryo-shaded" % kryoVersion + "com.esotericsoftware" % "kryo5" % kryoVersion ), Test / parallelExecution := true, - pomExtra := https://github.com/twitter/chill + pomExtra := https://github.com/xebialabs/chill Apache 2 @@ -98,14 +97,12 @@ lazy val chillAll = Project( ).settings(sharedSettings) .settings(noPublishSettings) .settings( - mimaPreviousArtifacts := Set.empty, crossScalaVersions := Nil ) .aggregate( chill, chillBijection, chillScrooge, - chillStorm, chillJava, chillHadoop, chillThrift, @@ -123,40 +120,8 @@ lazy val noPublishSettings = Seq( publishArtifact := false ) -/** - * This returns the youngest jar we released that is compatible with the current. - */ val unreleasedModules = Set[String]("akka") -val javaOnly = Set[String]("storm", "java", "hadoop", "thrift", "protobuf") -val binaryCompatVersion = "0.9.2" - -def youngestForwardCompatible(subProj: String) = - Some(subProj) - .filterNot(unreleasedModules.contains) - .map { s => - if (javaOnly.contains(s)) - "com.twitter" % ("chill-" + s) % binaryCompatVersion - else - "com.twitter" %% ("chill-" + s) % binaryCompatVersion - } - -val ignoredABIProblems = { - import com.typesafe.tools.mima.core._ - import com.typesafe.tools.mima.core.ProblemFilters._ - Seq( - exclude[MissingTypesProblem]("com.twitter.chill.storm.BlizzardKryoFactory"), - exclude[MissingTypesProblem]("com.twitter.chill.InnerClosureFinder"), - exclude[IncompatibleResultTypeProblem]("com.twitter.chill.InnerClosureFinder.visitMethod"), - exclude[IncompatibleResultTypeProblem]("com.twitter.chill.FieldAccessFinder.visitMethod"), - exclude[MissingClassProblem]("com.twitter.chill.FieldAccessFinder"), - exclude[MissingTypesProblem]("com.twitter.chill.FieldAccessFinder"), - exclude[DirectMissingMethodProblem]("com.twitter.chill.FieldAccessFinder.this"), - exclude[IncompatibleResultTypeProblem]("com.twitter.chill.Tuple1*Serializer.read"), - exclude[IncompatibleMethTypeProblem]("com.twitter.chill.Tuple1*Serializer.write"), - exclude[IncompatibleResultTypeProblem]("com.twitter.chill.Tuple2*Serializer.read"), - exclude[IncompatibleMethTypeProblem]("com.twitter.chill.Tuple2*Serializer.write") - ) -} +val javaOnly = Set[String]("java", "hadoop", "thrift", "protobuf") def module(name: String) = { val id = "chill-%s".format(name) @@ -164,8 +129,6 @@ def module(name: String) = { .settings(sharedSettings) .settings( Keys.name := id, - mimaPreviousArtifacts := youngestForwardCompatible(name).toSet, - mimaBinaryIssueFilters ++= ignoredABIProblems, // Disable cross publishing for java artifacts publishArtifact := (if (javaOnly.contains(name) && scalaVersion.value.startsWith("2.11")) false else true) @@ -180,8 +143,6 @@ lazy val chill = Project( ).settings(sharedSettings) .settings( name := "chill", - mimaPreviousArtifacts := Set("com.twitter" %% "chill" % binaryCompatVersion), - mimaBinaryIssueFilters ++= ignoredABIProblems, libraryDependencies += "org.apache.xbean" % "xbean-asm7-shaded" % asmVersion ) .dependsOn(chillJava) @@ -216,15 +177,6 @@ lazy val chillJava = module("java").settings( autoScalaLibrary := false ) -// This can only have java deps! -lazy val chillStorm = module("storm") - .settings( - crossPaths := false, - autoScalaLibrary := false, - libraryDependencies += "org.apache.storm" % "storm-core" % "2.4.0" % "provided" - ) - .dependsOn(chillJava) - // This can only have java deps! lazy val chillHadoop = module("hadoop") .settings( @@ -284,3 +236,23 @@ lazy val chillAlgebird = module("algebird") ) ) .dependsOn(chill) + +ThisBuild / dynverSeparator := "-" +ThisBuild / dynverSonatypeSnapshots := true +ThisBuild / publishMavenStyle := true + +ThisBuild / publishTo := { + val nexus = "https://nexus.xebialabs.com/nexus/content/" + if (isSnapshot.value) + Some("snapshots".at(nexus + "repositories/snapshots")) + else + Some("releases".at(nexus + "repositories/releases")) +} + +inThisBuild( + List( + scalaVersion := "2.13.13", + semanticdbEnabled := true, + semanticdbVersion := scalafixSemanticdb.revision + ) +) diff --git a/chill-akka/src/main/scala/com/twitter/chill/akka/ActorRefSerializer.scala b/chill-akka/src/main/scala/com/twitter/chill/akka/ActorRefSerializer.scala index 365a2ef8..329382a2 100644 --- a/chill-akka/src/main/scala/com/twitter/chill/akka/ActorRefSerializer.scala +++ b/chill-akka/src/main/scala/com/twitter/chill/akka/ActorRefSerializer.scala @@ -14,8 +14,8 @@ package com.twitter.chill.akka */ import akka.actor.{ActorPath, ActorRef, ExtendedActorSystem} import akka.serialization.Serialization -import com.esotericsoftware.kryo.{Kryo, Serializer} -import com.esotericsoftware.kryo.io.{Input, Output} +import com.esotericsoftware.kryo.kryo5.{Kryo, Serializer} +import com.esotericsoftware.kryo.kryo5.io.{Input, Output} import com.twitter.chill.{toRich, IKryoRegistrar} @@ -34,7 +34,7 @@ class ActorRefSerializer(system: ExtendedActorSystem) extends Serializer[ActorRe kryo.forSubclass[ActorRef](this) } - override def read(kryo: Kryo, input: Input, typ: Class[ActorRef]): ActorRef = { + override def read(kryo: Kryo, input: Input, typ: Class[_ <: ActorRef]): ActorRef = { val path = ActorPath.fromString(input.readString()) system.provider.resolveActorRef(path) } diff --git a/chill-algebird/src/main/scala/com/twitter/chill/algebird/AlgebirdRegistrar.scala b/chill-algebird/src/main/scala/com/twitter/chill/algebird/AlgebirdRegistrar.scala index 4aa6d737..ec5baac9 100644 --- a/chill-algebird/src/main/scala/com/twitter/chill/algebird/AlgebirdRegistrar.scala +++ b/chill-algebird/src/main/scala/com/twitter/chill/algebird/AlgebirdRegistrar.scala @@ -15,8 +15,8 @@ limitations under the License. */ package com.twitter.chill.algebird -import com.esotericsoftware.kryo.Kryo -import com.esotericsoftware.kryo.serializers.FieldSerializer +import com.esotericsoftware.kryo.kryo5.Kryo +import com.esotericsoftware.kryo.kryo5.serializers.FieldSerializer import com.twitter.chill.IKryoRegistrar diff --git a/chill-algebird/src/main/scala/com/twitter/chill/algebird/AlgebirdSerializers.scala b/chill-algebird/src/main/scala/com/twitter/chill/algebird/AlgebirdSerializers.scala index 59f13e93..030633b1 100644 --- a/chill-algebird/src/main/scala/com/twitter/chill/algebird/AlgebirdSerializers.scala +++ b/chill-algebird/src/main/scala/com/twitter/chill/algebird/AlgebirdSerializers.scala @@ -15,9 +15,9 @@ limitations under the License. */ package com.twitter.chill.algebird -import com.esotericsoftware.kryo.Kryo -import com.esotericsoftware.kryo.{Serializer => KSerializer} -import com.esotericsoftware.kryo.io.{Input, Output} +import com.esotericsoftware.kryo.kryo5.Kryo +import com.esotericsoftware.kryo.kryo5.{Serializer => KSerializer} +import com.esotericsoftware.kryo.kryo5.io.{Input, Output} import com.twitter.algebird.{AveragedValue, DecayedValue, HLL, HyperLogLog, HyperLogLogMonoid, Moments, QTree} @@ -29,7 +29,7 @@ class AveragedValueSerializer extends KSerializer[AveragedValue] { out.writeLong(s.count, true) out.writeDouble(s.value) } - def read(kser: Kryo, in: Input, cls: Class[AveragedValue]): AveragedValue = + def read(kser: Kryo, in: Input, cls: Class[_ <: AveragedValue]): AveragedValue = AveragedValue(in.readLong(true), in.readDouble) } @@ -42,7 +42,7 @@ class MomentsSerializer extends KSerializer[Moments] { out.writeDouble(s.m3) out.writeDouble(s.m4) } - def read(kser: Kryo, in: Input, cls: Class[Moments]): Moments = + def read(kser: Kryo, in: Input, cls: Class[_ <: Moments]): Moments = Moments(in.readLong(true), in.readDouble, in.readDouble, in.readDouble, in.readDouble) } @@ -52,7 +52,7 @@ class DecayedValueSerializer extends KSerializer[DecayedValue] { out.writeDouble(s.value) out.writeDouble(s.scaledTime) } - def read(kser: Kryo, in: Input, cls: Class[DecayedValue]): DecayedValue = + def read(kser: Kryo, in: Input, cls: Class[_ <: DecayedValue]): DecayedValue = DecayedValue(in.readDouble, in.readDouble) } @@ -63,7 +63,7 @@ class HLLSerializer extends KSerializer[HLL] { out.writeInt(bytes.size, true) out.writeBytes(bytes) } - def read(kser: Kryo, in: Input, cls: Class[HLL]): HLL = + def read(kser: Kryo, in: Input, cls: Class[_ <: HLL]): HLL = HyperLogLog.fromBytes(in.readBytes(in.readInt(true))) } @@ -72,7 +72,7 @@ class HLLMonoidSerializer extends KSerializer[HyperLogLogMonoid] { val hllMonoids: MMap[Int, HyperLogLogMonoid] = MMap[Int, HyperLogLogMonoid]() def write(kser: Kryo, out: Output, mon: HyperLogLogMonoid): Unit = out.writeInt(mon.bits, true) - def read(kser: Kryo, in: Input, cls: Class[HyperLogLogMonoid]): HyperLogLogMonoid = { + def read(kser: Kryo, in: Input, cls: Class[_ <: HyperLogLogMonoid]): HyperLogLogMonoid = { val bits = in.readInt(true) hllMonoids.getOrElseUpdate(bits, new HyperLogLogMonoid(bits)) } @@ -80,7 +80,7 @@ class HLLMonoidSerializer extends KSerializer[HyperLogLogMonoid] { class QTreeSerializer extends KSerializer[QTree[Any]] { setImmutable(true) - override def read(kryo: Kryo, input: Input, cls: Class[QTree[Any]]): QTree[Any] = { + override def read(kryo: Kryo, input: Input, cls: Class[_ <: QTree[Any]]): QTree[Any] = { val (v1, v2, v3) = (input.readLong(), input.readInt(), input.readLong()) val v4 = kryo.readClassAndObject(input) val v5 = kryo.readClassAndObject(input).asInstanceOf[Option[QTree[Any]]] diff --git a/chill-avro/src/test/java/com/twitter/chill/avro/AvroSerializerJavaTest.java b/chill-avro/src/test/java/com/twitter/chill/avro/AvroSerializerJavaTest.java index 921c44cc..62a258e3 100644 --- a/chill-avro/src/test/java/com/twitter/chill/avro/AvroSerializerJavaTest.java +++ b/chill-avro/src/test/java/com/twitter/chill/avro/AvroSerializerJavaTest.java @@ -1,8 +1,9 @@ package com.twitter.chill.avro; import avro.FiscalRecord; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.Serializer; +import com.esotericsoftware.kryo.kryo5.objenesis.strategy.StdInstantiatorStrategy; import com.twitter.chill.KryoInstantiator; import com.twitter.chill.KryoPool; import org.apache.avro.Schema; @@ -11,7 +12,6 @@ import org.apache.avro.generic.GenericRecordBuilder; import org.junit.Before; import org.junit.Test; -import org.objenesis.strategy.StdInstantiatorStrategy; import scala.reflect.ClassTag; import static org.junit.Assert.assertEquals; diff --git a/chill-bijection/src/main/scala/com/twitter/chill/BijectionEnrichedKryo.scala b/chill-bijection/src/main/scala/com/twitter/chill/BijectionEnrichedKryo.scala index aafd195d..1808807e 100644 --- a/chill-bijection/src/main/scala/com/twitter/chill/BijectionEnrichedKryo.scala +++ b/chill-bijection/src/main/scala/com/twitter/chill/BijectionEnrichedKryo.scala @@ -16,7 +16,6 @@ limitations under the License. package com.twitter.chill -import com.twitter.bijection.Injection import com.twitter.bijection.{Bijection, Bufferable, ImplicitBijection, Injection} import scala.reflect.ClassTag @@ -32,7 +31,7 @@ object BijectionEnrichedKryo { )(implicit bij: ImplicitBijection[A, B], cmf: ClassTag[B]): KSerializer[A] = new KSerializer[A] { def write(k: Kryo, out: Output, obj: A): Unit = kser.write(k, out, bij(obj)) - def read(k: Kryo, in: Input, cls: Class[A]): A = + def read(k: Kryo, in: Input, cls: Class[_ <: A]): A = bij.invert(kser.read(k, in, cmf.runtimeClass.asInstanceOf[Class[B]])) } diff --git a/chill-bijection/src/main/scala/com/twitter/chill/InjectiveSerializer.scala b/chill-bijection/src/main/scala/com/twitter/chill/InjectiveSerializer.scala index fce22244..4d4db9d9 100644 --- a/chill-bijection/src/main/scala/com/twitter/chill/InjectiveSerializer.scala +++ b/chill-bijection/src/main/scala/com/twitter/chill/InjectiveSerializer.scala @@ -29,7 +29,7 @@ class InjectiveSerializer[T] private (injection: Injection[T, Array[Byte]]) out.writeBytes(bytes) } - def read(kser: Kryo, in: Input, cls: Class[T]): T = { + def read(kser: Kryo, in: Input, cls: Class[_ <: T]): T = { val bytes = new Array[Byte](in.readInt(true)) in.readBytes(bytes) injection.invert(bytes).get diff --git a/chill-bijection/src/test/scala/com/twitter/chill/ExternalizerCodecSpec.scala b/chill-bijection/src/test/scala/com/twitter/chill/ExternalizerCodecSpec.scala index 89a28f1b..886ed973 100644 --- a/chill-bijection/src/test/scala/com/twitter/chill/ExternalizerCodecSpec.scala +++ b/chill-bijection/src/test/scala/com/twitter/chill/ExternalizerCodecSpec.scala @@ -17,19 +17,19 @@ package com.twitter.chill import com.twitter.bijection.Injection -import scala.util.Try import org.scalatest.wordspec.AnyWordSpec +import scala.util.Try + class NotSerializable { val x = "abcd" override def equals(other: Any): Boolean = other match { - case i: NotSerializable => true + case _: NotSerializable => true case _ => false } } class ExternalizerCodecSpec extends AnyWordSpec { - import ExternalizerCodec._ import ExternalizerInjection._ def rt[T: ExternalizerInjection: ExternalizerCodec](t: T): Try[T] = { diff --git a/chill-hadoop/src/main/java/com/twitter/chill/hadoop/KryoSerialization.java b/chill-hadoop/src/main/java/com/twitter/chill/hadoop/KryoSerialization.java index 29d1dc5a..886790da 100644 --- a/chill-hadoop/src/main/java/com/twitter/chill/hadoop/KryoSerialization.java +++ b/chill-hadoop/src/main/java/com/twitter/chill/hadoop/KryoSerialization.java @@ -16,15 +16,15 @@ package com.twitter.chill.hadoop; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.io.Output; +import com.esotericsoftware.kryo.kryo5.objenesis.strategy.StdInstantiatorStrategy; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.conf.Configured; import org.apache.hadoop.io.serializer.Deserializer; import org.apache.hadoop.io.serializer.Serialization; import org.apache.hadoop.io.serializer.Serializer; -import org.objenesis.strategy.StdInstantiatorStrategy; import com.twitter.chill.KryoPool; import com.twitter.chill.KryoInstantiator; diff --git a/chill-hadoop/src/test/scala/com/twitter/chill/hadoop/HadoopTests.scala b/chill-hadoop/src/test/scala/com/twitter/chill/hadoop/HadoopTests.scala index 97f9cde8..0d931e1d 100644 --- a/chill-hadoop/src/test/scala/com/twitter/chill/hadoop/HadoopTests.scala +++ b/chill-hadoop/src/test/scala/com/twitter/chill/hadoop/HadoopTests.scala @@ -16,9 +16,8 @@ limitations under the License. package com.twitter.chill.hadoop -import com.esotericsoftware.kryo.Kryo - -import org.objenesis.strategy.StdInstantiatorStrategy +import com.esotericsoftware.kryo.kryo5.Kryo +import com.esotericsoftware.kryo.kryo5.objenesis.strategy.StdInstantiatorStrategy; import java.io.{ByteArrayInputStream => BAIn, ByteArrayOutputStream => BAOut} import org.apache.hadoop.conf.Configuration @@ -28,9 +27,18 @@ import com.twitter.chill.KryoInstantiator import org.scalatest.matchers.should.Matchers import org.scalatest.wordspec.AnyWordSpec +class AnyKryoInstantiator extends KryoInstantiator { + override def newKryo: Kryo = { + val k = new Kryo + k.register(Class.forName("com.twitter.chill.hadoop.HadoopTests")) + k.register(Class.forName("scala.collection.immutable.List")) + k + } +} class StdKryoInstantiator extends KryoInstantiator { override def newKryo: Kryo = { val k = new Kryo + k.register(Class.forName("scala.Tuple2$mcII$sp")) k.setInstantiatorStrategy(new StdInstantiatorStrategy) k } @@ -56,7 +64,7 @@ class HadoopTests extends AnyWordSpec with Matchers { "accept anything" in { val conf = new Configuration val hc = new HadoopConfig(conf) - ConfiguredInstantiator.setReflect(hc, classOf[KryoInstantiator]) + ConfiguredInstantiator.setReflect(hc, classOf[AnyKryoInstantiator]) val ks = new KryoSerialization(conf) Seq(classOf[List[_]], classOf[Int], this.getClass).forall { cls => diff --git a/chill-java/src/main/java/com/twitter/chill/ClassRegistrar.java b/chill-java/src/main/java/com/twitter/chill/ClassRegistrar.java index 9a1aac9d..4130d9a7 100644 --- a/chill-java/src/main/java/com/twitter/chill/ClassRegistrar.java +++ b/chill-java/src/main/java/com/twitter/chill/ClassRegistrar.java @@ -16,7 +16,7 @@ package com.twitter.chill; -import com.esotericsoftware.kryo.Kryo; +import com.esotericsoftware.kryo.kryo5.Kryo; /** Register this class to be used with the default serializer for this class */ public class ClassRegistrar implements IKryoRegistrar { diff --git a/chill-java/src/main/java/com/twitter/chill/IKryoRegistrar.java b/chill-java/src/main/java/com/twitter/chill/IKryoRegistrar.java index 25a95076..0d4bf35d 100644 --- a/chill-java/src/main/java/com/twitter/chill/IKryoRegistrar.java +++ b/chill-java/src/main/java/com/twitter/chill/IKryoRegistrar.java @@ -16,7 +16,7 @@ package com.twitter.chill; -import com.esotericsoftware.kryo.Kryo; +import com.esotericsoftware.kryo.kryo5.Kryo; import java.io.Serializable; /** diff --git a/chill-java/src/main/java/com/twitter/chill/KryoInstantiator.java b/chill-java/src/main/java/com/twitter/chill/KryoInstantiator.java index 5af3aa21..1e2da834 100644 --- a/chill-java/src/main/java/com/twitter/chill/KryoInstantiator.java +++ b/chill-java/src/main/java/com/twitter/chill/KryoInstantiator.java @@ -16,8 +16,8 @@ package com.twitter.chill; -import com.esotericsoftware.kryo.Kryo; -import org.objenesis.strategy.InstantiatorStrategy; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.objenesis.strategy.InstantiatorStrategy; import java.io.Serializable; /** Class to create a new Kryo instance. diff --git a/chill-java/src/main/java/com/twitter/chill/KryoPool.java b/chill-java/src/main/java/com/twitter/chill/KryoPool.java index ce15cb66..eb79a889 100644 --- a/chill-java/src/main/java/com/twitter/chill/KryoPool.java +++ b/chill-java/src/main/java/com/twitter/chill/KryoPool.java @@ -16,9 +16,9 @@ package com.twitter.chill; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.io.Input; +import com.esotericsoftware.kryo.kryo5.io.Output; import java.io.OutputStream; import java.io.ByteArrayOutputStream; diff --git a/chill-java/src/main/java/com/twitter/chill/ReflectingDefaultRegistrar.java b/chill-java/src/main/java/com/twitter/chill/ReflectingDefaultRegistrar.java index 7ace7507..ea149925 100644 --- a/chill-java/src/main/java/com/twitter/chill/ReflectingDefaultRegistrar.java +++ b/chill-java/src/main/java/com/twitter/chill/ReflectingDefaultRegistrar.java @@ -16,8 +16,8 @@ package com.twitter.chill; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.Serializer; /** Set the default serializers for subclasses of the given class */ diff --git a/chill-java/src/main/java/com/twitter/chill/ReflectingRegistrar.java b/chill-java/src/main/java/com/twitter/chill/ReflectingRegistrar.java index e55fa04b..fa716fa3 100644 --- a/chill-java/src/main/java/com/twitter/chill/ReflectingRegistrar.java +++ b/chill-java/src/main/java/com/twitter/chill/ReflectingRegistrar.java @@ -16,9 +16,9 @@ package com.twitter.chill; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; -import com.esotericsoftware.kryo.util.Util; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.Serializer; +import com.esotericsoftware.kryo.kryo5.util.Util; /** Use reflection to instantiate a serializer. * Used when serializer classes are written to config files diff --git a/chill-java/src/main/java/com/twitter/chill/SerDeState.java b/chill-java/src/main/java/com/twitter/chill/SerDeState.java index 24cd403c..0796641e 100644 --- a/chill-java/src/main/java/com/twitter/chill/SerDeState.java +++ b/chill-java/src/main/java/com/twitter/chill/SerDeState.java @@ -16,9 +16,9 @@ package com.twitter.chill; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.io.Input; +import com.esotericsoftware.kryo.kryo5.io.Output; import java.io.OutputStream; import java.io.InputStream; @@ -43,7 +43,7 @@ protected SerDeState(Kryo k, Input in, Output out) { /** Call this when to reset the state to the initial state */ public void clear() { input.setBuffer(EMPTY_BUFFER); - output.clear(); + output.reset(); } public void setInput(byte[] in) { input.setBuffer(in); } diff --git a/chill-java/src/main/java/com/twitter/chill/SingleDefaultRegistrar.java b/chill-java/src/main/java/com/twitter/chill/SingleDefaultRegistrar.java index b11b4573..4fd738db 100644 --- a/chill-java/src/main/java/com/twitter/chill/SingleDefaultRegistrar.java +++ b/chill-java/src/main/java/com/twitter/chill/SingleDefaultRegistrar.java @@ -16,8 +16,8 @@ package com.twitter.chill; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.Serializer; /** Set the default serializers for subclasses of the given class */ diff --git a/chill-java/src/main/java/com/twitter/chill/SingleRegistrar.java b/chill-java/src/main/java/com/twitter/chill/SingleRegistrar.java index f449339b..680dc662 100644 --- a/chill-java/src/main/java/com/twitter/chill/SingleRegistrar.java +++ b/chill-java/src/main/java/com/twitter/chill/SingleRegistrar.java @@ -16,8 +16,8 @@ package com.twitter.chill; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.Serializer; public class SingleRegistrar implements IKryoRegistrar { final Class klass; diff --git a/chill-java/src/main/java/com/twitter/chill/config/ConfiguredInstantiator.java b/chill-java/src/main/java/com/twitter/chill/config/ConfiguredInstantiator.java index d526e706..866615fb 100644 --- a/chill-java/src/main/java/com/twitter/chill/config/ConfiguredInstantiator.java +++ b/chill-java/src/main/java/com/twitter/chill/config/ConfiguredInstantiator.java @@ -20,9 +20,9 @@ import java.lang.reflect.InvocationTargetException; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.io.Input; +import com.esotericsoftware.kryo.kryo5.io.Output; /** * This is the standard Config based KryoInstantiator. diff --git a/chill-java/src/main/java/com/twitter/chill/config/ReflectingInstantiator.java b/chill-java/src/main/java/com/twitter/chill/config/ReflectingInstantiator.java index 7ba42b63..b1baf6c2 100644 --- a/chill-java/src/main/java/com/twitter/chill/config/ReflectingInstantiator.java +++ b/chill-java/src/main/java/com/twitter/chill/config/ReflectingInstantiator.java @@ -22,10 +22,10 @@ import com.twitter.chill.ReflectingRegistrar; import com.twitter.chill.ReflectingDefaultRegistrar; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; -import org.objenesis.strategy.InstantiatorStrategy; -import org.objenesis.strategy.StdInstantiatorStrategy; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.Serializer; +import com.esotericsoftware.kryo.kryo5.objenesis.strategy.InstantiatorStrategy; +import com.esotericsoftware.kryo.kryo5.objenesis.strategy.StdInstantiatorStrategy; import java.util.ArrayList; import java.util.List; import java.lang.reflect.InvocationTargetException; diff --git a/chill-java/src/main/java/com/twitter/chill/java/ArraysAsListSerializer.java b/chill-java/src/main/java/com/twitter/chill/java/ArraysAsListSerializer.java index f4811d95..68818bec 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/ArraysAsListSerializer.java +++ b/chill-java/src/main/java/com/twitter/chill/java/ArraysAsListSerializer.java @@ -26,10 +26,10 @@ import java.util.HashMap; import java.util.Map; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.Serializer; +import com.esotericsoftware.kryo.kryo5.io.Input; +import com.esotericsoftware.kryo.kryo5.io.Output; /** * A kryo {@link Serializer} for lists created via {@link Arrays#asList(Object...)}. @@ -71,7 +71,7 @@ public ArraysAsListSerializer() { } @Override - public List read(final Kryo kryo, final Input input, final Class> type) { + public List read(final Kryo kryo, final Input input, final Class> type) { final int length = input.readInt(true); Class componentType = kryo.readClass(input).getType(); try { diff --git a/chill-java/src/main/java/com/twitter/chill/java/BitSetSerializer.java b/chill-java/src/main/java/com/twitter/chill/java/BitSetSerializer.java index 597699c6..b7bb618a 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/BitSetSerializer.java +++ b/chill-java/src/main/java/com/twitter/chill/java/BitSetSerializer.java @@ -16,11 +16,11 @@ package com.twitter.chill.java; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.KryoException; -import com.esotericsoftware.kryo.Serializer; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.KryoException; +import com.esotericsoftware.kryo.kryo5.Serializer; +import com.esotericsoftware.kryo.kryo5.io.Input; +import com.esotericsoftware.kryo.kryo5.io.Output; import com.twitter.chill.IKryoRegistrar; import com.twitter.chill.SingleRegistrar; @@ -81,7 +81,7 @@ public void write(Kryo kryo, Output output, BitSet bitSet) { } @Override - public BitSet read(Kryo kryo, Input input, Class bitSetClass) { + public BitSet read(Kryo kryo, Input input, Class bitSetClass) { int len = input.readInt(true); long[] target = new long[len]; diff --git a/chill-java/src/main/java/com/twitter/chill/java/InetSocketAddressSerializer.java b/chill-java/src/main/java/com/twitter/chill/java/InetSocketAddressSerializer.java index c1515853..757377ee 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/InetSocketAddressSerializer.java +++ b/chill-java/src/main/java/com/twitter/chill/java/InetSocketAddressSerializer.java @@ -16,10 +16,10 @@ package com.twitter.chill.java; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.Serializer; +import com.esotericsoftware.kryo.kryo5.io.Input; +import com.esotericsoftware.kryo.kryo5.io.Output; import com.twitter.chill.IKryoRegistrar; import com.twitter.chill.SingleRegistrar; @@ -39,7 +39,7 @@ public void write(Kryo kryo, Output output, InetSocketAddress obj) { } @Override - public InetSocketAddress read(Kryo kryo, Input input, Class klass) { + public InetSocketAddress read(Kryo kryo, Input input, Class klass) { String host = input.readString(); int port = input.readInt(true); return new InetSocketAddress(host, port); diff --git a/chill-java/src/main/java/com/twitter/chill/java/IterableRegistrar.java b/chill-java/src/main/java/com/twitter/chill/java/IterableRegistrar.java index e5ad1ea7..9f42c1bc 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/IterableRegistrar.java +++ b/chill-java/src/main/java/com/twitter/chill/java/IterableRegistrar.java @@ -18,8 +18,8 @@ import com.twitter.chill.IKryoRegistrar; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.DefaultSerializer; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.DefaultSerializer; import java.util.Arrays; diff --git a/chill-java/src/main/java/com/twitter/chill/java/IterableRegistrarSerializer.java b/chill-java/src/main/java/com/twitter/chill/java/IterableRegistrarSerializer.java index de61fe8b..3a6e2964 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/IterableRegistrarSerializer.java +++ b/chill-java/src/main/java/com/twitter/chill/java/IterableRegistrarSerializer.java @@ -17,10 +17,10 @@ package com.twitter.chill.java; import com.twitter.chill.IKryoRegistrar; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; -import com.esotericsoftware.kryo.Serializer; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.io.Input; +import com.esotericsoftware.kryo.kryo5.io.Output; +import com.esotericsoftware.kryo.kryo5.Serializer; import java.util.ArrayList; @@ -32,7 +32,7 @@ public void write(Kryo kryo, Output output, IterableRegistrar obj) { } kryo.writeClassAndObject(output, null); } - public IterableRegistrar read(Kryo kryo, Input input, Class type) { + public IterableRegistrar read(Kryo kryo, Input input, Class type) { ArrayList krs = new ArrayList(); IKryoRegistrar thisKr = (IKryoRegistrar)kryo.readClassAndObject(input); while(thisKr != null) { diff --git a/chill-java/src/main/java/com/twitter/chill/java/Java8ClosureRegistrar.java b/chill-java/src/main/java/com/twitter/chill/java/Java8ClosureRegistrar.java index dea99914..d8a87b89 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/Java8ClosureRegistrar.java +++ b/chill-java/src/main/java/com/twitter/chill/java/Java8ClosureRegistrar.java @@ -1,7 +1,7 @@ package com.twitter.chill.java; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.serializers.ClosureSerializer; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.serializers.ClosureSerializer; import com.twitter.chill.IKryoRegistrar; /** diff --git a/chill-java/src/main/java/com/twitter/chill/java/LocaleSerializer.java b/chill-java/src/main/java/com/twitter/chill/java/LocaleSerializer.java index aa769aa7..cd6fbef0 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/LocaleSerializer.java +++ b/chill-java/src/main/java/com/twitter/chill/java/LocaleSerializer.java @@ -16,11 +16,11 @@ package com.twitter.chill.java; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.serializers.JavaSerializer; -import com.esotericsoftware.kryo.Serializer; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.serializers.JavaSerializer; +import com.esotericsoftware.kryo.kryo5.Serializer; +import com.esotericsoftware.kryo.kryo5.io.Input; +import com.esotericsoftware.kryo.kryo5.io.Output; import com.twitter.chill.IKryoRegistrar; import com.twitter.chill.SingleRegistrar; diff --git a/chill-java/src/main/java/com/twitter/chill/java/PackageRegistrar.java b/chill-java/src/main/java/com/twitter/chill/java/PackageRegistrar.java index 21d1ebf2..fce8e307 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/PackageRegistrar.java +++ b/chill-java/src/main/java/com/twitter/chill/java/PackageRegistrar.java @@ -18,7 +18,7 @@ import com.twitter.chill.IKryoRegistrar; -import com.esotericsoftware.kryo.Kryo; +import com.esotericsoftware.kryo.kryo5.Kryo; import java.util.ArrayList; diff --git a/chill-java/src/main/java/com/twitter/chill/java/PriorityQueueSerializer.java b/chill-java/src/main/java/com/twitter/chill/java/PriorityQueueSerializer.java index c9dd95fd..1d3de4dd 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/PriorityQueueSerializer.java +++ b/chill-java/src/main/java/com/twitter/chill/java/PriorityQueueSerializer.java @@ -19,10 +19,10 @@ import com.twitter.chill.IKryoRegistrar; import com.twitter.chill.SingleRegistrar; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.Serializer; +import com.esotericsoftware.kryo.kryo5.io.Input; +import com.esotericsoftware.kryo.kryo5.io.Output; import java.lang.reflect.Field; import java.util.PriorityQueue; @@ -62,7 +62,7 @@ public void write(Kryo k, Output o, PriorityQueue q) { o.flush(); } } - public PriorityQueue read(Kryo k, Input i, Class> c) { + public PriorityQueue read(Kryo k, Input i, Class> c) { Comparator comp = (Comparator)k.readClassAndObject(i); int sz = i.readInt(true); // can't create with size 0: diff --git a/chill-java/src/main/java/com/twitter/chill/java/RegexSerializer.java b/chill-java/src/main/java/com/twitter/chill/java/RegexSerializer.java index 2f9742ab..168bb78d 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/RegexSerializer.java +++ b/chill-java/src/main/java/com/twitter/chill/java/RegexSerializer.java @@ -16,10 +16,10 @@ package com.twitter.chill.java; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.Serializer; +import com.esotericsoftware.kryo.kryo5.io.Input; +import com.esotericsoftware.kryo.kryo5.io.Output; import com.twitter.chill.IKryoRegistrar; import com.twitter.chill.SingleRegistrar; @@ -38,7 +38,7 @@ public void write(Kryo kryo, Output output, Pattern pattern) { } @Override - public Pattern read(Kryo kryo, Input input, Class patternClass) { + public Pattern read(Kryo kryo, Input input, Class patternClass) { return Pattern.compile(input.readString()); } } diff --git a/chill-java/src/main/java/com/twitter/chill/java/SimpleDateFormatSerializer.java b/chill-java/src/main/java/com/twitter/chill/java/SimpleDateFormatSerializer.java index f3711a30..d5a4b28e 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/SimpleDateFormatSerializer.java +++ b/chill-java/src/main/java/com/twitter/chill/java/SimpleDateFormatSerializer.java @@ -16,7 +16,7 @@ package com.twitter.chill.java; -import com.esotericsoftware.kryo.serializers.JavaSerializer; +import com.esotericsoftware.kryo.kryo5.serializers.JavaSerializer; import com.twitter.chill.IKryoRegistrar; import com.twitter.chill.SingleRegistrar; diff --git a/chill-java/src/main/java/com/twitter/chill/java/SqlDateSerializer.java b/chill-java/src/main/java/com/twitter/chill/java/SqlDateSerializer.java index d31061df..d93a9d51 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/SqlDateSerializer.java +++ b/chill-java/src/main/java/com/twitter/chill/java/SqlDateSerializer.java @@ -16,10 +16,10 @@ package com.twitter.chill.java; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.Serializer; +import com.esotericsoftware.kryo.kryo5.io.Input; +import com.esotericsoftware.kryo.kryo5.io.Output; import com.twitter.chill.IKryoRegistrar; import com.twitter.chill.SingleRegistrar; @@ -38,7 +38,7 @@ public void write(Kryo kryo, Output output, Date date) { } @Override - public Date read(Kryo kryo, Input input, Class dateClass) { + public Date read(Kryo kryo, Input input, Class dateClass) { return new Date(input.readLong(true)); } } diff --git a/chill-java/src/main/java/com/twitter/chill/java/SqlTimeSerializer.java b/chill-java/src/main/java/com/twitter/chill/java/SqlTimeSerializer.java index eeb5e938..0f613544 100644 --- a/chill-java/src/main/java/com/twitter/chill/java/SqlTimeSerializer.java +++ b/chill-java/src/main/java/com/twitter/chill/java/SqlTimeSerializer.java @@ -16,10 +16,10 @@ package com.twitter.chill.java; -import com.esotericsoftware.kryo.Kryo; -import com.esotericsoftware.kryo.Serializer; -import com.esotericsoftware.kryo.io.Input; -import com.esotericsoftware.kryo.io.Output; +import com.esotericsoftware.kryo.kryo5.Kryo; +import com.esotericsoftware.kryo.kryo5.Serializer; +import com.esotericsoftware.kryo.kryo5.io.Input; +import com.esotericsoftware.kryo.kryo5.io.Output; import com.twitter.chill.IKryoRegistrar; import com.twitter.chill.SingleRegistrar; @@ -38,7 +38,7 @@ public void write(Kryo kryo, Output output, Time time) { } @Override - public Time read(Kryo kryo, Input input, Class