Skip to content

Commit

Permalink
fix more warning
Browse files Browse the repository at this point in the history
  • Loading branch information
hamnis committed Jun 24, 2024
1 parent 80944e5 commit 56c5323
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import org.openjdk.jmh.annotations._

import java.nio.ByteBuffer
import java.util.concurrent.TimeUnit
import scala.annotation.nowarn

case class Foo(s: String, d: Double, i: Int, l: Long, bs: List[Boolean])

Expand Down Expand Up @@ -65,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)
}

Expand Down
6 changes: 3 additions & 3 deletions shared/src/main/scala/io/circe/jackson/package.scala
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ package object jackson extends WithJacksonMapper with JacksonParser with Jackson
},
TextNode.valueOf(_),
array => JsonNodeFactory.instance.arrayNode.addAll(array.map(circeToJackson).asJava),
obj => objectNodeSetAll(JsonNodeFactory.instance.objectNode, obj.toMap.mapValues(circeToJackson).toMap.asJava)
obj => objectNodeSetAll(JsonNodeFactory.instance.objectNode, obj.toMap.view.mapValues(circeToJackson).toMap.asJava)
)

/**
Expand All @@ -108,9 +108,9 @@ 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).iterator.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))).iterator.to(Iterable))
case _ => Json.Null
}

Expand Down

0 comments on commit 56c5323

Please sign in to comment.