From 5d9b9a822c725a38f468ee30c33e4647e7138e0e Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 11:37:32 +0900 Subject: [PATCH 1/7] Update kogera version --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 7000ab8..8673ad9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,7 +16,7 @@ val jacksonVersion = libs.versions.jackson.get() val generatedSrcPath = "${layout.buildDirectory.get()}/generated/kotlin" group = groupStr -version = "${jacksonVersion}-beta11" +version = "${jacksonVersion}-beta12" repositories { mavenCentral() From edab5f3d3b6d34745c5151c306013ca49e0a668d Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sat, 2 Mar 2024 22:06:37 +0900 Subject: [PATCH 2/7] Removal of useless processing It was a code that was forgotten to erase the process during the transition of the method. --- .../deser/valueInstantiator/argumentBucket/ArgumentBucket.kt | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/argumentBucket/ArgumentBucket.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/argumentBucket/ArgumentBucket.kt index 0eaaddc..10e2a14 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/argumentBucket/ArgumentBucket.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/argumentBucket/ArgumentBucket.kt @@ -111,9 +111,6 @@ internal class ArgumentBucket( // Since there is no multiple initialization in the use case, the key check is omitted. arguments[index] = actualArg - val maskIndex = index / Integer.SIZE - masks[maskIndex] = masks[maskIndex] and BIT_FLAGS[index % Integer.SIZE] - masks.update(index, MaskOperation.SET) } From cb77d117cdaacfb27c0f9c8039927b638cf93dfd Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Wed, 20 Mar 2024 13:35:30 +0900 Subject: [PATCH 3/7] Fixed to not use javaPrimitiveType The result is the same as a call to java, but there is an overhead. --- .../module/kogera/ClosedRangeSupport.kt | 4 ++-- .../jackson/module/kogera/InternalCommons.kt | 18 +++++++++--------- .../creator/ConstructorValueCreator.kt | 2 +- .../creator/MethodValueCreator.kt | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ClosedRangeSupport.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ClosedRangeSupport.kt index 7921700..9cbd8fc 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ClosedRangeSupport.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ClosedRangeSupport.kt @@ -55,8 +55,8 @@ internal object ClosedRangeResolver : SimpleAbstractTypeResolver() { } fun findClosedFloatingPointRangeRef(contentType: Class<*>): Class<*>? = when (contentType) { - Double::class.javaPrimitiveType, Double::class.javaObjectType -> closedDoubleRangeRef - Float::class.javaPrimitiveType, Float::class.javaObjectType -> closedFloatRangeRef + Double::class.java, Double::class.javaObjectType -> closedDoubleRangeRef + Float::class.java, Float::class.javaObjectType -> closedFloatRangeRef else -> null } diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt index 63f29a1..18af93a 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt @@ -24,15 +24,15 @@ internal fun Class<*>.isUnboxableValueClass() = this.isAnnotationPresent(JvmInli internal fun JmClass.wrapsNullValueClass() = inlineClassUnderlyingType!!.isNullable private val primitiveClassToDesc = mapOf( - Byte::class.javaPrimitiveType to 'B', - Char::class.javaPrimitiveType to 'C', - Double::class.javaPrimitiveType to 'D', - Float::class.javaPrimitiveType to 'F', - Int::class.javaPrimitiveType to 'I', - Long::class.javaPrimitiveType to 'J', - Short::class.javaPrimitiveType to 'S', - Boolean::class.javaPrimitiveType to 'Z', - Void::class.javaPrimitiveType to 'V' + Byte::class.java to 'B', + Char::class.java to 'C', + Double::class.java to 'D', + Float::class.java to 'F', + Int::class.java to 'I', + Long::class.java to 'J', + Short::class.java to 'S', + Boolean::class.java to 'Z', + Void.TYPE to 'V' ) // -> this.name.replace(".", "/") diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/creator/ConstructorValueCreator.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/creator/ConstructorValueCreator.kt index 1efaeb3..7cc5ac5 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/creator/ConstructorValueCreator.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/creator/ConstructorValueCreator.kt @@ -45,7 +45,7 @@ internal class ConstructorValueCreator( val parameterSize = it.size val temp = it.copyOf(parameterSize + maskSize + 1) for (i in 0 until maskSize) { - temp[it.size + i] = Int::class.javaPrimitiveType + temp[it.size + i] = Int::class.java } temp[parameterSize + maskSize] = defaultConstructorMarker diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/creator/MethodValueCreator.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/creator/MethodValueCreator.kt index c1410f9..88c79d1 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/creator/MethodValueCreator.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/creator/MethodValueCreator.kt @@ -50,7 +50,7 @@ internal class MethodValueCreator( temp[0] = companionObjectClass // companion object parameterTypes.copyInto(temp, 1) // parameter types for (i in (valueParameterSize + 1)..(valueParameterSize + maskSize)) { // masks - temp[i] = Int::class.javaPrimitiveType + temp[i] = Int::class.java } temp[valueParameterSize + maskSize + 1] = Object::class.java // maker temp From 3f4635912392c4da73bfb9cef3cc2281ef157653 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Wed, 20 Mar 2024 13:39:45 +0900 Subject: [PATCH 4/7] Fixed to use cached Java Class To improve performance on the first run. --- .../module/kogera/ClosedRangeSupport.kt | 2 +- .../jackson/module/kogera/InternalCommons.kt | 22 ++++++++++++++++--- .../module/kogera/KotlinClassIntrospector.kt | 4 ++-- .../jackson/module/kogera/ReflectionCache.kt | 2 +- .../KotlinFallbackAnnotationIntrospector.kt | 10 +++++---- .../KotlinPrimaryAnnotationIntrospector.kt | 3 ++- .../creator/MethodValueCreator.kt | 3 ++- .../jackson/module/kogera/ser/Converters.kt | 3 ++- 8 files changed, 35 insertions(+), 14 deletions(-) diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ClosedRangeSupport.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ClosedRangeSupport.kt index 9cbd8fc..397caf7 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ClosedRangeSupport.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ClosedRangeSupport.kt @@ -67,7 +67,7 @@ internal object ClosedRangeResolver : SimpleAbstractTypeResolver() { override fun findTypeMapping(config: DeserializationConfig, type: JavaType): JavaType? { val rawClass = type.rawClass - return if (rawClass == ClosedRange::class.java || rawClass == ClosedFloatingPointRange::class.java) { + return if (rawClass == ClosedRange::class.java || rawClass == CLOSED_FLOATING_POINT_RANGE_CLASS) { type.bindings.typeParameters.firstOrNull() ?.let { typeParam -> findClosedFloatingPointRangeRef(typeParam.rawClass)?.let { diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt index 18af93a..e610a15 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt @@ -1,6 +1,8 @@ package io.github.projectmapk.jackson.module.kogera import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.annotation.JsonProperty +import io.github.projectmapk.jackson.module.kogera.annotation.JsonKUnbox import kotlinx.metadata.KmClass import kotlinx.metadata.KmClassifier import kotlinx.metadata.KmType @@ -14,11 +16,11 @@ import java.lang.reflect.Method internal typealias JavaDuration = java.time.Duration internal typealias KotlinDuration = kotlin.time.Duration -internal fun Class<*>.toKmClass(): KmClass? = getAnnotation(Metadata::class.java)?.let { +internal fun Class<*>.toKmClass(): KmClass? = getAnnotation(METADATA_CLASS)?.let { (KotlinClassMetadata.readStrict(it) as KotlinClassMetadata.Class).kmClass } -internal fun Class<*>.isUnboxableValueClass() = this.isAnnotationPresent(JvmInline::class.java) +internal fun Class<*>.isUnboxableValueClass() = this.isAnnotationPresent(JVM_INLINE_CLASS) // JmClass must be value class. internal fun JmClass.wrapsNullValueClass() = inlineClassUnderlyingType!!.isNullable @@ -88,6 +90,20 @@ internal fun String.reconstructClass(): Class<*> { internal fun KmType.reconstructClassOrNull(): Class<*>? = (classifier as? KmClassifier.Class) ?.let { kotlin.runCatching { it.name.reconstructClass() }.getOrNull() } -internal fun AnnotatedElement.hasCreatorAnnotation(): Boolean = getAnnotation(JsonCreator::class.java) +internal fun AnnotatedElement.hasCreatorAnnotation(): Boolean = getAnnotation(JSON_CREATOR_CLASS) ?.let { it.mode != JsonCreator.Mode.DISABLED } ?: false + +// Instantiating Java Class as a static property is expected to improve first-time execution performance. +// However, maybe this improvement is limited to Java Classes that are not used to initialize static content. +// Also, for classes that are read at the time of initialization of static content or module initialization, +// optimization seems unnecessary because caching is effective. +internal val METADATA_CLASS = Metadata::class.java +internal val JVM_INLINE_CLASS = JvmInline::class.java +internal val JSON_CREATOR_CLASS = JsonCreator::class.java +internal val JSON_PROPERTY_CLASS = JsonProperty::class.java +internal val JSON_K_UNBOX_CLASS = JsonKUnbox::class.java +internal val KOTLIN_DURATION_CLASS = KotlinDuration::class.java +// internal val CLOSED_RANGE_CLASS = ClosedRange::class.java // called during module initialization +internal val CLOSED_FLOATING_POINT_RANGE_CLASS = ClosedFloatingPointRange::class.java +internal val ANY_CLASS = Any::class.java diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinClassIntrospector.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinClassIntrospector.kt index 667279a..67f3aea 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinClassIntrospector.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/KotlinClassIntrospector.kt @@ -50,7 +50,7 @@ internal object KotlinClassIntrospector : BasicClassIntrospector() { ?: run { val coll = collectProperties(config, type, r, true) - if (type.rawClass.isAnnotationPresent(Metadata::class.java)) { + if (type.rawClass.isAnnotationPresent(METADATA_CLASS)) { KotlinBeanDescription(coll) } else { BasicBeanDescription.forDeserialization(coll) @@ -71,7 +71,7 @@ internal object KotlinClassIntrospector : BasicClassIntrospector() { ?: run { val coll = collectProperties(config, type, r, false) - if (type.rawClass.isAnnotationPresent(Metadata::class.java)) { + if (type.rawClass.isAnnotationPresent(METADATA_CLASS)) { KotlinBeanDescription(coll) } else { BasicBeanDescription.forDeserialization(coll) diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ReflectionCache.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ReflectionCache.kt index 4ef0d00..6e05d41 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ReflectionCache.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ReflectionCache.kt @@ -54,7 +54,7 @@ internal class ReflectionCache(initialCacheSize: Int, maxCacheSize: Int) : Seria val superJmClass = if (!clazz.isInterface) { clazz.superclass?.let { // Stop parsing when `Object` is reached - if (it != Any::class.java) getJmClass(it) else null + if (it != ANY_CLASS) getJmClass(it) else null } } else { null diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/annotationIntrospector/KotlinFallbackAnnotationIntrospector.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/annotationIntrospector/KotlinFallbackAnnotationIntrospector.kt index 4fd230a..771e2bb 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/annotationIntrospector/KotlinFallbackAnnotationIntrospector.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/annotationIntrospector/KotlinFallbackAnnotationIntrospector.kt @@ -12,6 +12,8 @@ import com.fasterxml.jackson.databind.introspect.AnnotatedMethod import com.fasterxml.jackson.databind.introspect.AnnotatedParameter import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector import com.fasterxml.jackson.databind.util.Converter +import io.github.projectmapk.jackson.module.kogera.JSON_K_UNBOX_CLASS +import io.github.projectmapk.jackson.module.kogera.KOTLIN_DURATION_CLASS import io.github.projectmapk.jackson.module.kogera.KotlinDuration import io.github.projectmapk.jackson.module.kogera.ReflectionCache import io.github.projectmapk.jackson.module.kogera.annotation.JsonKUnbox @@ -74,15 +76,15 @@ internal class KotlinFallbackAnnotationIntrospector( override fun findSerializationConverter(a: Annotated): Converter<*, *>? = when (a) { // Find a converter to handle the case where the getter returns an unboxed value from the value class. is AnnotatedMethod -> cache.findBoxedReturnType(a.member)?.let { - if (useJavaDurationConversion && it == KotlinDuration::class.java) { - if (a.rawReturnType == KotlinDuration::class.java) { + if (useJavaDurationConversion && it == KOTLIN_DURATION_CLASS) { + if (a.rawReturnType == KOTLIN_DURATION_CLASS) { KotlinToJavaDurationConverter } else { KotlinDurationValueToJavaDurationConverter } } else { // If JsonUnbox is specified, the unboxed getter is used as is. - if (a.hasAnnotation(JsonKUnbox::class.java) || it.isAnnotationPresent(JsonKUnbox::class.java)) { + if (a.hasAnnotation(JSON_K_UNBOX_CLASS) || it.isAnnotationPresent(JSON_K_UNBOX_CLASS)) { null } else { cache.getValueClassBoxConverter(a.rawReturnType, it) @@ -95,7 +97,7 @@ internal class KotlinFallbackAnnotationIntrospector( private fun lookupKotlinTypeConverter(a: AnnotatedClass) = when { Sequence::class.java.isAssignableFrom(a.rawType) -> SequenceToIteratorConverter(a.type) - KotlinDuration::class.java == a.rawType -> KotlinToJavaDurationConverter.takeIf { useJavaDurationConversion } + KOTLIN_DURATION_CLASS == a.rawType -> KotlinToJavaDurationConverter.takeIf { useJavaDurationConversion } else -> null } diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/annotationIntrospector/KotlinPrimaryAnnotationIntrospector.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/annotationIntrospector/KotlinPrimaryAnnotationIntrospector.kt index 185ad4c..4a502ae 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/annotationIntrospector/KotlinPrimaryAnnotationIntrospector.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/annotationIntrospector/KotlinPrimaryAnnotationIntrospector.kt @@ -12,6 +12,7 @@ import com.fasterxml.jackson.databind.introspect.AnnotatedMethod import com.fasterxml.jackson.databind.introspect.AnnotatedParameter import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector import com.fasterxml.jackson.databind.jsontype.NamedType +import io.github.projectmapk.jackson.module.kogera.JSON_PROPERTY_CLASS import io.github.projectmapk.jackson.module.kogera.JmClass import io.github.projectmapk.jackson.module.kogera.ReflectionCache import io.github.projectmapk.jackson.module.kogera.hasCreatorAnnotation @@ -42,7 +43,7 @@ internal class KotlinPrimaryAnnotationIntrospector( // If JsonProperty.required is true, the behavior is clearly specified and the result is paramount. // Otherwise, the required is determined from the configuration and the definition on Kotlin. override fun hasRequiredMarker(m: AnnotatedMember): Boolean? { - val byAnnotation = _findAnnotation(m, JsonProperty::class.java) + val byAnnotation = _findAnnotation(m, JSON_PROPERTY_CLASS) ?.let { if (it.required) return true else false } return cache.getJmClass(m.member.declaringClass)?.let { diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/creator/MethodValueCreator.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/creator/MethodValueCreator.kt index 88c79d1..c9a4129 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/creator/MethodValueCreator.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/deser/valueInstantiator/creator/MethodValueCreator.kt @@ -1,5 +1,6 @@ package io.github.projectmapk.jackson.module.kogera.deser.valueInstantiator.creator +import io.github.projectmapk.jackson.module.kogera.ANY_CLASS import io.github.projectmapk.jackson.module.kogera.JmClass import io.github.projectmapk.jackson.module.kogera.ReflectionCache import io.github.projectmapk.jackson.module.kogera.call @@ -52,7 +53,7 @@ internal class MethodValueCreator( for (i in (valueParameterSize + 1)..(valueParameterSize + maskSize)) { // masks temp[i] = Int::class.java } - temp[valueParameterSize + maskSize + 1] = Object::class.java // maker + temp[valueParameterSize + maskSize + 1] = ANY_CLASS // maker temp } as Array> diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ser/Converters.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ser/Converters.kt index 95a56d8..09dbba0 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ser/Converters.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/ser/Converters.kt @@ -4,6 +4,7 @@ import com.fasterxml.jackson.databind.JavaType import com.fasterxml.jackson.databind.type.TypeFactory import com.fasterxml.jackson.databind.util.StdConverter import io.github.projectmapk.jackson.module.kogera.JavaDuration +import io.github.projectmapk.jackson.module.kogera.KOTLIN_DURATION_CLASS import io.github.projectmapk.jackson.module.kogera.KotlinDuration import io.github.projectmapk.jackson.module.kogera.ValueClassBoxConverter import kotlin.time.toJavaDuration @@ -20,7 +21,7 @@ internal class SequenceToIteratorConverter(private val input: JavaType) : StdCon } internal object KotlinDurationValueToJavaDurationConverter : StdConverter() { - private val boxConverter by lazy { ValueClassBoxConverter(Long::class.java, KotlinDuration::class.java) } + private val boxConverter by lazy { ValueClassBoxConverter(Long::class.java, KOTLIN_DURATION_CLASS) } override fun convert(value: Long): JavaDuration = KotlinToJavaDurationConverter.convert(boxConverter.convert(value)) } From b2cfcb9bf71dc40ceacf384e4288db6ac6019dbc Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Wed, 20 Mar 2024 13:45:47 +0900 Subject: [PATCH 5/7] Formatting --- .../github/projectmapk/jackson/module/kogera/InternalCommons.kt | 1 - .../KotlinFallbackAnnotationIntrospector.kt | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt index e610a15..2dd9297 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/InternalCommons.kt @@ -104,6 +104,5 @@ internal val JSON_CREATOR_CLASS = JsonCreator::class.java internal val JSON_PROPERTY_CLASS = JsonProperty::class.java internal val JSON_K_UNBOX_CLASS = JsonKUnbox::class.java internal val KOTLIN_DURATION_CLASS = KotlinDuration::class.java -// internal val CLOSED_RANGE_CLASS = ClosedRange::class.java // called during module initialization internal val CLOSED_FLOATING_POINT_RANGE_CLASS = ClosedFloatingPointRange::class.java internal val ANY_CLASS = Any::class.java diff --git a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/annotationIntrospector/KotlinFallbackAnnotationIntrospector.kt b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/annotationIntrospector/KotlinFallbackAnnotationIntrospector.kt index 771e2bb..1cde0ef 100644 --- a/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/annotationIntrospector/KotlinFallbackAnnotationIntrospector.kt +++ b/src/main/kotlin/io/github/projectmapk/jackson/module/kogera/annotationIntrospector/KotlinFallbackAnnotationIntrospector.kt @@ -14,9 +14,7 @@ import com.fasterxml.jackson.databind.introspect.NopAnnotationIntrospector import com.fasterxml.jackson.databind.util.Converter import io.github.projectmapk.jackson.module.kogera.JSON_K_UNBOX_CLASS import io.github.projectmapk.jackson.module.kogera.KOTLIN_DURATION_CLASS -import io.github.projectmapk.jackson.module.kogera.KotlinDuration import io.github.projectmapk.jackson.module.kogera.ReflectionCache -import io.github.projectmapk.jackson.module.kogera.annotation.JsonKUnbox import io.github.projectmapk.jackson.module.kogera.isUnboxableValueClass import io.github.projectmapk.jackson.module.kogera.reconstructClassOrNull import io.github.projectmapk.jackson.module.kogera.ser.KotlinDurationValueToJavaDurationConverter From b6bbbc17e16ea0623f53816b795057572575846b Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sat, 30 Mar 2024 15:40:22 +0900 Subject: [PATCH 6/7] Update versions --- gradle/libs.versions.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index e730c84..8228bfe 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -1,9 +1,9 @@ [versions] kotlin = "1.8.22" # Mainly for CI, it can be rewritten by environment variable. -jackson = "2.16.1" +jackson = "2.17.0" # test libs -junit = "5.10.1" +junit = "5.10.2" [libraries] kotlin-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib" } @@ -16,7 +16,7 @@ kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect" } junit-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "junit" } junit-params = { module = "org.junit.jupiter:junit-jupiter-params", version.ref = "junit" } junit-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit" } -mockk = "io.mockk:mockk:1.13.7" +mockk = "io.mockk:mockk:1.13.10" jackson-xml = { module = "com.fasterxml.jackson.dataformat:jackson-dataformat-xml", version.ref = "jackson" } jackson-jsr310 = { module = "com.fasterxml.jackson.datatype:jackson-datatype-jsr310", version.ref = "jackson" } From 40c39932632dfcdeec3dc3b5570834f68e4a4d3f Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sat, 30 Mar 2024 15:45:05 +0900 Subject: [PATCH 7/7] Organize docs Since value class support was added to the original in 2.17, the reference to kogera-specific was removed. --- README.md | 4 ---- docs/FixedIssues.md | 3 --- docs/KogeraSpecificImplementations.md | 4 ---- 3 files changed, 11 deletions(-) diff --git a/README.md b/README.md index e709f2b..366998f 100644 --- a/README.md +++ b/README.md @@ -23,10 +23,6 @@ First, by implementing the equivalent of https://github.com/FasterXML/jackson-mo The cache has also been reorganized based on [benchmark results](https://github.com/ProjectMapK/kogera-benchmark) to achieve smaller memory consumption. The performance degradation when the `strictNullChecks` option is enabled is also [greatly reduced](https://github.com/ProjectMapK/jackson-module-kogera/pull/44). -The next main feature is `value class` support. -The `jackson-module-kogera` supports many use cases for `value class`, including deserialization. -See [here](./docs/AboutValueClassSupport.md) for basic policies and notes on handling `value class`. - [Here](./docs/FixedIssues.md) is a list of issues that are not resolved in `jackson-module-kotlin` but are or will be resolved in `kogera`. ## About intentional destructive changes diff --git a/docs/FixedIssues.md b/docs/FixedIssues.md index 14f49bc..fc6e0eb 100644 --- a/docs/FixedIssues.md +++ b/docs/FixedIssues.md @@ -1,15 +1,12 @@ A list of issues that have not been resolved in `jackson-module-kotlin`, but have been or will be resolved in `kogera`. ## Fixed -- [Support for inline classes · Issue \#199](https://github.com/FasterXML/jackson-module-kotlin/issues/199) - [Getting MismatchedInputException instead of MissingKotlinParameterException · Issue \#234](https://github.com/FasterXML/jackson-module-kotlin/issues/234) - [Private getter with different return type hides property · Issue \#341](https://github.com/FasterXML/jackson-module-kotlin/issues/341) - [Remove \`kotlin\-reflect\` and replace it with \`kotlinx\-metadata\-jvm\` · Issue \#450](https://github.com/FasterXML/jackson-module-kotlin/issues/450) -- [Supports deserialization of \`value class\` \(\`inline class\`\)\. · Issue \#650](https://github.com/FasterXML/jackson-module-kotlin/issues/650) - [Annotation given to constructor parameters containing \`value class\` as argument does not work · Issue \#651](https://github.com/FasterXML/jackson-module-kotlin/issues/651) - [How to deserialize a kotlin\.ranges\.ClosedRange with Jackson · Issue \#663](https://github.com/FasterXML/jackson-module-kotlin/issues/663) - [There are cases where \`isRequired\` specifications are not properly merged\. · Issue \#668](https://github.com/FasterXML/jackson-module-kotlin/issues/668) ## Want to fix - [There are some problems with KNAI\.hasCreatorAnnotation · Issue \#547](https://github.com/FasterXML/jackson-module-kotlin/issues/547) -- [This module shouldn't bring kotlin\-reflect 1\.5 as a transitive dependency · Issue \#566](https://github.com/FasterXML/jackson-module-kotlin/issues/566) diff --git a/docs/KogeraSpecificImplementations.md b/docs/KogeraSpecificImplementations.md index 0335d6b..bca3c57 100644 --- a/docs/KogeraSpecificImplementations.md +++ b/docs/KogeraSpecificImplementations.md @@ -25,7 +25,3 @@ I will consider making the classes public again when we receive requests for the ## Remove old options and `deprecated` code Because `jackson-module-kotlin` is a framework with a long history, some old code and options remain. In `kogera`, those options have been removed. - -# Value class support -The `jackson-module-kogera` supports many use cases of `value class` (`inline class`). -This is summarized [here](./AboutValueClassSupport.md).