You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We just moved from jackson 2.11.4 to 2.13.0, and we found a performance bug. It seems like ScalaObjectMapper is calling the serialize method twice. We'd like to switch to ClassTagExtensions, but we depend heavily on ScalaObjectMapper, and want to be on a stable version that has both ScalaObjectMapper as well as ClassTagExtensions before we migrate.
Can you please fix this regression in a patch release?
Reproduction case:
import com.fasterxml.jackson.core.JsonGenerator
import com.fasterxml.jackson.databind.JsonNode
import com.fasterxml.jackson.databind.ObjectMapper
import com.fasterxml.jackson.databind.SerializerProvider
import com.fasterxml.jackson.databind.module.SimpleModule
import com.fasterxml.jackson.databind.ser.std.StdSerializer
import com.fasterxml.jackson.module.scala.DefaultScalaModule
import com.fasterxml.jackson.module.scala.ScalaObjectMapper
import org.scalatest.funsuite.AnyFunSuite
import org.scalatest.matchers.should.Matchers
import org.scalatestplus.scalacheck.Checkers
import org.scalatestplus.scalacheck.ScalaCheckDrivenPropertyChecks
final case class DerpWrapper(derps: Seq[Derp])
final case class Derp(var one: Long) {
var serializationCounter = 0
}
class JacksonUpgradeTest
extends AnyFunSuite
with ScalaCheckDrivenPropertyChecks
with Checkers
with Matchers {
private object DerpModule extends SimpleModule {
private object DerpResponseSerializer extends StdSerializer[Derp](classOf[Derp]) {
override def serialize(
value: Derp,
gen: JsonGenerator,
provider: SerializerProvider
): Unit = {
value.serializationCounter = value.serializationCounter + 1
}
}
addSerializer(DerpResponseSerializer)
}
val mapper: ObjectMapper with ScalaObjectMapper = {
val m = new ObjectMapper with ScalaObjectMapper
m.registerModule(DefaultScalaModule)
.registerModule(DerpModule)
m
}
test("jackson test") {
val derps = DerpWrapper(Seq(Derp(1)))
mapper.valueToTree[JsonNode](derps)
// the serializer should only be called once, but is getting called twice
derps.derps.head.serializationCounter should equal(1)
}
}
The text was updated successfully, but these errors were encountered:
We just moved from jackson 2.11.4 to 2.13.0, and we found a performance bug. It seems like ScalaObjectMapper is calling the serialize method twice. We'd like to switch to ClassTagExtensions, but we depend heavily on ScalaObjectMapper, and want to be on a stable version that has both ScalaObjectMapper as well as ClassTagExtensions before we migrate.
Can you please fix this regression in a patch release?
Reproduction case:
The text was updated successfully, but these errors were encountered: