Resolving incompatibilities in 2.13.2
Changes to undo binary incompatibility changes.
MODIFY
pom.xml
pom.xml
<plugin>
<groupId>com.github.siom79.japicmp</groupId>
<artifactId>japicmp-maven-plugin</artifactId>
- <version>0.15.3</version>
+ <version>0.15.7</version>
<configuration>
<oldVersion>
<dependency>
<groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-kotlin</artifactId>
- <version>2.13.0</version>
+ <version>2.13.1</version>
<type>jar</type>
</dependency>
</oldVersion>

MODIFY
src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinSerializers.kt
src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinSerializers.kt
@@ -49,13 +49,12 @@ object ULongSerializer : StdSerializer<ULong>(ULong::class.java) {
private fun Class<*>.getStaticJsonValueGetter(): Method? = this.declaredMethods
.find { method -> Modifier.isStatic(method.modifiers) && method.annotations.any { it is JsonValue } }
-internal sealed class ValueClassSerializer<T : Any>(t: Class<T>) : StdSerializer<T>(t) {
- object Unbox : ValueClassSerializer<Any>(Any::class.java) {
+object ValueClassUnboxSerializer : StdSerializer<Any>(Any::class.java) {
override fun serialize(value: Any, gen: JsonGenerator, provider: SerializerProvider) {
val unboxed = value::class.java.getMethod("unbox-impl").invoke(value)
if (unboxed == null) {
- provider.findNullValueSerializer(null).serialize(unboxed, gen, provider)
+ provider.findNullValueSerializer(null).serialize(null, gen, provider)
return
}
@@ -63,6 +62,7 @@ internal sealed class ValueClassSerializer<T : Any>(t: Class<T>) : StdSerializer
}
}
+internal sealed class ValueClassSerializer<T : Any>(t: Class<T>) : StdSerializer<T>(t) {
class StaticJsonValue<T : Any>(
t: Class<T>, private val staticJsonValueGetter: Method
) : ValueClassSerializer<T>(t) {
@@ -83,9 +83,9 @@ internal sealed class ValueClassSerializer<T : Any>(t: Class<T>) : StdSerializer
// If create a function with a JsonValue in the value class,
// it will be compiled as a static method (= cannot be processed properly by Jackson),
// so use a ValueClassSerializer.StaticJsonValue to handle this.
- fun from(t: Class<*>): ValueClassSerializer<*> = t.getStaticJsonValueGetter()
+ fun from(t: Class<*>): StdSerializer<*> = t.getStaticJsonValueGetter()
?.let { StaticJsonValue(t, it) }
- ?: Unbox
+ ?: ValueClassUnboxSerializer
}
}

Resolving incompatibilities in 2.13.2 (#551)

Changes to undo binary incompatibility changes.