diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4898c3e8..e3d444b8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -9,47 +9,125 @@ name: Continuous Integration on: pull_request: - branches: ['**'] + branches: ['**', '!update/**', '!pr/**'] push: - branches: ['**'] + branches: ['**', '!update/**', '!pr/**'] + tags: [v*] env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + +concurrency: + group: ${{ github.workflow }} @ ${{ github.ref }} + cancel-in-progress: true + jobs: build: name: Build and Test strategy: matrix: os: [ubuntu-latest] - scala: [2.13.10, 2.12.17, 3.2.2] - java: [adopt@1.8] + scala: [2.13, 2.12, 3] + java: [temurin@11, temurin@17] + exclude: + - scala: 2.12 + java: temurin@17 + - scala: 3 + java: temurin@17 runs-on: ${{ matrix.os }} + timeout-minutes: 60 steps: - name: Checkout current branch (full) - uses: actions/checkout@v2 + uses: actions/checkout@v4 with: fetch-depth: 0 - - name: Setup Java and Scala - uses: olafurpg/setup-scala@v13 + - name: Setup Java (temurin@11) + id: setup-java-temurin-11 + if: matrix.java == 'temurin@11' + uses: actions/setup-java@v4 with: - java-version: ${{ matrix.java }} + distribution: temurin + java-version: 11 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false' + run: sbt +update - - name: Cache sbt - uses: actions/cache@v2 + - name: Setup Java (temurin@17) + id: setup-java-temurin-17 + if: matrix.java == 'temurin@17' + uses: actions/setup-java@v4 with: - path: | - ~/.sbt - ~/.ivy2/cache - ~/.coursier/cache/v1 - ~/.cache/coursier/v1 - ~/AppData/Local/Coursier/Cache/v1 - ~/Library/Caches/Coursier/v1 - key: ${{ runner.os }}-sbt-cache-v2-${{ hashFiles('**/*.sbt') }}-${{ hashFiles('project/build.properties') }} + distribution: temurin + java-version: 17 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: sbt +update - name: Check that workflows are up to date - run: sbt ++${{ matrix.scala }} githubWorkflowCheck + run: sbt githubWorkflowCheck + + - name: Check headers and formatting + if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest' + run: sbt '++ ${{ matrix.scala }}' headerCheckAll scalafmtCheckAll 'project /' scalafmtSbtCheck + + - name: Test + run: sbt '++ ${{ matrix.scala }}' test + + - name: Check binary compatibility + if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest' + run: sbt '++ ${{ matrix.scala }}' mimaReportBinaryIssues + + - name: Generate API documentation + if: matrix.java == 'temurin@11' && matrix.os == 'ubuntu-latest' + run: sbt '++ ${{ matrix.scala }}' doc + + dependency-submission: + name: Submit Dependencies + if: github.event_name != 'pull_request' + strategy: + matrix: + os: [ubuntu-latest] + java: [temurin@11] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout current branch (full) + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Java (temurin@11) + id: setup-java-temurin-11 + if: matrix.java == 'temurin@11' + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 11 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@11' && steps.setup-java-temurin-11.outputs.cache-hit == 'false' + run: sbt +update + + - name: Setup Java (temurin@17) + id: setup-java-temurin-17 + if: matrix.java == 'temurin@17' + uses: actions/setup-java@v4 + with: + distribution: temurin + java-version: 17 + cache: sbt + + - name: sbt update + if: matrix.java == 'temurin@17' && steps.setup-java-temurin-17.outputs.cache-hit == 'false' + run: sbt +update - - name: Build project - run: sbt ++${{ matrix.scala }} test + - name: Submit Dependencies + uses: scalacenter/sbt-dependency-submission@v2 + with: + configs-ignore: test scala-tool scala-doc-tool test-internal diff --git a/.gitignore b/.gitignore index 495d8365..4c584c9d 100644 --- a/.gitignore +++ b/.gitignore @@ -9,3 +9,5 @@ target/ .classpath tmp/ .bsp/ +.metals +.vscode diff --git a/.scalafix.conf b/.scalafix.conf new file mode 100644 index 00000000..edf55aee --- /dev/null +++ b/.scalafix.conf @@ -0,0 +1,3 @@ +rules = [ + OrganizeImports +] diff --git a/.scalafmt.conf b/.scalafmt.conf index cfad99bd..47317d54 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,6 +1,10 @@ -version = 3.5.9 +version = 3.8.2 +project.git = true +runner.dialect = scala213 +project.layout = StandardConvention continuationIndent.defnSite = 2 -docstrings = JavaDoc +docstrings.style = Asterisk +docstrings.wrap = no includeCurlyBraceInSelectChains = false maxColumn = 120 newlines.alwaysBeforeElseAfterCurlyIf = false @@ -13,3 +17,13 @@ rewrite.rules = [ AsciiSortImports, PreferCurlyFors ] +newlines.afterCurlyLambda = preserve +newlines.beforeCurlyLambdaParams = multilineWithCaseOnly + +fileOverride { + "glob:**/scala-3/src/main/scala/**" { + runner.dialect = scala3 + rewrite.scala3.convertToNewSyntax = true + rewrite.scala3.removeOptionalBraces = true + } +} \ No newline at end of file diff --git a/210/src/main/scala/io/circe/jackson/JacksonCompat.scala b/210/src/main/scala/io/circe/jackson/JacksonCompat.scala index a10a89f9..ebf0e7bc 100644 --- a/210/src/main/scala/io/circe/jackson/JacksonCompat.scala +++ b/210/src/main/scala/io/circe/jackson/JacksonCompat.scala @@ -1,7 +1,26 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import com.fasterxml.jackson.core.JsonParser -import com.fasterxml.jackson.databind.{ DeserializationContext, JsonNode, ObjectMapper, ObjectWriter } +import com.fasterxml.jackson.databind.DeserializationContext +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.ObjectWriter import com.fasterxml.jackson.databind.node.ObjectNode private[jackson] trait JacksonCompat { @@ -10,9 +29,13 @@ private[jackson] trait JacksonCompat { protected def handleUnexpectedToken(context: DeserializationContext)( klass: Class[_], parser: JsonParser - ): Unit = + ): Unit = { context.handleUnexpectedToken(klass, parser) + () + } protected def objectNodeSetAll(node: ObjectNode, fields: java.util.Map[String, JsonNode]): JsonNode = node.setAll[JsonNode](fields) + + protected def currentName(jp: JsonParser): String = jp.currentName } diff --git a/25/src/main/scala/io/circe/jackson/JacksonCompat.scala b/25/src/main/scala/io/circe/jackson/JacksonCompat.scala index 198b93d7..0533f6e4 100644 --- a/25/src/main/scala/io/circe/jackson/JacksonCompat.scala +++ b/25/src/main/scala/io/circe/jackson/JacksonCompat.scala @@ -15,4 +15,7 @@ private[jackson] trait JacksonCompat { protected def objectNodeSetAll(node: ObjectNode, fields: java.util.Map[String, JsonNode]): JsonNode = node.setAll(fields) + + protected def currentName(jp: JsonParser): String = jp.getCurrentName + } diff --git a/27/src/main/scala/io/circe/jackson/JacksonCompat.scala b/27/src/main/scala/io/circe/jackson/JacksonCompat.scala index a7ef0750..61a3b56e 100644 --- a/27/src/main/scala/io/circe/jackson/JacksonCompat.scala +++ b/27/src/main/scala/io/circe/jackson/JacksonCompat.scala @@ -1,7 +1,26 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import com.fasterxml.jackson.core.JsonParser -import com.fasterxml.jackson.databind.{ DeserializationContext, JsonNode, ObjectMapper, ObjectWriter } +import com.fasterxml.jackson.databind.DeserializationContext +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.ObjectWriter import com.fasterxml.jackson.databind.node.ObjectNode private[jackson] trait JacksonCompat { @@ -10,9 +29,14 @@ private[jackson] trait JacksonCompat { protected def handleUnexpectedToken(context: DeserializationContext)( klass: Class[_], parser: JsonParser - ): Unit = + ): Unit = { + val _ = parser throw context.mappingException(klass) + } protected def objectNodeSetAll(node: ObjectNode, fields: java.util.Map[String, JsonNode]): JsonNode = node.setAll(fields) + + protected def currentName(jp: JsonParser): String = jp.getCurrentName + } diff --git a/28/src/main/scala/io/circe/jackson/JacksonCompat.scala b/28/src/main/scala/io/circe/jackson/JacksonCompat.scala index d1100338..8514f3ad 100644 --- a/28/src/main/scala/io/circe/jackson/JacksonCompat.scala +++ b/28/src/main/scala/io/circe/jackson/JacksonCompat.scala @@ -1,7 +1,26 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import com.fasterxml.jackson.core.JsonParser -import com.fasterxml.jackson.databind.{ DeserializationContext, JsonNode, ObjectMapper, ObjectWriter } +import com.fasterxml.jackson.databind.DeserializationContext +import com.fasterxml.jackson.databind.JsonNode +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.ObjectWriter import com.fasterxml.jackson.databind.node.ObjectNode private[jackson] trait JacksonCompat { @@ -10,9 +29,13 @@ private[jackson] trait JacksonCompat { protected def handleUnexpectedToken(context: DeserializationContext)( klass: Class[_], parser: JsonParser - ): Unit = + ): Unit = { context.handleUnexpectedToken(klass, parser) + () + } protected def objectNodeSetAll(node: ObjectNode, fields: java.util.Map[String, JsonNode]): JsonNode = node.setAll(fields) + + protected def currentName(jp: JsonParser): String = jp.getCurrentName } diff --git a/benchmark/src/main/scala/io/circe/jackson/benchmark/Benchmark.scala b/benchmark/src/main/scala/io/circe/jackson/benchmark/Benchmark.scala index eedd5425..2e367140 100644 --- a/benchmark/src/main/scala/io/circe/jackson/benchmark/Benchmark.scala +++ b/benchmark/src/main/scala/io/circe/jackson/benchmark/Benchmark.scala @@ -1,12 +1,32 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson.benchmark import cats.Eq -import io.circe.{ Decoder, Encoder, Json => JsonC } +import io.circe.Decoder +import io.circe.Encoder import io.circe.generic.semiauto._ import io.circe.jawn._ +import io.circe.{ Json => JsonC } +import org.openjdk.jmh.annotations._ + import java.nio.ByteBuffer import java.util.concurrent.TimeUnit -import org.openjdk.jmh.annotations._ +import scala.annotation.nowarn case class Foo(s: String, d: Double, i: Int, l: Long, bs: List[Boolean]) @@ -46,15 +66,19 @@ class ExampleData { @OutputTimeUnit(TimeUnit.SECONDS) class ParsingBenchmark extends ExampleData { @Benchmark + @nowarn("cat=deprecation") def parseIntsC: JsonC = parse(intsJson).right.getOrElse(throw new Exception) @Benchmark + @nowarn("cat=deprecation") def parseIntsCJ: JsonC = io.circe.jackson.parse(intsJson).right.getOrElse(throw new Exception) @Benchmark + @nowarn("cat=deprecation") def parseFoosC: JsonC = parse(foosJson).right.getOrElse(throw new Exception) @Benchmark + @nowarn("cat=deprecation") def parseFoosCJ: JsonC = io.circe.jackson.parse(foosJson).right.getOrElse(throw new Exception) } diff --git a/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala b/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala index 881baa47..a7d1b3b9 100644 --- a/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala +++ b/benchmark/src/test/scala/io/circe/jackson/benchmark/ParsingBenchmarkSpec.scala @@ -1,8 +1,25 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson.benchmark import cats.instances.AllInstances -import io.circe.testing.{ ArbitraryInstances, EqInstances } -import cats.syntax.{ AllSyntax } +import cats.syntax.AllSyntax +import io.circe.testing.ArbitraryInstances +import io.circe.testing.EqInstances class ParsingBenchmarkSpec extends munit.FunSuite diff --git a/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala b/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala index eae08547..66d4bc07 100644 --- a/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala +++ b/benchmark/src/test/scala/io/circe/jackson/benchmark/PrintingBenchmarkSpec.scala @@ -1,9 +1,27 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson.benchmark import cats.instances.AllInstances -import io.circe.testing.{ ArbitraryInstances, EqInstances } -import cats.syntax.{ AllSyntax } +import cats.syntax.AllSyntax import io.circe.parser.decode +import io.circe.testing.ArbitraryInstances +import io.circe.testing.EqInstances + import java.nio.ByteBuffer class PrintingBenchmarkSpec diff --git a/build.sbt b/build.sbt index 7739df3a..cc07ff84 100644 --- a/build.sbt +++ b/build.sbt @@ -1,24 +1,20 @@ +import com.typesafe.tools.mima.core._ + ThisBuild / organization := "io.circe" -ThisBuild / crossScalaVersions := Seq("2.13.10", "2.12.17", "3.2.2") +ThisBuild / crossScalaVersions := Seq("2.13.14", "2.12.19", "3.3.3") ThisBuild / scalaVersion := crossScalaVersions.value.head ThisBuild / githubWorkflowPublishTargetBranches := Nil - -val compilerOptions = Seq( - "-deprecation", - "-encoding", - "UTF-8", - "-feature", - "-language:existentials", - "-language:higherKinds", - "-unchecked", - "-Ywarn-dead-code", - "-Ywarn-numeric-widen" -) - -val circeVersion = "0.14.1" -val munitVersion = "0.7.26" -val previousCirceJacksonVersion = "0.13.0" -val disciplineMunitVersion = "1.0.9" +ThisBuild / startYear := Some(2016) +ThisBuild / tlBaseVersion := "0.14" +ThisBuild / scalafixAll / skip := tlIsScala3.value +ThisBuild / ScalafixConfig / skip := tlIsScala3.value +ThisBuild / tlCiScalafixCheck := false // TODO: Address these in a follow up PR +ThisBuild / tlFatalWarnings := false // TODO: fix by dropping 2.12 + +val circeVersion = "0.14.9" +val munitVersion = "1.0.0" +val previousCirceJacksonVersion = "0.15.0" +val disciplineMunitVersion = "2.0.0" def priorTo2_13(scalaVersion: String): Boolean = CrossVersion.partialVersion(scalaVersion) match { @@ -27,42 +23,22 @@ def priorTo2_13(scalaVersion: String): Boolean = } val baseSettings = Seq( - scalacOptions ++= compilerOptions, - scalacOptions ++= ( - if (priorTo2_13(scalaVersion.value)) - Seq( - "-Xfuture", - "-Yno-adapted-args", - "-Ywarn-unused-import" - ) - else - Seq( - "-Ywarn-unused:imports" - ) - ), - Compile / console / scalacOptions ~= { - _.filterNot(Set("-Ywarn-unused-import")) - }, - Test / console / scalacOptions ~= { - _.filterNot(Set("-Ywarn-unused-import")) - }, - resolvers ++= Seq( - Resolver.sonatypeRepo("releases"), - Resolver.sonatypeRepo("snapshots") - ), + resolvers ++= Resolver.sonatypeOssRepos("releases"), + resolvers ++= Resolver.sonatypeOssRepos("snapshots"), coverageHighlighting := true, - coverageEnabled := (if (scalaVersion.value.startsWith("3")) false else coverageEnabled.value), - (Compile / scalastyleSources) ++= (Compile / unmanagedSourceDirectories).value, + coverageEnabled := !tlIsScala3.value, libraryDependencies ++= Seq( "io.circe" %% "circe-core" % circeVersion, + "org.scala-lang.modules" %% "scala-collection-compat" % "2.12.0", "io.circe" %% "circe-jawn" % circeVersion % Test, "io.circe" %% "circe-testing" % circeVersion % Test, - "org.typelevel" %% "discipline-munit" % disciplineMunitVersion % Test + "org.typelevel" %% "discipline-munit" % disciplineMunitVersion % Test, + "org.scalameta" %% "munit" % munitVersion % Test, + "org.scalameta" %% "munit-scalacheck" % munitVersion % Test ), Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "shared/src/main", Test / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "shared/src/test", Test / unmanagedResourceDirectories += (ThisBuild / baseDirectory).value / "shared/src/test/resources", - testFrameworks += new TestFramework("munit.Framework"), Test / classLoaderLayeringStrategy := ClassLoaderLayeringStrategy.AllLibraryJars ) @@ -74,12 +50,33 @@ def jacksonDependencies(version: String, databindVersion: Option[String] = None) "com.fasterxml.jackson.core" % "jackson-databind" % databindVersion.getOrElse(version) ) -val allSettings = baseSettings ++ publishSettings +val mimaSettings = Seq( + mimaBinaryIssueFilters ++= Seq( + ProblemFilters.exclude[MissingClassProblem]("io.circe.jackson.package$EnhancedByteArrayOutputStream") + ) +) + +val allSettings = baseSettings ++ publishSettings ++ mimaSettings val root = project .in(file(".")) .settings(allSettings ++ noPublishSettings) - .aggregate(jackson25, jackson26, jackson27, jackson28, jackson29, jackson210, jackson211, jackson212, jackson213, benchmark) + .aggregate( + jackson26, + jackson26, + jackson27, + jackson28, + jackson29, + jackson210, + jackson211, + jackson212, + jackson213, + jackson214, + jackson215, + jackson216, + jackson217, + benchmark + ) .dependsOn(jackson210) lazy val jackson25 = project @@ -87,8 +84,7 @@ lazy val jackson25 = project .settings(allSettings) .settings( moduleName := "circe-jackson25", - libraryDependencies ++= jacksonDependencies("2.5.5"), - mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson25" % previousCirceJacksonVersion) + libraryDependencies ++= jacksonDependencies("2.5.5") ) lazy val jackson26 = project @@ -97,8 +93,7 @@ lazy val jackson26 = project .settings( moduleName := "circe-jackson26", libraryDependencies ++= jacksonDependencies("2.6.7", Some("2.6.7.5")), - Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "27", - mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson26" % previousCirceJacksonVersion) + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "27" ) lazy val jackson27 = project @@ -106,20 +101,15 @@ lazy val jackson27 = project .settings(allSettings) .settings( moduleName := "circe-jackson27", - libraryDependencies ++= jacksonDependencies("2.7.9", Some("2.7.9.7")), - mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson27" % previousCirceJacksonVersion) + libraryDependencies ++= jacksonDependencies("2.7.9", Some("2.7.9.7")) ) lazy val jackson28 = project .in(file("28")) - .enablePlugins(GhpagesPlugin) .settings(allSettings) .settings( moduleName := "circe-jackson28", libraryDependencies ++= jacksonDependencies("2.8.11", Some("2.8.11.6")), - docMappingsApiDir := "api", - addMappingsToSiteDir(Compile / packageDoc / mappings, docMappingsApiDir), - ghpagesNoJekyll := true, Compile / doc / scalacOptions ++= Seq( "-groups", "-implicits", @@ -128,10 +118,8 @@ lazy val jackson28 = project "-sourcepath", (LocalRootProject / baseDirectory).value.getAbsolutePath ), - git.remoteRepo := "git@github.com:circe/circe-jackson.git", autoAPIMappings := true, - apiURL := Some(url("https://circe.github.io/circe-jackson/api/")), - mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson28" % previousCirceJacksonVersion) + apiURL := Some(url("https://circe.github.io/circe-jackson/api/")) ) lazy val jackson29 = project @@ -140,8 +128,7 @@ lazy val jackson29 = project .settings( moduleName := "circe-jackson29", libraryDependencies ++= jacksonDependencies("2.9.10", Some("2.9.10.8")), - Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "28", - mimaPreviousArtifacts := Set("io.circe" %% "circe-jackson29" % previousCirceJacksonVersion) + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "28" ) lazy val jackson210 = project @@ -167,7 +154,7 @@ lazy val jackson212 = project .settings(allSettings) .settings( moduleName := "circe-jackson212", - libraryDependencies ++= jacksonDependencies("2.12.5"), + libraryDependencies ++= jacksonDependencies("2.12.7"), Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" ) @@ -176,8 +163,48 @@ lazy val jackson213 = project .settings(allSettings) .settings( moduleName := "circe-jackson213", - libraryDependencies ++= jacksonDependencies("2.13.0"), - Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210" + libraryDependencies ++= jacksonDependencies("2.13.5"), + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210", + tlVersionIntroduced := List("2.12", "2.13", "3").map(k => k -> "0.14.2").toMap + ) + +lazy val jackson214 = project + .in(file("214")) + .settings(allSettings) + .settings( + moduleName := "circe-jackson214", + libraryDependencies ++= jacksonDependencies("2.14.3"), + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210", + tlVersionIntroduced := List("2.12", "2.13", "3").map(k => k -> "0.14.2").toMap + ) +lazy val jackson215 = project + .in(file("215")) + .settings(allSettings) + .settings( + moduleName := "circe-jackson215", + libraryDependencies ++= jacksonDependencies("2.15.4"), + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210", + tlVersionIntroduced := List("2.12", "2.13", "3").map(k => k -> "0.14.2").toMap + ) + +lazy val jackson216 = project + .in(file("216")) + .settings(allSettings) + .settings( + moduleName := "circe-jackson216", + libraryDependencies ++= jacksonDependencies("2.16.2"), + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210", + tlVersionIntroduced := List("2.12", "2.13", "3").map(k => k -> "0.14.2").toMap + ) + +lazy val jackson217 = project + .in(file("217")) + .settings(allSettings) + .settings( + moduleName := "circe-jackson217", + libraryDependencies ++= jacksonDependencies("2.17.1"), + Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "210", + tlVersionIntroduced := List("2.12", "2.13", "3").map(k => k -> "0.14.2").toMap ) lazy val benchmark = project @@ -193,7 +220,7 @@ lazy val benchmark = project ) ) .enablePlugins(JmhPlugin) - .dependsOn(jackson213) + .dependsOn(jackson217) lazy val noPublishSettings = Seq( publish := {}, @@ -202,45 +229,13 @@ lazy val noPublishSettings = Seq( ) lazy val publishSettings = Seq( - releaseCrossBuild := true, - releasePublishArtifactsAction := PgpKeys.publishSigned.value, - releaseVcsSign := true, homepage := Some(url("https://github.com/circe/circe-jackson")), - licenses := Seq("Apache 2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0")), publishMavenStyle := true, Test / publishArtifact := false, pomIncludeRepository := { _ => false }, - publishTo := { - val nexus = "https://oss.sonatype.org/" - if (isSnapshot.value) - Some("snapshots".at(nexus + "content/repositories/snapshots")) - else - Some("releases".at(nexus + "service/local/staging/deploy/maven2")) - }, - scmInfo := Some( - ScmInfo( - url("https://github.com/circe/circe-jackson"), - "scm:git:git@github.com:circe/circe-jackson.git" - ) - ), developers := List( - Developer( - "travisbrown", - "Travis Brown", - "travisrobertbrown@gmail.com", - url("https://twitter.com/travisbrown") - ) + tlGitHubDev("travisbrown", "Travis Brown"), + tlGitHubDev("zathross", "Darren Gibson"), + tlGitHubDev("hamnis", "Erlend Hamnaberg") ) ) - -credentials ++= ( - for { - username <- Option(System.getenv().get("SONATYPE_USERNAME")) - password <- Option(System.getenv().get("SONATYPE_PASSWORD")) - } yield Credentials( - "Sonatype Nexus Repository Manager", - "oss.sonatype.org", - username, - password - ) -).toSeq diff --git a/project/build.properties b/project/build.properties index 72413de1..081fdbbc 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1 +1 @@ -sbt.version=1.8.3 +sbt.version=1.10.0 diff --git a/project/plugins.sbt b/project/plugins.sbt index 45559bac..6a3ecf9e 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -1,11 +1,4 @@ -addSbtPlugin("com.codecommit" % "sbt-github-actions" % "0.13.0") -addSbtPlugin("com.github.sbt" % "sbt-release" % "1.1.0") -addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.3") -addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1") -addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3") -addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.2") -addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.1") -addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.5.2") -addSbtPlugin("org.scalastyle" %% "scalastyle-sbt-plugin" % "1.0.0") +addSbtPlugin("io.circe" % "sbt-circe-org" % "0.4.1") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.9.3") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.6") +addSbtPlugin("com.timushev.sbt" % "sbt-rewarn" % "0.1.3") diff --git a/scalastyle-config.xml b/scalastyle-config.xml deleted file mode 100644 index ee8b24d7..00000000 --- a/scalastyle-config.xml +++ /dev/null @@ -1,85 +0,0 @@ - - Circe Configuration - - - FOR - IF - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - all - .+ - - - diff --git a/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala b/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala index d0325ae1..15259850 100644 --- a/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala +++ b/shared/src/main/scala/io/circe/jackson/CirceJsonDeserializer.scala @@ -1,12 +1,34 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson -import com.fasterxml.jackson.core.{ JsonParser, JsonTokenId } -import com.fasterxml.jackson.databind.{ DeserializationContext, JsonDeserializer } +import com.fasterxml.jackson.core.JsonParser +import com.fasterxml.jackson.core.JsonTokenId +import com.fasterxml.jackson.databind.DeserializationContext +import com.fasterxml.jackson.databind.JsonDeserializer import com.fasterxml.jackson.databind.`type`.TypeFactory -import io.circe.{ Json, JsonBigDecimal } +import io.circe.Json +import io.circe.JsonBigDecimal + import java.util.ArrayList -import scala.annotation.{ switch, tailrec } -import scala.collection.JavaConverters._ +import scala.annotation.nowarn +import scala.annotation.switch +import scala.annotation.tailrec +import scala.jdk.CollectionConverters._ private[jackson] sealed trait DeserializerContext { def addValue(value: Json): DeserializerContext @@ -30,7 +52,7 @@ private[jackson] final case class ReadingMap(content: ArrayList[(String, Json)]) throw new Exception("Cannot add a value on an object without a key, malformed JSON object!") } -private[jackson] final class CirceJsonDeserializer(factory: TypeFactory, klass: Class[_]) +private[jackson] final class CirceJsonDeserializer(@nowarn factory: TypeFactory, klass: Class[_]) extends JsonDeserializer[Object] with JacksonCompat { override final def isCachable: Boolean = true @@ -48,7 +70,10 @@ private[jackson] final class CirceJsonDeserializer(factory: TypeFactory, klass: ctxt: DeserializationContext, parserContext: List[DeserializerContext] ): Json = { - if (jp.getCurrentToken == null) jp.nextToken() + if (jp.getCurrentToken == null) { + jp.nextToken() + () + } val (maybeValue, nextContext) = (jp.getCurrentToken.id(): @switch) match { case JsonTokenId.ID_NUMBER_INT | JsonTokenId.ID_NUMBER_FLOAT => @@ -71,8 +96,8 @@ private[jackson] final class CirceJsonDeserializer(factory: TypeFactory, klass: case JsonTokenId.ID_FIELD_NAME => parserContext match { - case (c: ReadingMap) :: stack => (None, c.setField(jp.getCurrentName) +: stack) - case _ => throw new RuntimeException("We weren't reading an object, something went wrong") + case (c: ReadingMap) :: stack => (None, c.setField(currentName(jp)) +: stack) + case _ => throw new RuntimeException("We weren't reading an object, something went wrong") } case JsonTokenId.ID_END_OBJECT => @@ -97,8 +122,11 @@ private[jackson] final class CirceJsonDeserializer(factory: TypeFactory, klass: case maybeValue => jp.nextToken() val toPass = maybeValue.map { v => - val previous :: stack = nextContext - (previous.addValue(v)) +: stack + nextContext match { + case previous :: stack => + (previous.addValue(v)) +: stack + case Nil => nextContext + } }.getOrElse(nextContext) deserialize(jp, ctxt, toPass) diff --git a/shared/src/main/scala/io/circe/jackson/CirceJsonModule.scala b/shared/src/main/scala/io/circe/jackson/CirceJsonModule.scala index 0e73f0b8..0c32d4c4 100644 --- a/shared/src/main/scala/io/circe/jackson/CirceJsonModule.scala +++ b/shared/src/main/scala/io/circe/jackson/CirceJsonModule.scala @@ -1,20 +1,34 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import com.fasterxml.jackson.core.Version -import com.fasterxml.jackson.databind.{ - BeanDescription, - DeserializationConfig, - JavaType, - JsonSerializer, - SerializationConfig -} +import com.fasterxml.jackson.databind.BeanDescription +import com.fasterxml.jackson.databind.DeserializationConfig +import com.fasterxml.jackson.databind.JavaType +import com.fasterxml.jackson.databind.JsonSerializer import com.fasterxml.jackson.databind.Module.SetupContext +import com.fasterxml.jackson.databind.SerializationConfig import com.fasterxml.jackson.databind.deser.Deserializers import com.fasterxml.jackson.databind.module.SimpleModule import com.fasterxml.jackson.databind.ser.Serializers import io.circe.Json -final object CirceJsonModule extends SimpleModule("CirceJson", Version.unknownVersion()) { +object CirceJsonModule extends SimpleModule("CirceJson", Version.unknownVersion()) { override final def setupModule(context: SetupContext): Unit = { context.addDeserializers( new Deserializers.Base { diff --git a/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala b/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala index 1f2d294b..5184b578 100644 --- a/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala +++ b/shared/src/main/scala/io/circe/jackson/CirceJsonSerializer.scala @@ -1,10 +1,33 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import com.fasterxml.jackson.core.JsonGenerator -import com.fasterxml.jackson.databind.{ JsonSerializer, SerializerProvider } -import io.circe.{ Json, JsonBigDecimal, JsonBiggerDecimal, JsonDecimal, JsonDouble, JsonFloat, JsonLong } +import com.fasterxml.jackson.databind.JsonSerializer +import com.fasterxml.jackson.databind.SerializerProvider +import io.circe.Json +import io.circe.JsonBigDecimal +import io.circe.JsonBiggerDecimal +import io.circe.JsonDecimal +import io.circe.JsonDouble +import io.circe.JsonFloat +import io.circe.JsonLong -private[jackson] final object CirceJsonSerializer extends JsonSerializer[Json] { +private[jackson] object CirceJsonSerializer extends JsonSerializer[Json] { import java.math.{ BigDecimal => JBigDecimal, BigInteger } import com.fasterxml.jackson.databind.node.{ BigIntegerNode, DecimalNode } @@ -26,7 +49,7 @@ private[jackson] final object CirceJsonSerializer extends JsonSerializer[Json] { // configuration is ignored when called from ObjectMapper.valueToTree val raw = x.stripTrailingZeros.toPlainString - if (raw contains ".") json.writeTree(new DecimalNode(new JBigDecimal(raw))) + if (raw.contains(".")) json.writeTree(new DecimalNode(new JBigDecimal(raw))) else json.writeTree(new BigIntegerNode(new BigInteger(raw))) } case Json.JString(v) => json.writeString(v) diff --git a/shared/src/main/scala/io/circe/jackson/JacksonParser.scala b/shared/src/main/scala/io/circe/jackson/JacksonParser.scala index a7a8bafc..06d55172 100644 --- a/shared/src/main/scala/io/circe/jackson/JacksonParser.scala +++ b/shared/src/main/scala/io/circe/jackson/JacksonParser.scala @@ -1,7 +1,28 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import cats.data.ValidatedNel -import io.circe.{ Decoder, Error, Json, Parser, ParsingFailure } +import io.circe.Decoder +import io.circe.Error +import io.circe.Json +import io.circe.Parser +import io.circe.ParsingFailure + import java.io.File import scala.util.control.NonFatal diff --git a/shared/src/main/scala/io/circe/jackson/WithJacksonMapper.scala b/shared/src/main/scala/io/circe/jackson/WithJacksonMapper.scala index c0b72d02..29e0eb99 100644 --- a/shared/src/main/scala/io/circe/jackson/WithJacksonMapper.scala +++ b/shared/src/main/scala/io/circe/jackson/WithJacksonMapper.scala @@ -1,8 +1,27 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson -import com.fasterxml.jackson.core.{ JsonFactory, JsonParser } +import com.fasterxml.jackson.core.JsonFactory +import com.fasterxml.jackson.core.JsonParser import com.fasterxml.jackson.databind.ObjectMapper -import java.io.{ File, Writer } + +import java.io.File +import java.io.Writer class WithJacksonMapper { final val mapper: ObjectMapper = (new ObjectMapper).registerModule(CirceJsonModule) diff --git a/shared/src/main/scala/io/circe/jackson/package.scala b/shared/src/main/scala/io/circe/jackson/package.scala index 5f922a5c..174944a4 100644 --- a/shared/src/main/scala/io/circe/jackson/package.scala +++ b/shared/src/main/scala/io/circe/jackson/package.scala @@ -1,11 +1,29 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe import com.fasterxml.jackson.databind.JsonNode import com.fasterxml.jackson.databind.node._ + import java.io._ import java.math.{ BigDecimal => JBigDecimal } import java.nio.ByteBuffer -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ +import scala.collection.compat._ /** * Support for Jackson-powered parsing and printing for circe. @@ -32,10 +50,6 @@ package object jackson extends WithJacksonMapper with JacksonParser with Jackson sw.toString } - private[this] class EnhancedByteArrayOutputStream extends ByteArrayOutputStream { - def toByteBuffer: ByteBuffer = ByteBuffer.wrap(this.buf, 0, this.size) - } - final def jacksonPrintByteBuffer(json: Json): ByteBuffer = { val bytes = new EnhancedByteArrayOutputStream writeJson(new BufferedWriter(new OutputStreamWriter(bytes, "UTF-8")), json) @@ -70,12 +84,13 @@ package object jackson extends WithJacksonMapper with JacksonParser with Jackson try { DecimalNode.valueOf(new JBigDecimal(x)) } catch { - case nfe: NumberFormatException => TextNode.valueOf(x) + case _: NumberFormatException => TextNode.valueOf(x) } }, TextNode.valueOf(_), - array => JsonNodeFactory.instance.arrayNode.addAll(array.map(circeToJackson).asJava), - obj => objectNodeSetAll(JsonNodeFactory.instance.objectNode, obj.toMap.mapValues(circeToJackson).toMap.asJava) + array => JsonNodeFactory.instance.arrayNode.addAll(array.map(circeToJackson(_)).asJava), + obj => + objectNodeSetAll(JsonNodeFactory.instance.objectNode, obj.toMap.view.mapValues(circeToJackson(_)).toMap.asJava) ) /** @@ -95,10 +110,16 @@ package object jackson extends WithJacksonMapper with JacksonParser with Jackson Json.fromBigInt(node.bigIntegerValue) } case JsonNodeType.ARRAY => - Json.fromValues(node.elements.asScala.map(jacksonToCirce).toIterable) + Json.fromValues(node.elements.asScala.map(jacksonToCirce(_)).to(Iterable)) case JsonNodeType.OBJECT => - Json.fromFields(node.fields.asScala.map(m => (m.getKey, jacksonToCirce(m.getValue))).toIterable) + Json.fromFields(node.fields.asScala.map(m => (m.getKey, jacksonToCirce(m.getValue))).to(Iterable)) case _ => Json.Null } } + +package jackson { + private[jackson] class EnhancedByteArrayOutputStream extends ByteArrayOutputStream { + def toByteBuffer: ByteBuffer = ByteBuffer.wrap(this.buf, 0, this.size) + } +} diff --git a/shared/src/main/scala/io/circe/jackson/syntax/package.scala b/shared/src/main/scala/io/circe/jackson/syntax/package.scala index 60ee523f..3df85196 100644 --- a/shared/src/main/scala/io/circe/jackson/syntax/package.scala +++ b/shared/src/main/scala/io/circe/jackson/syntax/package.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import io.circe.Json diff --git a/shared/src/test/scala/io/circe/jackson/CirceSuite.scala b/shared/src/test/scala/io/circe/jackson/CirceSuite.scala index 1431746d..817db95a 100644 --- a/shared/src/test/scala/io/circe/jackson/CirceSuite.scala +++ b/shared/src/test/scala/io/circe/jackson/CirceSuite.scala @@ -1,11 +1,28 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import cats.instances.AllInstances -import cats.syntax.{ AllSyntax, EitherOps } +import cats.syntax.AllSyntax +import cats.syntax.EitherOps import io.circe.Json -import io.circe.testing.{ ArbitraryInstances, EqInstances } +import io.circe.testing.ArbitraryInstances +import io.circe.testing.EqInstances import munit.ScalaCheckSuite -import scala.language.implicitConversions /** * An opinionated stack of traits to improve consistency and reduce boilerplate in circe tests. diff --git a/shared/src/test/scala/io/circe/jackson/ConvertingSuite.scala b/shared/src/test/scala/io/circe/jackson/ConvertingSuite.scala index e9cd08a9..f1ea589f 100644 --- a/shared/src/test/scala/io/circe/jackson/ConvertingSuite.scala +++ b/shared/src/test/scala/io/circe/jackson/ConvertingSuite.scala @@ -1,3 +1,19 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import org.scalacheck.Prop diff --git a/shared/src/test/scala/io/circe/jackson/JacksonInstances.scala b/shared/src/test/scala/io/circe/jackson/JacksonInstances.scala index 8d3ef3f4..07c88439 100644 --- a/shared/src/test/scala/io/circe/jackson/JacksonInstances.scala +++ b/shared/src/test/scala/io/circe/jackson/JacksonInstances.scala @@ -1,16 +1,44 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import cats.Eq import cats.instances.list._ import cats.instances.map._ -import io.circe.{ Json, JsonBigDecimal, JsonBiggerDecimal, JsonDecimal, JsonDouble, JsonFloat, JsonLong, JsonNumber } -import io.circe.Json.{ JArray, JNumber, JObject, JString } +import io.circe.Json +import io.circe.Json.JArray +import io.circe.Json.JNumber +import io.circe.Json.JObject +import io.circe.Json.JString +import io.circe.JsonBigDecimal +import io.circe.JsonBiggerDecimal +import io.circe.JsonDecimal +import io.circe.JsonDouble +import io.circe.JsonFloat +import io.circe.JsonLong +import io.circe.JsonNumber import io.circe.numbers.BiggerDecimal -import io.circe.testing.ArbitraryInstances import org.scalacheck.Arbitrary -import scala.util.matching.Regex -import scala.util.Try + import java.nio.ByteBuffer +import scala.util.Try + +import io.circe.testing.ArbitraryInstances +import scala.util.matching.Regex trait JacksonInstances { this: ArbitraryInstances => diff --git a/shared/src/test/scala/io/circe/jackson/JacksonParserSuite.scala b/shared/src/test/scala/io/circe/jackson/JacksonParserSuite.scala index 3c245e38..ddc3cb4b 100644 --- a/shared/src/test/scala/io/circe/jackson/JacksonParserSuite.scala +++ b/shared/src/test/scala/io/circe/jackson/JacksonParserSuite.scala @@ -1,14 +1,33 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import cats.data.Validated import com.fasterxml.jackson.core.JsonToken -import com.fasterxml.jackson.databind.{ ObjectMapper, ObjectReader } +import com.fasterxml.jackson.databind.ObjectMapper +import com.fasterxml.jackson.databind.ObjectReader import io.circe.Json import io.circe.testing.ParserTests -import java.io.{ ByteArrayInputStream, File } +import munit.DisciplineSuite import org.scalacheck.Prop + +import java.io.ByteArrayInputStream +import java.io.File import scala.io.Source -import munit.DisciplineSuite class JacksonParserSuite extends CirceSuite with DisciplineSuite with JacksonInstances { diff --git a/shared/src/test/scala/io/circe/jackson/JacksonPrintingSuite.scala b/shared/src/test/scala/io/circe/jackson/JacksonPrintingSuite.scala index ee0bec42..f93379bc 100644 --- a/shared/src/test/scala/io/circe/jackson/JacksonPrintingSuite.scala +++ b/shared/src/test/scala/io/circe/jackson/JacksonPrintingSuite.scala @@ -1,9 +1,26 @@ +/* + * Copyright 2016 circe + * + * 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-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + package io.circe.jackson import io.circe.Json -import java.nio.ByteBuffer import org.scalacheck.Prop.forAll +import java.nio.ByteBuffer + class JacksonPrintingSuite extends CirceSuite with JacksonInstances { property("jacksonPrint should produce round-trippable output") { forAll { (json: Json) => diff --git a/version.sbt b/version.sbt deleted file mode 100644 index f3d98ff2..00000000 --- a/version.sbt +++ /dev/null @@ -1 +0,0 @@ -ThisBuild / version := "0.14.1-SNAPSHOT"