From 4fa0475862df3dcc5cb84b1659ca6899ad5d75d8 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Fri, 19 Jan 2024 12:52:28 +0900 Subject: [PATCH 01/20] Add WrapsNullableValueClassDeserializer --- .../WrapsNullableValueClassDeserializer.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 src/main/java/com/fasterxml/jackson/module/kotlin/WrapsNullableValueClassDeserializer.java diff --git a/src/main/java/com/fasterxml/jackson/module/kotlin/WrapsNullableValueClassDeserializer.java b/src/main/java/com/fasterxml/jackson/module/kotlin/WrapsNullableValueClassDeserializer.java new file mode 100644 index 00000000..cfc6b031 --- /dev/null +++ b/src/main/java/com/fasterxml/jackson/module/kotlin/WrapsNullableValueClassDeserializer.java @@ -0,0 +1,56 @@ +package com.fasterxml.jackson.module.kotlin; + +import com.fasterxml.jackson.core.JacksonException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.deser.std.StdDeserializer; +import kotlin.jvm.JvmClassMappingKt; +import kotlin.reflect.KClass; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.io.IOException; + +/** + * An interface to be inherited by JsonDeserializer that handles value classes that may wrap nullable. + */ +// To ensure maximum compatibility with StdDeserializer, this class is written in Java. +public abstract class WrapsNullableValueClassDeserializer extends StdDeserializer { + protected WrapsNullableValueClassDeserializer(@NotNull KClass vc) { + super(JvmClassMappingKt.getJavaClass(vc)); + } + + protected WrapsNullableValueClassDeserializer(@NotNull Class vc) { + super(vc); + } + + protected WrapsNullableValueClassDeserializer(@NotNull JavaType valueType) { + super(valueType); + } + + protected WrapsNullableValueClassDeserializer(@NotNull StdDeserializer src) { + super(src); + } + + @Override + @NotNull + public final Class handledType() { + //noinspection unchecked + return (Class) super.handledType(); + } + + /** + * If the parameter definition is a value class that wraps a nullable and is non-null, + * and the input to JSON is explicitly null, this value is used. + * Note that this will only be called from the KotlinValueInstantiator, + * so it will not work for top-level deserialization of value classes. + */ + // It is defined so that null can also be returned so that Nulls.SKIP can be applied. + @Nullable + public abstract D getBoxedNullValue(); + + @Override + public abstract D deserialize(@NotNull JsonParser p, @NotNull DeserializationContext ctxt) + throws IOException, JacksonException; +} From 0eae78a169d8d7553fa30a27405cdee64a7364e2 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 12:11:41 +0900 Subject: [PATCH 02/20] Added process to get deserializer for value class --- pom.xml | 1 + .../jackson/module/kotlin/InternalCommons.kt | 6 ++ .../module/kotlin/KotlinDeserializers.kt | 61 +++++++++++++++++++ .../jackson/module/kotlin/KotlinModule.kt | 2 +- 4 files changed, 69 insertions(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 801d43de..08b23b08 100644 --- a/pom.xml +++ b/pom.xml @@ -247,6 +247,7 @@ com.fasterxml.jackson.module.kotlin.ConstructorValueCreator com.fasterxml.jackson.module.kotlin.MethodValueCreator com.fasterxml.jackson.module.kotlin.TypesKt + com.fasterxml.jackson.module.kotlin.KotlinDeserializers com.fasterxml.jackson.module.kotlin.ExtensionsKt#isUnboxableValueClass(java.lang.Class) com.fasterxml.jackson.module.kotlin.ExtensionsKt#toBitSet(int) com.fasterxml.jackson.module.kotlin.ExtensionsKt#wrapWithPath(com.fasterxml.jackson.databind.JsonMappingException,java.lang.Object,java.lang.String) diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/InternalCommons.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/InternalCommons.kt index 9da24b49..9fd9ad04 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/InternalCommons.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/InternalCommons.kt @@ -1,6 +1,8 @@ package com.fasterxml.jackson.module.kotlin +import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.databind.JsonMappingException +import java.lang.reflect.AnnotatedElement import java.util.* import kotlin.reflect.KType import kotlin.reflect.jvm.jvmErasure @@ -29,3 +31,7 @@ internal fun Int.toBitSet(): BitSet { internal fun Class<*>.isUnboxableValueClass() = annotations.any { it is JvmInline } && this.isKotlinClass() internal fun KType.erasedType(): Class = this.jvmErasure.java + +internal fun AnnotatedElement.hasCreatorAnnotation(): Boolean = getAnnotation(JsonCreator::class.java) + ?.let { it.mode != JsonCreator.Mode.DISABLED } + ?: false diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinDeserializers.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinDeserializers.kt index 88c179ae..4d8057ee 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinDeserializers.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinDeserializers.kt @@ -10,6 +10,11 @@ import com.fasterxml.jackson.databind.JavaType import com.fasterxml.jackson.databind.JsonDeserializer import com.fasterxml.jackson.databind.deser.Deserializers import com.fasterxml.jackson.databind.deser.std.StdDeserializer +import com.fasterxml.jackson.databind.exc.InvalidDefinitionException +import java.lang.reflect.Method +import java.lang.reflect.Modifier +import kotlin.reflect.full.primaryConstructor +import kotlin.reflect.jvm.javaMethod import kotlin.time.Duration as KotlinDuration object SequenceDeserializer : StdDeserializer>(Sequence::class.java) { @@ -94,7 +99,58 @@ object ULongDeserializer : StdDeserializer(ULong::class.java) { ) } +internal class WrapsNullableValueClassBoxDeserializer( + private val creator: Method, + private val converter: ValueClassBoxConverter +) : WrapsNullableValueClassDeserializer(converter.boxedClass) { + private val inputType: Class<*> = creator.parameterTypes[0] + + init { + creator.apply { if (!this.isAccessible) this.isAccessible = true } + } + + // Cache the result of wrapping null, since the result is always expected to be the same. + @get:JvmName("boxedNullValue") + private val boxedNullValue: D by lazy { instantiate(null) } + + override fun getBoxedNullValue(): D = boxedNullValue + + // To instantiate the value class in the same way as other classes, + // it is necessary to call creator(e.g. constructor-impl) -> box-impl in that order. + // Input is null only when called from KotlinValueInstantiator. + @Suppress("UNCHECKED_CAST") + private fun instantiate(input: Any?): D = converter.convert(creator.invoke(null, input) as S) + + override fun deserialize(p: JsonParser, ctxt: DeserializationContext): D { + val input = p.readValueAs(inputType) + return instantiate(input) + } +} + +private fun invalidCreatorMessage(m: Method): String = + "The argument size of a Creator that does not return a value class on the JVM must be 1, " + + "please fix it or use JsonDeserializer.\n" + + "Detected: ${m.parameters.joinToString(prefix = "${m.name}(", separator = ", ", postfix = ")") { it.name }}" + +private fun findValueCreator(type: JavaType, clazz: Class<*>): Method? { + clazz.declaredMethods.forEach { method -> + if (Modifier.isStatic(method.modifiers) && method.hasCreatorAnnotation()) { + // Do nothing if a correctly functioning Creator is defined + return method.takeIf { clazz != method.returnType }?.apply { + // Creator with an argument size not equal to 1 is currently not supported. + if (parameterCount != 1) { + throw InvalidDefinitionException.from(null as JsonParser?, invalidCreatorMessage(method), type) + } + } + } + } + + // primaryConstructor.javaMethod for the value class returns constructor-impl + return clazz.kotlin.primaryConstructor?.javaMethod +} + internal class KotlinDeserializers( + private val cache: ReflectionCache, private val useJavaDurationConversion: Boolean, ) : Deserializers.Base() { override fun findBeanDeserializer( @@ -113,6 +169,11 @@ internal class KotlinDeserializers( rawClass == ULong::class.java -> ULongDeserializer rawClass == KotlinDuration::class.java -> JavaToKotlinDurationConverter.takeIf { useJavaDurationConversion }?.delegatingDeserializer + rawClass.isUnboxableValueClass() -> findValueCreator(type, rawClass)?.let { + val unboxedClass = it.returnType + val converter = cache.getValueClassBoxConverter(unboxedClass, rawClass.kotlin) + WrapsNullableValueClassBoxDeserializer(it, converter) + } else -> null } } diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt index 4da0baaf..ed83d3e2 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinModule.kt @@ -163,7 +163,7 @@ class KotlinModule @Deprecated( useKotlinPropertyNameForGetter) ) - context.addDeserializers(KotlinDeserializers(useJavaDurationConversion)) + context.addDeserializers(KotlinDeserializers(cache, useJavaDurationConversion)) context.addKeyDeserializers(KotlinKeyDeserializers) context.addSerializers(KotlinSerializers()) context.addKeySerializers(KotlinKeySerializers()) From c0457486720ffa4318e5d8acd63e758e160cf24b Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 12:12:45 +0900 Subject: [PATCH 03/20] Added type conversion for value class --- .../kotlin/KotlinNamesAnnotationIntrospector.kt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinNamesAnnotationIntrospector.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinNamesAnnotationIntrospector.kt index 7e0bdbf1..d0ed2147 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinNamesAnnotationIntrospector.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinNamesAnnotationIntrospector.kt @@ -2,6 +2,7 @@ package com.fasterxml.jackson.module.kotlin import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.annotation.JsonProperty +import com.fasterxml.jackson.databind.JavaType import com.fasterxml.jackson.databind.cfg.MapperConfig import com.fasterxml.jackson.databind.introspect.Annotated import com.fasterxml.jackson.databind.introspect.AnnotatedConstructor @@ -73,6 +74,17 @@ internal class KotlinNamesAnnotationIntrospector( } } + override fun refineDeserializationType(config: MapperConfig<*>, a: Annotated, baseType: JavaType): JavaType = + (a as? AnnotatedParameter)?.let { _ -> + cache.findKotlinParameter(a)?.let { param -> + val rawType = a.rawType + (param.type.classifier as? KClass<*>) + ?.java + ?.takeIf { it.isUnboxableValueClass() && it != rawType } + ?.let { config.constructType(it) } + } + } ?: baseType + private fun hasCreatorAnnotation(member: AnnotatedConstructor): Boolean { // don't add a JsonCreator to any constructor if one is declared already From 1bdd4d2a595dd07ef99e840602814edc21dbb3f3 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sat, 20 Jan 2024 14:26:47 +0900 Subject: [PATCH 04/20] Fix acquisition of KFunction to match value class from https://github.com/k163377/jackson-module-kotlin/commit/ca2120b3576c47aecec1d38347d6823abd2d4268 --- .../jackson/module/kotlin/InternalCommons.kt | 4 ++++ .../jackson/module/kotlin/ReflectionCache.kt | 21 ++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/InternalCommons.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/InternalCommons.kt index 9fd9ad04..04c22abd 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/InternalCommons.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/InternalCommons.kt @@ -7,6 +7,10 @@ import java.util.* import kotlin.reflect.KType import kotlin.reflect.jvm.jvmErasure +internal val defaultConstructorMarker: Class<*> by lazy { + Class.forName("kotlin.jvm.internal.DefaultConstructorMarker") +} + internal fun JsonMappingException.wrapWithPath(refFrom: Any?, refFieldName: String) = JsonMappingException.wrapWithPath(this, refFrom, refFieldName) internal fun JsonMappingException.wrapWithPath(refFrom: Any?, index: Int) = JsonMappingException.wrapWithPath(this, refFrom, index) diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/ReflectionCache.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/ReflectionCache.kt index 0e74800c..d96e7a83 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/ReflectionCache.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/ReflectionCache.kt @@ -60,7 +60,7 @@ internal class ReflectionCache(reflectionCacheSize: Int) : Serializable { LRUMap(0, reflectionCacheSize) fun kotlinFromJava(key: Constructor<*>): KFunction<*>? = javaExecutableToKotlin.get(key) - ?: key.kotlinFunction?.let { javaExecutableToKotlin.putIfAbsent(key, it) ?: it } + ?: key.valueClassAwareKotlinFunction()?.let { javaExecutableToKotlin.putIfAbsent(key, it) ?: it } fun kotlinFromJava(key: Method): KFunction<*>? = javaExecutableToKotlin.get(key) ?: key.kotlinFunction?.let { javaExecutableToKotlin.putIfAbsent(key, it) ?: it } @@ -148,3 +148,22 @@ internal class ReflectionCache(reflectionCacheSize: Int) : Serializable { else -> null }?.valueParameters?.get(param.index) } + +private fun Constructor<*>.valueClassAwareKotlinFunction(): KFunction<*>? { + kotlinFunction?.apply { return this } + + // The javaConstructor that corresponds to the KFunction of the constructor that + // takes value class as an argument is a synthetic constructor. + // Therefore, in Kotlin 1.5.30, KFunction cannot be obtained from a constructor that is processed + // by jackson-module-kotlin. + // To deal with this situation, a synthetic constructor is obtained and a KFunction is obtained from it. + return try { + // The arguments of the synthetic constructor are the normal constructor arguments + // with the DefaultConstructorMarker appended to the end. + declaringClass + .getDeclaredConstructor(*parameterTypes, defaultConstructorMarker) + .kotlinFunction + } catch (t: Throwable) { + null + } +} From c89435b544e5c063119fc2f04f731ae6f51b178c Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sat, 20 Jan 2024 16:54:17 +0900 Subject: [PATCH 05/20] Fix failing test --- .../module/kotlin/test/github/failing/Github611.kt | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/failing/Github611.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/failing/Github611.kt index 4ed809b3..cb147fe6 100644 --- a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/failing/Github611.kt +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/failing/Github611.kt @@ -1,11 +1,10 @@ package com.fasterxml.jackson.module.kotlin.test.github.failing import com.fasterxml.jackson.annotation.JsonProperty -import com.fasterxml.jackson.databind.JsonMappingException import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper import com.fasterxml.jackson.module.kotlin.readValue -import com.fasterxml.jackson.module.kotlin.test.expectFailure import org.junit.Test +import kotlin.test.assertEquals class TestGithub611 { @@ -24,8 +23,7 @@ class TestGithub611 { @Test fun testJsonParsing() { val mapper = jacksonObjectMapper() - expectFailure("GitHub #611 has been fixed!") { - val dataClassInstance = mapper.readValue(jsonData) - } + val dataClassInstance = mapper.readValue(jsonData) + assertEquals(50000.toUShort(), dataClassInstance.id) } } From 1daed523572347db7c1e698fb675893ed60e8353 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 12:19:32 +0900 Subject: [PATCH 06/20] Add package README --- .../fasterxml/jackson/module/kotlin/kogeraIntegration/README.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/README.md diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/README.md b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/README.md new file mode 100644 index 00000000..c7cb8868 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/README.md @@ -0,0 +1,2 @@ +This package contains some portions from `zIntegration` of the `jackson-module-kogera` project. +https://github.com/ProjectMapK/jackson-module-kogera/tree/develop/src/test/kotlin/io/github/projectmapk/jackson/module/kogera/zIntegration From 6a961f7d5919aafbd2e6eb590fee18d3470ac985 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 12:31:52 +0900 Subject: [PATCH 07/20] Add value class top level tests --- .../deser/valueClass/JacksonInjectTest.kt | 76 ++++++++++++ .../valueClass/NullableObjectEdgeCases.kt | 69 +++++++++++ .../deser/valueClass/ValueClasses.kt | 31 +++++ .../WithoutCustomDeserializeMethodTest.kt | 113 ++++++++++++++++++ 4 files changed, 289 insertions(+) create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/JacksonInjectTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/NullableObjectEdgeCases.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/ValueClasses.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/WithoutCustomDeserializeMethodTest.kt diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/JacksonInjectTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/JacksonInjectTest.kt new file mode 100644 index 00000000..73468e6e --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/JacksonInjectTest.kt @@ -0,0 +1,76 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass + +import com.fasterxml.jackson.annotation.JacksonInject +import com.fasterxml.jackson.databind.InjectableValues +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import org.junit.Assert.assertEquals +import org.junit.Assert.assertThrows +import org.junit.Test + +class JacksonInjectTest { + // This is specified as a getter because there is a possibility of problems if it is assigned to a field. + // see: https://github.com/FasterXML/jackson-databind/issues/4218 + data class Dto( + @get:JacksonInject("pNn") + val pNn: Primitive, + @get:JacksonInject("pN") + val pN: Primitive?, + @get:JacksonInject("nnoNn") + val nnoNn: NonNullObject, + @get:JacksonInject("nnoN") + val nnoN: NonNullObject?, + @get:JacksonInject("noNnNn") + val noNnNn: NullableObject, + @get:JacksonInject("noNnN") + val noNnN: NullableObject, + @get:JacksonInject("noNNn") + val noNNn: NullableObject?, + @get:JacksonInject("noNN") + val noNN: NullableObject? + ) + + @Test + fun test() { + val injectables = InjectableValues.Std( + mapOf( + "pNn" to Primitive(0), + "pN" to Primitive(1), + "nnoNn" to NonNullObject("nnoNn"), + "nnoN" to NonNullObject("nnoN"), + "noNnNn" to NullableObject("noNnNn"), + "noNnN" to NullableObject(null), + "noNNn" to NullableObject("noNNn"), + "noNN" to NullableObject(null) + ) + ) + + val reader = jacksonObjectMapper() + .readerFor(Dto::class.java) + .with(injectables) + + println(reader.readValue("{}")) + } + + data class DataBind4218FailingDto( + @field:JacksonInject("pNn") + val pNn: Primitive, + @field:JacksonInject("pN") + val pN: Primitive? + ) + + // remove if fixed + @Test + fun dataBind4218Failing() { + val injectables = InjectableValues.Std(mapOf("pNn" to Primitive(0), "pN" to Primitive(1))) + + val reader = jacksonObjectMapper() + .readerFor(DataBind4218FailingDto::class.java) + .with(injectables) + + val ex = assertThrows(IllegalArgumentException::class.java) { reader.readValue("{}") } + assertEquals( + "Can not set final int field com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.JacksonInjectTest\$DataBind4218FailingDto.pNn to com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.Primitive", + ex.message + ) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/NullableObjectEdgeCases.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/NullableObjectEdgeCases.kt new file mode 100644 index 00000000..66d2d087 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/NullableObjectEdgeCases.kt @@ -0,0 +1,69 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass + +import com.fasterxml.jackson.annotation.JsonSetter +import com.fasterxml.jackson.annotation.Nulls +import com.fasterxml.jackson.core.JsonParser +import com.fasterxml.jackson.databind.DeserializationContext +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.deser.std.StdDeserializer +import com.fasterxml.jackson.module.kotlin.WrapsNullableValueClassDeserializer +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import kotlin.reflect.jvm.internal.KotlinReflectionInternalError +import org.junit.Assert.assertEquals +import org.junit.Assert.assertThrows +import org.junit.Test + +class NullableObjectEdgeCases { + @JvmInline + value class VC(val v: String?) + + class NullValueDeserializer : StdDeserializer(VC::class.java) { + override fun deserialize(p: JsonParser, ctxt: DeserializationContext): VC = + TODO("Not yet implemented") + + override fun getNullValue(ctxt: DeserializationContext): VC = nv + + companion object { + val nv = VC("nv") + } + } + + data class NullValue( + @field:JsonDeserialize(using = NullValueDeserializer::class) + val nn: VC, + @field:JsonDeserialize(using = NullValueDeserializer::class) + val n: VC? + ) + + @Test + fun nullValueIsUsedPreferentially() { + val result = jacksonObjectMapper().readValue("""{"nn":null,"n":null}""") + assertEquals(NullValue(NullValueDeserializer.nv, NullValueDeserializer.nv), result) + } + + class NullsSkipDeserializerWrapsNullable : WrapsNullableValueClassDeserializer(VC::class) { + override fun deserialize(p: JsonParser, ctxt: DeserializationContext): VC { + TODO("Not yet implemented") + } + + override fun getBoxedNullValue(): VC? = null + } + + data class NullsSkip( + @field:JsonSetter(nulls = Nulls.SKIP) + @field:JsonDeserialize(using = NullsSkipDeserializerWrapsNullable::class) + val nn: VC = VC("skip"), + @field:JsonSetter(nulls = Nulls.SKIP) + val n: VC? = VC("skip") + ) + + // There is a problem with #51, so it is a failing test. + @Test + fun `Nulls_SKIP works`() { + assertThrows("#761(KT-57357) fixed", KotlinReflectionInternalError::class.java) { + val result = jacksonObjectMapper().readValue("""{"nn":null,"n":null}""") + assertEquals(NullValue(VC("skip"), VC("skip")), result) + } + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/ValueClasses.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/ValueClasses.kt new file mode 100644 index 00000000..5855a6f1 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/ValueClasses.kt @@ -0,0 +1,31 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass + +import com.fasterxml.jackson.core.JsonParser +import com.fasterxml.jackson.databind.DeserializationContext +import com.fasterxml.jackson.databind.deser.std.StdDeserializer +import com.fasterxml.jackson.module.kotlin.WrapsNullableValueClassDeserializer + +@JvmInline +value class Primitive(val v: Int) { + class Deserializer : StdDeserializer(Primitive::class.java) { + override fun deserialize(p: JsonParser, ctxt: DeserializationContext): Primitive = Primitive(p.intValue + 100) + } +} + +@JvmInline +value class NonNullObject(val v: String) { + class Deserializer : StdDeserializer(NonNullObject::class.java) { + override fun deserialize(p: JsonParser, ctxt: DeserializationContext): NonNullObject = + NonNullObject(p.valueAsString + "-deser") + } +} + +@JvmInline +value class NullableObject(val v: String?) { + class DeserializerWrapsNullable : WrapsNullableValueClassDeserializer(NullableObject::class) { + override fun deserialize(p: JsonParser, ctxt: DeserializationContext): NullableObject = + NullableObject(p.valueAsString + "-deser") + + override fun getBoxedNullValue(): NullableObject = NullableObject("null-value-deser") + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/WithoutCustomDeserializeMethodTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/WithoutCustomDeserializeMethodTest.kt new file mode 100644 index 00000000..05998a44 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/WithoutCustomDeserializeMethodTest.kt @@ -0,0 +1,113 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass + +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import org.junit.Assert.assertEquals +import org.junit.Assert.assertThrows +import org.junit.Assert.assertTrue +import org.junit.Ignore +import org.junit.experimental.runners.Enclosed +import org.junit.runner.RunWith +import java.lang.reflect.InvocationTargetException +import kotlin.test.Test + +@RunWith(Enclosed::class) +class WithoutCustomDeserializeMethodTest { + @Ignore + companion object { + val mapper = jacksonObjectMapper() + val throwable = IllegalArgumentException("test") + } + + class DirectDeserializeTest { + @Test + fun primitive() { + val result = defaultMapper.readValue("1") + assertEquals(Primitive(1), result) + } + + @Test + fun nonNullObject() { + val result = defaultMapper.readValue(""""foo"""") + assertEquals(NonNullObject("foo"), result) + } + + @Suppress("ClassName") + class NullableObject_ { + @Test + fun value() { + val result = defaultMapper.readValue(""""foo"""") + assertEquals(NullableObject("foo"), result) + } + + // failing + @Test + fun nullString() { + // #209 has been fixed. + assertThrows(NullPointerException::class.java) { + val result = defaultMapper.readValue("null") + assertEquals(NullableObject(null), result) + } + } + } + } + + @Ignore + data class Dst( + val pNn: Primitive, + val pN: Primitive?, + val nnoNn: NonNullObject, + val nnoN: NonNullObject?, + val noNn: NullableObject, + val noN: NullableObject? + ) + + @Test + fun withoutNull() { + val expected = Dst( + Primitive(1), + Primitive(2), + NonNullObject("foo"), + NonNullObject("bar"), + NullableObject("baz"), + NullableObject("qux") + ) + val src = mapper.writeValueAsString(expected) + val result = mapper.readValue(src) + + assertEquals(expected, result) + } + + @Test + fun withNull() { + val expected = Dst( + Primitive(1), + null, + NonNullObject("foo"), + null, + NullableObject(null), + null + ) + val src = mapper.writeValueAsString(expected) + val result = mapper.readValue(src) + + assertEquals(expected, result) + } + + @Ignore + @JvmInline + value class HasCheckConstructor(val value: Int) { + init { + if (value < 0) throw throwable + } + } + + @Test + fun callConstructorCheckTest() { + val e = assertThrows(InvocationTargetException::class.java) { defaultMapper.readValue("-1") } + assertTrue(e.cause === throwable) + } + + // If all JsonCreator tests are OK, no need to check throws from factory functions. +} From 881fbc225bf44954d551217a61d5c28c296e340c Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 12:35:08 +0900 Subject: [PATCH 08/20] Add value class default argument tests --- .../defaultArgument/NonNullObjectTest.kt | 42 ++++++++++++++ .../defaultArgument/NullableObjectTest.kt | 56 +++++++++++++++++++ .../defaultArgument/PrimitiveTest.kt | 42 ++++++++++++++ 3 files changed, 140 insertions(+) create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/defaultArgument/NonNullObjectTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/defaultArgument/NullableObjectTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/defaultArgument/PrimitiveTest.kt diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/defaultArgument/NonNullObjectTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/defaultArgument/NonNullObjectTest.kt new file mode 100644 index 00000000..c7124cdd --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/defaultArgument/NonNullObjectTest.kt @@ -0,0 +1,42 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.defaultArgument + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NonNullObject +import com.fasterxml.jackson.module.kotlin.readValue +import org.junit.Assert.assertEquals +import org.junit.Test + +class NonNullObjectTest { + companion object { + val mapper = jacksonObjectMapper() + } + + data class ByConstructor( + val nn: NonNullObject = NonNullObject("foo"), + val nNn: NonNullObject? = NonNullObject("bar"), + val nN: NonNullObject? = null + ) + + @Test + fun byConstructorTest() { + assertEquals(ByConstructor(), mapper.readValue("{}")) + } + + data class ByFactory(val nn: NonNullObject, val nNn: NonNullObject?, val nN: NonNullObject?) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + nn: NonNullObject = NonNullObject("foo"), + nNn: NonNullObject? = NonNullObject("bar"), + nN: NonNullObject? = null + ) = ByFactory(nn, nNn, nN) + } + } + + @Test + fun byFactoryTest() { + assertEquals(ByFactory.creator(), mapper.readValue("{}")) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/defaultArgument/NullableObjectTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/defaultArgument/NullableObjectTest.kt new file mode 100644 index 00000000..408f69a9 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/defaultArgument/NullableObjectTest.kt @@ -0,0 +1,56 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.defaultArgument + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NullableObject +import org.junit.Assert.assertEquals +import org.junit.Assert.assertThrows +import kotlin.test.Test + +class NullableObjectTest { + companion object { + val mapper = jacksonObjectMapper() + } + + data class ByConstructor( + val nnNn: NullableObject = NullableObject("foo"), + val nnN: NullableObject = NullableObject(null), + val nNn: NullableObject? = NullableObject("bar"), + val nN: NullableObject? = null + ) + + @Test + fun byConstructorTestFailing() { + // #761(KT-57357) fixed + assertThrows(Error::class.java) { + assertEquals(ByConstructor(), mapper.readValue("{}")) + } + } + + data class ByFactory( + val nnNn: NullableObject = NullableObject("foo"), + val nnN: NullableObject = NullableObject(null), + val nNn: NullableObject? = NullableObject("bar"), + val nN: NullableObject? = null + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + nn: NullableObject = NullableObject("foo"), + nnN: NullableObject = NullableObject(null), + nNn: NullableObject? = NullableObject("bar"), + nN: NullableObject? = null + ) = ByFactory(nn, nnN, nNn, nN) + } + } + + @Test + fun byFactoryTest() { + // #761(KT-57357) fixed + assertThrows(Error::class.java) { + assertEquals(ByFactory.creator(), mapper.readValue("{}")) + } + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/defaultArgument/PrimitiveTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/defaultArgument/PrimitiveTest.kt new file mode 100644 index 00000000..1d20a229 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/defaultArgument/PrimitiveTest.kt @@ -0,0 +1,42 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.defaultArgument + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.Primitive +import com.fasterxml.jackson.module.kotlin.readValue +import org.junit.Assert.assertEquals +import org.junit.Test + +class PrimitiveTest { + companion object { + val mapper = jacksonObjectMapper() + } + + data class ByConstructor( + val nn: Primitive = Primitive(1), + val nNn: Primitive? = Primitive(2), + val nN: Primitive? = null + ) + + @Test + fun byConstructorTest() { + assertEquals(ByConstructor(), mapper.readValue("{}")) + } + + data class ByFactory(val nn: Primitive, val nNn: Primitive?, val nN: Primitive?) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + nn: Primitive = Primitive(1), + nNn: Primitive? = Primitive(2), + nN: Primitive? = null + ) = ByFactory(nn, nNn, nN) + } + } + + @Test + fun byFactoryTest() { + assertEquals(ByFactory.creator(), mapper.readValue("{}")) + } +} From a4333830a4765086251894b3644e538ac06d351c Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 12:59:28 +0900 Subject: [PATCH 09/20] Add value class deserializer tests --- .../SpecifiedForObjectMapperTest.kt | 119 ++++++++++++++++++ .../byAnnotation/SpecifiedForClassTest.kt | 38 ++++++ .../specifiedForProperty/NonNullObjectTest.kt | 76 +++++++++++ .../NullableObjectTest.kt | 76 +++++++++++ .../specifiedForProperty/PrimitiveTest.kt | 76 +++++++++++ 5 files changed, 385 insertions(+) create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/SpecifiedForObjectMapperTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/SpecifiedForClassTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NonNullObjectTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NullableObjectTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/PrimitiveTest.kt diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/SpecifiedForObjectMapperTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/SpecifiedForObjectMapperTest.kt new file mode 100644 index 00000000..a71373d3 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/SpecifiedForObjectMapperTest.kt @@ -0,0 +1,119 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.deserializer + +import com.fasterxml.jackson.databind.module.SimpleModule +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NonNullObject +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NullableObject +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.Primitive +import org.junit.Assert.assertEquals +import org.junit.Assert.assertThrows +import org.junit.Ignore +import org.junit.experimental.runners.Enclosed +import org.junit.runner.RunWith +import kotlin.test.Test + +@RunWith(Enclosed::class) +class SpecifiedForObjectMapperTest { + @Ignore + companion object { + val mapper = jacksonObjectMapper().apply { + val module = SimpleModule().apply { + this.addDeserializer(Primitive::class.java, Primitive.Deserializer()) + this.addDeserializer(NonNullObject::class.java, NonNullObject.Deserializer()) + this.addDeserializer(NullableObject::class.java, NullableObject.DeserializerWrapsNullable()) + } + this.registerModule(module) + } + } + + class DirectDeserialize { + @Test + fun primitive() { + val result = mapper.readValue("1") + assertEquals(Primitive(101), result) + } + + @Test + fun nonNullObject() { + val result = mapper.readValue(""""foo"""") + assertEquals(NonNullObject("foo-deser"), result) + } + + @Suppress("ClassName")class NullableObject_ { + @Test + fun value() { + val result = mapper.readValue(""""foo"""") + assertEquals(NullableObject("foo-deser"), result) + } + + // failing + @Test + fun nullString() { + // #209 has been fixed. + assertThrows(NullPointerException::class.java) { + val result = mapper.readValue("null") + assertEquals(NullableObject("null-value-deser"), result) + } + } + } + } + + @Ignore + data class Dst( + val pNn: Primitive, + val pN: Primitive?, + val nnoNn: NonNullObject, + val nnoN: NonNullObject?, + val noNn: NullableObject, + val noN: NullableObject? + ) + + @Test + fun nonNull() { + val base = Dst( + Primitive(1), + Primitive(2), + NonNullObject("foo"), + NonNullObject("bar"), + NullableObject("baz"), + NullableObject("qux") + ) + val src = mapper.writeValueAsString(base) + val result = mapper.readValue(src) + + val expected = Dst( + Primitive(101), + Primitive(102), + NonNullObject("foo-deser"), + NonNullObject("bar-deser"), + NullableObject("baz-deser"), + NullableObject("qux-deser") + ) + assertEquals(expected, result) + } + + @Test + fun withNull() { + val base = Dst( + Primitive(1), + null, + NonNullObject("foo"), + null, + NullableObject(null), + null + ) + val src = mapper.writeValueAsString(base) + val result = mapper.readValue(src) + + val expected = Dst( + Primitive(101), + null, + NonNullObject("foo-deser"), + null, + NullableObject("null-value-deser"), + null + ) + assertEquals(expected, result) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/SpecifiedForClassTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/SpecifiedForClassTest.kt new file mode 100644 index 00000000..55d42d10 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/SpecifiedForClassTest.kt @@ -0,0 +1,38 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.deserializer.byAnnotation + +import com.fasterxml.jackson.core.JsonParser +import com.fasterxml.jackson.databind.DeserializationContext +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.databind.deser.std.StdDeserializer +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import org.junit.Assert.assertEquals +import kotlin.test.Test + +class SpecifiedForClassTest { + @JsonDeserialize(using = Value.Deserializer::class) + @JvmInline + value class Value(val v: Int) { + class Deserializer : StdDeserializer(Value::class.java) { + override fun deserialize(p: JsonParser, ctxt: DeserializationContext): Value = Value(p.intValue + 100) + } + } + + @Test + fun directDeserTest() { + val mapper = jacksonObjectMapper() + val result = mapper.readValue("1") + + assertEquals(Value(101), result) + } + + data class Wrapper(val v: Value) + + @Test + fun paramDeserTest() { + val mapper = jacksonObjectMapper() + val result = mapper.readValue("""{"v":1}""") + + assertEquals(Wrapper(Value(101)), result) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NonNullObjectTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NonNullObjectTest.kt new file mode 100644 index 00000000..15b3c22e --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NonNullObjectTest.kt @@ -0,0 +1,76 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.deserializer.byAnnotation.specifiedForProperty + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NonNullObject +import org.junit.Assert.assertEquals +import org.junit.Ignore +import org.junit.experimental.runners.Enclosed +import org.junit.runner.RunWith +import kotlin.test.Test + +@RunWith(Enclosed::class) +class NonNullObjectTest { + @Ignore + companion object { + val mapper = jacksonObjectMapper() + } + + @Ignore + data class NonNull( + @get:JsonDeserialize(using = NonNullObject.Deserializer::class) + val getterAnn: NonNullObject, + @field:JsonDeserialize(using = NonNullObject.Deserializer::class) + val fieldAnn: NonNullObject + ) + + @Test + fun nonNull() { + val result = mapper.readValue( + """ + { + "getterAnn" : "foo", + "fieldAnn" : "bar" + } + """.trimIndent() + ) + assertEquals(NonNull(NonNullObject("foo-deser"), NonNullObject("bar-deser")), result) + } + + @Ignore + data class Nullable( + @get:JsonDeserialize(using = NonNullObject.Deserializer::class) + val getterAnn: NonNullObject?, + @field:JsonDeserialize(using = NonNullObject.Deserializer::class) + val fieldAnn: NonNullObject? + ) + + class NullableTest { + @Test + fun nonNullInput() { + val result = mapper.readValue( + """ + { + "getterAnn" : "foo", + "fieldAnn" : "bar" + } + """.trimIndent() + ) + assertEquals(Nullable(NonNullObject("foo-deser"), NonNullObject("bar-deser")), result) + } + + @Test + fun nullInput() { + val result = mapper.readValue( + """ + { + "getterAnn" : null, + "fieldAnn" : null + } + """.trimIndent() + ) + assertEquals(Nullable(null, null), result) + } + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NullableObjectTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NullableObjectTest.kt new file mode 100644 index 00000000..68d90c65 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NullableObjectTest.kt @@ -0,0 +1,76 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.deserializer.byAnnotation.specifiedForProperty + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NullableObject +import org.junit.Assert.assertEquals +import org.junit.Ignore +import org.junit.experimental.runners.Enclosed +import org.junit.runner.RunWith +import kotlin.test.Test + +@RunWith(Enclosed::class) +class NullableObjectTest { + @Ignore + companion object { + val mapper = jacksonObjectMapper() + } + + @Ignore + data class NonNull( + @get:JsonDeserialize(using = NullableObject.DeserializerWrapsNullable::class) + val getterAnn: NullableObject, + @field:JsonDeserialize(using = NullableObject.DeserializerWrapsNullable::class) + val fieldAnn: NullableObject + ) + + @Test + fun nonNull() { + val result = mapper.readValue( + """ + { + "getterAnn" : "foo", + "fieldAnn" : "bar" + } + """.trimIndent() + ) + assertEquals(NonNull(NullableObject("foo-deser"), NullableObject("bar-deser")), result) + } + + @Ignore + data class Nullable( + @get:JsonDeserialize(using = NullableObject.DeserializerWrapsNullable::class) + val getterAnn: NullableObject?, + @field:JsonDeserialize(using = NullableObject.DeserializerWrapsNullable::class) + val fieldAnn: NullableObject? + ) + + class NullableTest { + @Test + fun nonNullInput() { + val result = mapper.readValue( + """ + { + "getterAnn" : "foo", + "fieldAnn" : "bar" + } + """.trimIndent() + ) + assertEquals(Nullable(NullableObject("foo-deser"), NullableObject("bar-deser")), result) + } + + @Test + fun nullInput() { + val result = mapper.readValue( + """ + { + "getterAnn" : null, + "fieldAnn" : null + } + """.trimIndent() + ) + assertEquals(Nullable(null, null), result) + } + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/PrimitiveTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/PrimitiveTest.kt new file mode 100644 index 00000000..ff72abec --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/PrimitiveTest.kt @@ -0,0 +1,76 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.deserializer.byAnnotation.specifiedForProperty + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.Primitive +import org.junit.Assert.assertEquals +import org.junit.experimental.runners.Enclosed +import org.junit.runner.RunWith +import kotlin.test.Ignore +import kotlin.test.Test + +@RunWith(Enclosed::class) +class PrimitiveTest { + @Ignore + companion object { + val mapper = jacksonObjectMapper() + } + + @Ignore + data class NonNull( + @get:JsonDeserialize(using = Primitive.Deserializer::class) + val getterAnn: Primitive, + @field:JsonDeserialize(using = Primitive.Deserializer::class) + val fieldAnn: Primitive + ) + + @Test + fun nonNull() { + val result = mapper.readValue( + """ + { + "getterAnn" : 1, + "fieldAnn" : 2 + } + """.trimIndent() + ) + assertEquals(NonNull(Primitive(101), Primitive(102)), result) + } + + @Ignore + data class Nullable( + @get:JsonDeserialize(using = Primitive.Deserializer::class) + val getterAnn: Primitive?, + @field:JsonDeserialize(using = Primitive.Deserializer::class) + val fieldAnn: Primitive? + ) + + class NullableTest { + @Test + fun nonNullInput() { + val result = mapper.readValue( + """ + { + "getterAnn" : 1, + "fieldAnn" : 2 + } + """.trimIndent() + ) + assertEquals(Nullable(Primitive(101), Primitive(102)), result) + } + + @Test + fun nullInput() { + val result = mapper.readValue( + """ + { + "getterAnn" : null, + "fieldAnn" : null + } + """.trimIndent() + ) + assertEquals(Nullable(null, null), result) + } + } +} From c406502015025a5c0e8e5bac78e43fb14f693099 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 13:27:08 +0900 Subject: [PATCH 10/20] Fixed parameter parsing process --- .../com/fasterxml/jackson/module/kotlin/ReflectionCache.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/ReflectionCache.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/ReflectionCache.kt index d96e7a83..d73450ce 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/ReflectionCache.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/ReflectionCache.kt @@ -146,7 +146,11 @@ internal class ReflectionCache(reflectionCacheSize: Int) : Serializable { is Constructor<*> -> kotlinFromJava(owner) is Method -> kotlinFromJava(owner) else -> null - }?.valueParameters?.get(param.index) + } + ?.valueParameters + // Functions defined in value class may have a different index when retrieved as KFunction, + // so use getOrNull to avoid errors. + ?.getOrNull(param.index) } private fun Constructor<*>.valueClassAwareKotlinFunction(): KFunction<*>? { From dce93ade565b6c23735dbed109727a6fd256723d Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 13:27:42 +0900 Subject: [PATCH 11/20] Add value class JsonCreator tests --- .../jsonCreator/HandledByJacksonTest.kt | 46 +++++++++ .../jsonCreator/HandledByKogeraTest.kt | 95 +++++++++++++++++++ .../jsonCreator/InCreatorArgumentTest.kt | 71 ++++++++++++++ 3 files changed, 212 insertions(+) create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/jsonCreator/HandledByJacksonTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/jsonCreator/HandledByKogeraTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/jsonCreator/InCreatorArgumentTest.kt diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/jsonCreator/HandledByJacksonTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/jsonCreator/HandledByJacksonTest.kt new file mode 100644 index 00000000..1f71eab8 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/jsonCreator/HandledByJacksonTest.kt @@ -0,0 +1,46 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.jsonCreator + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import org.junit.Assert.assertEquals +import org.junit.Test + +// Test for Creator that can be handled by the Jackson mechanism. +class HandledByJacksonTest { + @JvmInline + value class PrimitiveMultiParamCreator(val value: Int) { + companion object { + // Avoiding unboxing by making the return value of Creator nullable + @JvmStatic + @JsonCreator + fun creator(first: Int, second: Int): PrimitiveMultiParamCreator? = + PrimitiveMultiParamCreator(first + second) + } + } + + @Test + fun primitiveNullableCreatorTest() { + val mapper = jacksonObjectMapper() + val r: PrimitiveMultiParamCreator = mapper.readValue("""{"first":1,"second":2}""") + assertEquals(PrimitiveMultiParamCreator(3), r) + } + + @JvmInline + value class NullableObjectMiltiParamCreator(val value: Int?) { + companion object { + // Avoiding unboxing by making the return value of Creator nullable + @JvmStatic + @JsonCreator + fun creator(first: Int, second: Int): NullableObjectMiltiParamCreator? = + NullableObjectMiltiParamCreator(first + second) + } + } + + @Test + fun nullableObjectNullableCreatorTest() { + val mapper = jacksonObjectMapper() + val r: NullableObjectMiltiParamCreator = mapper.readValue("""{"first":1,"second":2}""") + assertEquals(NullableObjectMiltiParamCreator(3), r) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/jsonCreator/HandledByKogeraTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/jsonCreator/HandledByKogeraTest.kt new file mode 100644 index 00000000..147c9889 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/jsonCreator/HandledByKogeraTest.kt @@ -0,0 +1,95 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.jsonCreator + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.databind.exc.InvalidDefinitionException +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.readValue +import org.junit.Assert.assertEquals +import org.junit.Assert.assertThrows +import org.junit.Test + +// Test on the case of deserialization by ValueClassBoxDeserializer +class HandledByKogeraTest { + @JvmInline + value class SpecifiedPrimary @JsonCreator constructor(val primary: String?) + + @JvmInline + value class Secondary(val value: String) { + @JsonCreator constructor(value: Int) : this("$value-creator") + } + + @JvmInline + value class Factory(val value: Int) { + companion object { + @JvmStatic + @JsonCreator + fun creator(value: Int): Factory = Factory(value + 100) + } + } + + @Test + fun directDeserTest() { + val mapper = jacksonObjectMapper() + + assertEquals(SpecifiedPrimary("b"), mapper.readValue("\"b\"")) + assertEquals(Secondary("1-creator"), mapper.readValue("1")) + assertEquals(Factory(101), mapper.readValue("1")) + } + + data class Dst( + val bar: SpecifiedPrimary, + val baz: Secondary, + val qux: Factory + ) + + @Test + fun parameterTest() { + val mapper = jacksonObjectMapper() + + val r = mapper.readValue( + """ + { + "bar":"b", + "baz":1, + "qux":1 + } + """.trimIndent() + ) + + assertEquals( + Dst( + SpecifiedPrimary("b"), + Secondary("1-creator"), + Factory(101) + ), + r + ) + } + + @JvmInline + value class MultipleValueConstructor(val value: String) { + @JsonCreator constructor(v1: String, v2: String) : this(v1 + v2) + } + + @JvmInline + value class MultipleValueFactory(val value: Int) { + companion object { + @JsonCreator + @JvmStatic + fun creator(v1: Int, v2: Int): MultipleValueFactory = MultipleValueFactory(v1 + v2) + } + } + + // A Creator that requires multiple arguments is basically an error. + @Test + fun handleErrorTest() { + val mapper = jacksonObjectMapper() + + assertThrows(InvalidDefinitionException::class.java) { + mapper.readValue("""{"v1":"1","v2":"2"}""") + } + assertThrows(InvalidDefinitionException::class.java) { + mapper.readValue("""{"v1":1,"v2":2}""") + } + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/jsonCreator/InCreatorArgumentTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/jsonCreator/InCreatorArgumentTest.kt new file mode 100644 index 00000000..621a213d --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/jsonCreator/InCreatorArgumentTest.kt @@ -0,0 +1,71 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.jsonCreator + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NonNullObject +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NullableObject +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.Primitive +import com.fasterxml.jackson.module.kotlin.readValue +import org.junit.Assert.assertEquals +import org.junit.Test + +private fun Primitive.modify(): Primitive = Primitive(v + 100) +private fun NonNullObject.modify(): NonNullObject = NonNullObject("$v-creator") +private fun NullableObject.modify(): NullableObject = NullableObject(v!! + "-creator") + +class InCreatorArgumentTest { + data class Dst( + val pNn: Primitive, + val pN: Primitive?, + val nnoNn: NonNullObject, + val nnoN: NonNullObject?, + val noNn: NullableObject, + val noN: NullableObject? + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + pNn: Primitive, + pN: Primitive?, + nnoNn: NonNullObject, + nnoN: NonNullObject?, + noNn: NullableObject, + noN: NullableObject? + ) = Dst( + pNn.modify(), + pN?.modify(), + nnoNn.modify(), + nnoN?.modify(), + noNn.modify(), + noN?.modify() + ) + } + } + + @Test + fun test() { + val mapper = jacksonObjectMapper() + val base = Dst( + Primitive(1), + Primitive(2), + NonNullObject("nnoNn"), + NonNullObject("nnoN"), + NullableObject("noNn"), + NullableObject("noN") + ) + val result = mapper.readValue(mapper.writeValueAsString(base)) + + assertEquals( + base.copy( + pNn = base.pNn.modify(), + pN = base.pN?.modify(), + nnoNn = base.nnoNn.modify(), + nnoN = base.nnoN?.modify(), + noNn = base.noNn.modify(), + noN = base.noN?.modify() + ), + result + ) + } +} From 1d1d1f965cea581f06e146fcb001eb5b67165cf2 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 13:41:10 +0900 Subject: [PATCH 12/20] Add value class parameter tests using NonNullObject --- ...zeByConstructorWithDefaultArgumentsTest.kt | 499 ++++++ ...yConstructorWithoutDefaultArgumentsTest.kt | 515 ++++++ ...ializeByFactoryWithDefaultArgumentsTest.kt | 1411 ++++++++++++++++ ...izeByFactoryWithoutDefaultArgumentsTest.kt | 1453 +++++++++++++++++ 4 files changed, 3878 insertions(+) create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByConstructorWithDefaultArgumentsTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByConstructorWithoutDefaultArgumentsTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByFactoryWithDefaultArgumentsTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByFactoryWithoutDefaultArgumentsTest.kt diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByConstructorWithDefaultArgumentsTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByConstructorWithDefaultArgumentsTest.kt new file mode 100644 index 00000000..a36d7635 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByConstructorWithDefaultArgumentsTest.kt @@ -0,0 +1,499 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.nonNullObject + +import com.fasterxml.jackson.module.kotlin.assertReflectEquals +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NonNullObject +import org.junit.Assert.assertEquals +import kotlin.reflect.jvm.internal.KotlinReflectionInternalError +import kotlin.test.Test + +/** + * Up to argument size 32 there is one mask argument for the default argument, + * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested. + * Also, if the default argument is set, the maximum argument size that can be set in the constructor is 245, + * so that case is tested as well. + */ +class DeserializeByConstructorWithDefaultArgumentsTest { + data class Dst32( + val p00: NonNullObject = NonNullObject("0"), + val p01: NonNullObject = NonNullObject("1"), + val p02: NonNullObject = NonNullObject("2"), + val p03: NonNullObject = NonNullObject("3"), + val p04: NonNullObject = NonNullObject("4"), + val p05: NonNullObject = NonNullObject("5"), + val p06: NonNullObject = NonNullObject("6"), + val p07: NonNullObject = NonNullObject("7"), + val p08: NonNullObject = NonNullObject("8"), + val p09: NonNullObject = NonNullObject("9"), + val p10: NonNullObject = NonNullObject("10"), + val p11: NonNullObject = NonNullObject("11"), + val p12: NonNullObject = NonNullObject("12"), + val p13: NonNullObject = NonNullObject("13"), + val p14: NonNullObject = NonNullObject("14"), + val p15: NonNullObject = NonNullObject("15"), + val p16: NonNullObject = NonNullObject("16"), + val p17: NonNullObject = NonNullObject("17"), + val p18: NonNullObject = NonNullObject("18"), + val p19: NonNullObject = NonNullObject("19"), + val p20: NonNullObject = NonNullObject("20"), + val p21: NonNullObject = NonNullObject("21"), + val p22: NonNullObject = NonNullObject("22"), + val p23: NonNullObject = NonNullObject("23"), + val p24: NonNullObject = NonNullObject("24"), + val p25: NonNullObject = NonNullObject("25"), + val p26: NonNullObject = NonNullObject("26"), + val p27: NonNullObject = NonNullObject("27"), + val p28: NonNullObject = NonNullObject("28"), + val p29: NonNullObject = NonNullObject("29"), + val p30: NonNullObject = NonNullObject("30"), + val p31: NonNullObject = NonNullObject("31") + ) + + // #762 + @Test(expected = KotlinReflectionInternalError::class) + fun test32() { + assertEquals(Dst32(), defaultMapper.readValue("{}")) + } + + data class Dst33( + val p00: NonNullObject = NonNullObject("0"), + val p01: NonNullObject = NonNullObject("1"), + val p02: NonNullObject = NonNullObject("2"), + val p03: NonNullObject = NonNullObject("3"), + val p04: NonNullObject = NonNullObject("4"), + val p05: NonNullObject = NonNullObject("5"), + val p06: NonNullObject = NonNullObject("6"), + val p07: NonNullObject = NonNullObject("7"), + val p08: NonNullObject = NonNullObject("8"), + val p09: NonNullObject = NonNullObject("9"), + val p10: NonNullObject = NonNullObject("10"), + val p11: NonNullObject = NonNullObject("11"), + val p12: NonNullObject = NonNullObject("12"), + val p13: NonNullObject = NonNullObject("13"), + val p14: NonNullObject = NonNullObject("14"), + val p15: NonNullObject = NonNullObject("15"), + val p16: NonNullObject = NonNullObject("16"), + val p17: NonNullObject = NonNullObject("17"), + val p18: NonNullObject = NonNullObject("18"), + val p19: NonNullObject = NonNullObject("19"), + val p20: NonNullObject = NonNullObject("20"), + val p21: NonNullObject = NonNullObject("21"), + val p22: NonNullObject = NonNullObject("22"), + val p23: NonNullObject = NonNullObject("23"), + val p24: NonNullObject = NonNullObject("24"), + val p25: NonNullObject = NonNullObject("25"), + val p26: NonNullObject = NonNullObject("26"), + val p27: NonNullObject = NonNullObject("27"), + val p28: NonNullObject = NonNullObject("28"), + val p29: NonNullObject = NonNullObject("29"), + val p30: NonNullObject = NonNullObject("30"), + val p31: NonNullObject = NonNullObject("31"), + val p32: NonNullObject = NonNullObject("32") + ) + + @Test + fun test33() { + assertEquals(Dst33(), defaultMapper.readValue("{}")) + } + + data class Dst64( + val p00: NonNullObject = NonNullObject("0"), + val p01: NonNullObject = NonNullObject("1"), + val p02: NonNullObject = NonNullObject("2"), + val p03: NonNullObject = NonNullObject("3"), + val p04: NonNullObject = NonNullObject("4"), + val p05: NonNullObject = NonNullObject("5"), + val p06: NonNullObject = NonNullObject("6"), + val p07: NonNullObject = NonNullObject("7"), + val p08: NonNullObject = NonNullObject("8"), + val p09: NonNullObject = NonNullObject("9"), + val p10: NonNullObject = NonNullObject("10"), + val p11: NonNullObject = NonNullObject("11"), + val p12: NonNullObject = NonNullObject("12"), + val p13: NonNullObject = NonNullObject("13"), + val p14: NonNullObject = NonNullObject("14"), + val p15: NonNullObject = NonNullObject("15"), + val p16: NonNullObject = NonNullObject("16"), + val p17: NonNullObject = NonNullObject("17"), + val p18: NonNullObject = NonNullObject("18"), + val p19: NonNullObject = NonNullObject("19"), + val p20: NonNullObject = NonNullObject("20"), + val p21: NonNullObject = NonNullObject("21"), + val p22: NonNullObject = NonNullObject("22"), + val p23: NonNullObject = NonNullObject("23"), + val p24: NonNullObject = NonNullObject("24"), + val p25: NonNullObject = NonNullObject("25"), + val p26: NonNullObject = NonNullObject("26"), + val p27: NonNullObject = NonNullObject("27"), + val p28: NonNullObject = NonNullObject("28"), + val p29: NonNullObject = NonNullObject("29"), + val p30: NonNullObject = NonNullObject("30"), + val p31: NonNullObject = NonNullObject("31"), + val p32: NonNullObject = NonNullObject("32"), + val p33: NonNullObject = NonNullObject("33"), + val p34: NonNullObject = NonNullObject("34"), + val p35: NonNullObject = NonNullObject("35"), + val p36: NonNullObject = NonNullObject("36"), + val p37: NonNullObject = NonNullObject("37"), + val p38: NonNullObject = NonNullObject("38"), + val p39: NonNullObject = NonNullObject("39"), + val p40: NonNullObject = NonNullObject("40"), + val p41: NonNullObject = NonNullObject("41"), + val p42: NonNullObject = NonNullObject("42"), + val p43: NonNullObject = NonNullObject("43"), + val p44: NonNullObject = NonNullObject("44"), + val p45: NonNullObject = NonNullObject("45"), + val p46: NonNullObject = NonNullObject("46"), + val p47: NonNullObject = NonNullObject("47"), + val p48: NonNullObject = NonNullObject("48"), + val p49: NonNullObject = NonNullObject("49"), + val p50: NonNullObject = NonNullObject("50"), + val p51: NonNullObject = NonNullObject("51"), + val p52: NonNullObject = NonNullObject("52"), + val p53: NonNullObject = NonNullObject("53"), + val p54: NonNullObject = NonNullObject("54"), + val p55: NonNullObject = NonNullObject("55"), + val p56: NonNullObject = NonNullObject("56"), + val p57: NonNullObject = NonNullObject("57"), + val p58: NonNullObject = NonNullObject("58"), + val p59: NonNullObject = NonNullObject("59"), + val p60: NonNullObject = NonNullObject("60"), + val p61: NonNullObject = NonNullObject("61"), + val p62: NonNullObject = NonNullObject("62"), + val p63: NonNullObject = NonNullObject("63") + ) + + // #762 + @Test(expected = KotlinReflectionInternalError::class) + fun test64() { + assertEquals(Dst64(), defaultMapper.readValue("{}")) + } + + data class Dst65( + val p00: NonNullObject = NonNullObject("0"), + val p01: NonNullObject = NonNullObject("1"), + val p02: NonNullObject = NonNullObject("2"), + val p03: NonNullObject = NonNullObject("3"), + val p04: NonNullObject = NonNullObject("4"), + val p05: NonNullObject = NonNullObject("5"), + val p06: NonNullObject = NonNullObject("6"), + val p07: NonNullObject = NonNullObject("7"), + val p08: NonNullObject = NonNullObject("8"), + val p09: NonNullObject = NonNullObject("9"), + val p10: NonNullObject = NonNullObject("10"), + val p11: NonNullObject = NonNullObject("11"), + val p12: NonNullObject = NonNullObject("12"), + val p13: NonNullObject = NonNullObject("13"), + val p14: NonNullObject = NonNullObject("14"), + val p15: NonNullObject = NonNullObject("15"), + val p16: NonNullObject = NonNullObject("16"), + val p17: NonNullObject = NonNullObject("17"), + val p18: NonNullObject = NonNullObject("18"), + val p19: NonNullObject = NonNullObject("19"), + val p20: NonNullObject = NonNullObject("20"), + val p21: NonNullObject = NonNullObject("21"), + val p22: NonNullObject = NonNullObject("22"), + val p23: NonNullObject = NonNullObject("23"), + val p24: NonNullObject = NonNullObject("24"), + val p25: NonNullObject = NonNullObject("25"), + val p26: NonNullObject = NonNullObject("26"), + val p27: NonNullObject = NonNullObject("27"), + val p28: NonNullObject = NonNullObject("28"), + val p29: NonNullObject = NonNullObject("29"), + val p30: NonNullObject = NonNullObject("30"), + val p31: NonNullObject = NonNullObject("31"), + val p32: NonNullObject = NonNullObject("32"), + val p33: NonNullObject = NonNullObject("33"), + val p34: NonNullObject = NonNullObject("34"), + val p35: NonNullObject = NonNullObject("35"), + val p36: NonNullObject = NonNullObject("36"), + val p37: NonNullObject = NonNullObject("37"), + val p38: NonNullObject = NonNullObject("38"), + val p39: NonNullObject = NonNullObject("39"), + val p40: NonNullObject = NonNullObject("40"), + val p41: NonNullObject = NonNullObject("41"), + val p42: NonNullObject = NonNullObject("42"), + val p43: NonNullObject = NonNullObject("43"), + val p44: NonNullObject = NonNullObject("44"), + val p45: NonNullObject = NonNullObject("45"), + val p46: NonNullObject = NonNullObject("46"), + val p47: NonNullObject = NonNullObject("47"), + val p48: NonNullObject = NonNullObject("48"), + val p49: NonNullObject = NonNullObject("49"), + val p50: NonNullObject = NonNullObject("50"), + val p51: NonNullObject = NonNullObject("51"), + val p52: NonNullObject = NonNullObject("52"), + val p53: NonNullObject = NonNullObject("53"), + val p54: NonNullObject = NonNullObject("54"), + val p55: NonNullObject = NonNullObject("55"), + val p56: NonNullObject = NonNullObject("56"), + val p57: NonNullObject = NonNullObject("57"), + val p58: NonNullObject = NonNullObject("58"), + val p59: NonNullObject = NonNullObject("59"), + val p60: NonNullObject = NonNullObject("60"), + val p61: NonNullObject = NonNullObject("61"), + val p62: NonNullObject = NonNullObject("62"), + val p63: NonNullObject = NonNullObject("63"), + val p64: NonNullObject = NonNullObject("64") + ) + + @Test + fun test65() { + assertEquals(Dst65(), defaultMapper.readValue("{}")) + } + + // It cannot be a data class because the generated method would exceed the argument size limit. + class DstMax( + val p000: NonNullObject = NonNullObject("0"), + val p001: NonNullObject = NonNullObject("1"), + val p002: NonNullObject = NonNullObject("2"), + val p003: NonNullObject = NonNullObject("3"), + val p004: NonNullObject = NonNullObject("4"), + val p005: NonNullObject = NonNullObject("5"), + val p006: NonNullObject = NonNullObject("6"), + val p007: NonNullObject = NonNullObject("7"), + val p008: NonNullObject = NonNullObject("8"), + val p009: NonNullObject = NonNullObject("9"), + val p010: NonNullObject = NonNullObject("10"), + val p011: NonNullObject = NonNullObject("11"), + val p012: NonNullObject = NonNullObject("12"), + val p013: NonNullObject = NonNullObject("13"), + val p014: NonNullObject = NonNullObject("14"), + val p015: NonNullObject = NonNullObject("15"), + val p016: NonNullObject = NonNullObject("16"), + val p017: NonNullObject = NonNullObject("17"), + val p018: NonNullObject = NonNullObject("18"), + val p019: NonNullObject = NonNullObject("19"), + val p020: NonNullObject = NonNullObject("20"), + val p021: NonNullObject = NonNullObject("21"), + val p022: NonNullObject = NonNullObject("22"), + val p023: NonNullObject = NonNullObject("23"), + val p024: NonNullObject = NonNullObject("24"), + val p025: NonNullObject = NonNullObject("25"), + val p026: NonNullObject = NonNullObject("26"), + val p027: NonNullObject = NonNullObject("27"), + val p028: NonNullObject = NonNullObject("28"), + val p029: NonNullObject = NonNullObject("29"), + val p030: NonNullObject = NonNullObject("30"), + val p031: NonNullObject = NonNullObject("31"), + val p032: NonNullObject = NonNullObject("32"), + val p033: NonNullObject = NonNullObject("33"), + val p034: NonNullObject = NonNullObject("34"), + val p035: NonNullObject = NonNullObject("35"), + val p036: NonNullObject = NonNullObject("36"), + val p037: NonNullObject = NonNullObject("37"), + val p038: NonNullObject = NonNullObject("38"), + val p039: NonNullObject = NonNullObject("39"), + val p040: NonNullObject = NonNullObject("40"), + val p041: NonNullObject = NonNullObject("41"), + val p042: NonNullObject = NonNullObject("42"), + val p043: NonNullObject = NonNullObject("43"), + val p044: NonNullObject = NonNullObject("44"), + val p045: NonNullObject = NonNullObject("45"), + val p046: NonNullObject = NonNullObject("46"), + val p047: NonNullObject = NonNullObject("47"), + val p048: NonNullObject = NonNullObject("48"), + val p049: NonNullObject = NonNullObject("49"), + val p050: NonNullObject = NonNullObject("50"), + val p051: NonNullObject = NonNullObject("51"), + val p052: NonNullObject = NonNullObject("52"), + val p053: NonNullObject = NonNullObject("53"), + val p054: NonNullObject = NonNullObject("54"), + val p055: NonNullObject = NonNullObject("55"), + val p056: NonNullObject = NonNullObject("56"), + val p057: NonNullObject = NonNullObject("57"), + val p058: NonNullObject = NonNullObject("58"), + val p059: NonNullObject = NonNullObject("59"), + val p060: NonNullObject = NonNullObject("60"), + val p061: NonNullObject = NonNullObject("61"), + val p062: NonNullObject = NonNullObject("62"), + val p063: NonNullObject = NonNullObject("63"), + val p064: NonNullObject = NonNullObject("64"), + val p065: NonNullObject = NonNullObject("65"), + val p066: NonNullObject = NonNullObject("66"), + val p067: NonNullObject = NonNullObject("67"), + val p068: NonNullObject = NonNullObject("68"), + val p069: NonNullObject = NonNullObject("69"), + val p070: NonNullObject = NonNullObject("70"), + val p071: NonNullObject = NonNullObject("71"), + val p072: NonNullObject = NonNullObject("72"), + val p073: NonNullObject = NonNullObject("73"), + val p074: NonNullObject = NonNullObject("74"), + val p075: NonNullObject = NonNullObject("75"), + val p076: NonNullObject = NonNullObject("76"), + val p077: NonNullObject = NonNullObject("77"), + val p078: NonNullObject = NonNullObject("78"), + val p079: NonNullObject = NonNullObject("79"), + val p080: NonNullObject = NonNullObject("80"), + val p081: NonNullObject = NonNullObject("81"), + val p082: NonNullObject = NonNullObject("82"), + val p083: NonNullObject = NonNullObject("83"), + val p084: NonNullObject = NonNullObject("84"), + val p085: NonNullObject = NonNullObject("85"), + val p086: NonNullObject = NonNullObject("86"), + val p087: NonNullObject = NonNullObject("87"), + val p088: NonNullObject = NonNullObject("88"), + val p089: NonNullObject = NonNullObject("89"), + val p090: NonNullObject = NonNullObject("90"), + val p091: NonNullObject = NonNullObject("91"), + val p092: NonNullObject = NonNullObject("92"), + val p093: NonNullObject = NonNullObject("93"), + val p094: NonNullObject = NonNullObject("94"), + val p095: NonNullObject = NonNullObject("95"), + val p096: NonNullObject = NonNullObject("96"), + val p097: NonNullObject = NonNullObject("97"), + val p098: NonNullObject = NonNullObject("98"), + val p099: NonNullObject = NonNullObject("99"), + val p100: NonNullObject = NonNullObject("100"), + val p101: NonNullObject = NonNullObject("101"), + val p102: NonNullObject = NonNullObject("102"), + val p103: NonNullObject = NonNullObject("103"), + val p104: NonNullObject = NonNullObject("104"), + val p105: NonNullObject = NonNullObject("105"), + val p106: NonNullObject = NonNullObject("106"), + val p107: NonNullObject = NonNullObject("107"), + val p108: NonNullObject = NonNullObject("108"), + val p109: NonNullObject = NonNullObject("109"), + val p110: NonNullObject = NonNullObject("110"), + val p111: NonNullObject = NonNullObject("111"), + val p112: NonNullObject = NonNullObject("112"), + val p113: NonNullObject = NonNullObject("113"), + val p114: NonNullObject = NonNullObject("114"), + val p115: NonNullObject = NonNullObject("115"), + val p116: NonNullObject = NonNullObject("116"), + val p117: NonNullObject = NonNullObject("117"), + val p118: NonNullObject = NonNullObject("118"), + val p119: NonNullObject = NonNullObject("119"), + val p120: NonNullObject = NonNullObject("120"), + val p121: NonNullObject = NonNullObject("121"), + val p122: NonNullObject = NonNullObject("122"), + val p123: NonNullObject = NonNullObject("123"), + val p124: NonNullObject = NonNullObject("124"), + val p125: NonNullObject = NonNullObject("125"), + val p126: NonNullObject = NonNullObject("126"), + val p127: NonNullObject = NonNullObject("127"), + val p128: NonNullObject = NonNullObject("128"), + val p129: NonNullObject = NonNullObject("129"), + val p130: NonNullObject = NonNullObject("130"), + val p131: NonNullObject = NonNullObject("131"), + val p132: NonNullObject = NonNullObject("132"), + val p133: NonNullObject = NonNullObject("133"), + val p134: NonNullObject = NonNullObject("134"), + val p135: NonNullObject = NonNullObject("135"), + val p136: NonNullObject = NonNullObject("136"), + val p137: NonNullObject = NonNullObject("137"), + val p138: NonNullObject = NonNullObject("138"), + val p139: NonNullObject = NonNullObject("139"), + val p140: NonNullObject = NonNullObject("140"), + val p141: NonNullObject = NonNullObject("141"), + val p142: NonNullObject = NonNullObject("142"), + val p143: NonNullObject = NonNullObject("143"), + val p144: NonNullObject = NonNullObject("144"), + val p145: NonNullObject = NonNullObject("145"), + val p146: NonNullObject = NonNullObject("146"), + val p147: NonNullObject = NonNullObject("147"), + val p148: NonNullObject = NonNullObject("148"), + val p149: NonNullObject = NonNullObject("149"), + val p150: NonNullObject = NonNullObject("150"), + val p151: NonNullObject = NonNullObject("151"), + val p152: NonNullObject = NonNullObject("152"), + val p153: NonNullObject = NonNullObject("153"), + val p154: NonNullObject = NonNullObject("154"), + val p155: NonNullObject = NonNullObject("155"), + val p156: NonNullObject = NonNullObject("156"), + val p157: NonNullObject = NonNullObject("157"), + val p158: NonNullObject = NonNullObject("158"), + val p159: NonNullObject = NonNullObject("159"), + val p160: NonNullObject = NonNullObject("160"), + val p161: NonNullObject = NonNullObject("161"), + val p162: NonNullObject = NonNullObject("162"), + val p163: NonNullObject = NonNullObject("163"), + val p164: NonNullObject = NonNullObject("164"), + val p165: NonNullObject = NonNullObject("165"), + val p166: NonNullObject = NonNullObject("166"), + val p167: NonNullObject = NonNullObject("167"), + val p168: NonNullObject = NonNullObject("168"), + val p169: NonNullObject = NonNullObject("169"), + val p170: NonNullObject = NonNullObject("170"), + val p171: NonNullObject = NonNullObject("171"), + val p172: NonNullObject = NonNullObject("172"), + val p173: NonNullObject = NonNullObject("173"), + val p174: NonNullObject = NonNullObject("174"), + val p175: NonNullObject = NonNullObject("175"), + val p176: NonNullObject = NonNullObject("176"), + val p177: NonNullObject = NonNullObject("177"), + val p178: NonNullObject = NonNullObject("178"), + val p179: NonNullObject = NonNullObject("179"), + val p180: NonNullObject = NonNullObject("180"), + val p181: NonNullObject = NonNullObject("181"), + val p182: NonNullObject = NonNullObject("182"), + val p183: NonNullObject = NonNullObject("183"), + val p184: NonNullObject = NonNullObject("184"), + val p185: NonNullObject = NonNullObject("185"), + val p186: NonNullObject = NonNullObject("186"), + val p187: NonNullObject = NonNullObject("187"), + val p188: NonNullObject = NonNullObject("188"), + val p189: NonNullObject = NonNullObject("189"), + val p190: NonNullObject = NonNullObject("190"), + val p191: NonNullObject = NonNullObject("191"), + val p192: NonNullObject = NonNullObject("192"), + val p193: NonNullObject = NonNullObject("193"), + val p194: NonNullObject = NonNullObject("194"), + val p195: NonNullObject = NonNullObject("195"), + val p196: NonNullObject = NonNullObject("196"), + val p197: NonNullObject = NonNullObject("197"), + val p198: NonNullObject = NonNullObject("198"), + val p199: NonNullObject = NonNullObject("199"), + val p200: NonNullObject = NonNullObject("200"), + val p201: NonNullObject = NonNullObject("201"), + val p202: NonNullObject = NonNullObject("202"), + val p203: NonNullObject = NonNullObject("203"), + val p204: NonNullObject = NonNullObject("204"), + val p205: NonNullObject = NonNullObject("205"), + val p206: NonNullObject = NonNullObject("206"), + val p207: NonNullObject = NonNullObject("207"), + val p208: NonNullObject = NonNullObject("208"), + val p209: NonNullObject = NonNullObject("209"), + val p210: NonNullObject = NonNullObject("210"), + val p211: NonNullObject = NonNullObject("211"), + val p212: NonNullObject = NonNullObject("212"), + val p213: NonNullObject = NonNullObject("213"), + val p214: NonNullObject = NonNullObject("214"), + val p215: NonNullObject = NonNullObject("215"), + val p216: NonNullObject = NonNullObject("216"), + val p217: NonNullObject = NonNullObject("217"), + val p218: NonNullObject = NonNullObject("218"), + val p219: NonNullObject = NonNullObject("219"), + val p220: NonNullObject = NonNullObject("220"), + val p221: NonNullObject = NonNullObject("221"), + val p222: NonNullObject = NonNullObject("222"), + val p223: NonNullObject = NonNullObject("223"), + val p224: NonNullObject = NonNullObject("224"), + val p225: NonNullObject = NonNullObject("225"), + val p226: NonNullObject = NonNullObject("226"), + val p227: NonNullObject = NonNullObject("227"), + val p228: NonNullObject = NonNullObject("228"), + val p229: NonNullObject = NonNullObject("229"), + val p230: NonNullObject = NonNullObject("230"), + val p231: NonNullObject = NonNullObject("231"), + val p232: NonNullObject = NonNullObject("232"), + val p233: NonNullObject = NonNullObject("233"), + val p234: NonNullObject = NonNullObject("234"), + val p235: NonNullObject = NonNullObject("235"), + val p236: NonNullObject = NonNullObject("236"), + val p237: NonNullObject = NonNullObject("237"), + val p238: NonNullObject = NonNullObject("238"), + val p239: NonNullObject = NonNullObject("239"), + val p240: NonNullObject = NonNullObject("240"), + val p241: NonNullObject = NonNullObject("241"), + val p242: NonNullObject = NonNullObject("242"), + val p243: NonNullObject = NonNullObject("243"), + val p244: NonNullObject = NonNullObject("244") + ) + + @Test + fun testMax() { + assertReflectEquals(DstMax(), defaultMapper.readValue("{}")) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByConstructorWithoutDefaultArgumentsTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByConstructorWithoutDefaultArgumentsTest.kt new file mode 100644 index 00000000..8c949770 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByConstructorWithoutDefaultArgumentsTest.kt @@ -0,0 +1,515 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.nonNullObject + +import com.fasterxml.jackson.module.kotlin.assertReflectEquals +import com.fasterxml.jackson.module.kotlin.callPrimaryConstructor +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NonNullObject +import org.junit.Assert.assertEquals +import kotlin.test.Test + +/** + * Up to argument size 32 there is one mask argument for the default argument, + * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested. + * Also, the maximum size of arguments that can be set by a constructor + * that includes a value class as an argument is 253 (one less by DefaultConstructorMarker), so test that case as well. + */ +class DeserializeByConstructorWithoutDefaultArgumentsTest { + data class Dst32( + val p00: NonNullObject, + val p01: NonNullObject, + val p02: NonNullObject, + val p03: NonNullObject, + val p04: NonNullObject, + val p05: NonNullObject, + val p06: NonNullObject, + val p07: NonNullObject, + val p08: NonNullObject, + val p09: NonNullObject, + val p10: NonNullObject, + val p11: NonNullObject, + val p12: NonNullObject, + val p13: NonNullObject, + val p14: NonNullObject, + val p15: NonNullObject, + val p16: NonNullObject, + val p17: NonNullObject, + val p18: NonNullObject, + val p19: NonNullObject, + val p20: NonNullObject, + val p21: NonNullObject, + val p22: NonNullObject, + val p23: NonNullObject, + val p24: NonNullObject, + val p25: NonNullObject, + val p26: NonNullObject, + val p27: NonNullObject, + val p28: NonNullObject, + val p29: NonNullObject, + val p30: NonNullObject, + val p31: NonNullObject + ) + + @Test + fun test32() { + val expected = callPrimaryConstructor { NonNullObject(it.name!!) } + val src = defaultMapper.writeValueAsString(expected) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst33( + val p00: NonNullObject, + val p01: NonNullObject, + val p02: NonNullObject, + val p03: NonNullObject, + val p04: NonNullObject, + val p05: NonNullObject, + val p06: NonNullObject, + val p07: NonNullObject, + val p08: NonNullObject, + val p09: NonNullObject, + val p10: NonNullObject, + val p11: NonNullObject, + val p12: NonNullObject, + val p13: NonNullObject, + val p14: NonNullObject, + val p15: NonNullObject, + val p16: NonNullObject, + val p17: NonNullObject, + val p18: NonNullObject, + val p19: NonNullObject, + val p20: NonNullObject, + val p21: NonNullObject, + val p22: NonNullObject, + val p23: NonNullObject, + val p24: NonNullObject, + val p25: NonNullObject, + val p26: NonNullObject, + val p27: NonNullObject, + val p28: NonNullObject, + val p29: NonNullObject, + val p30: NonNullObject, + val p31: NonNullObject, + val p32: NonNullObject + ) + + @Test + fun test33() { + val expected = callPrimaryConstructor { NonNullObject(it.name!!) } + val src = defaultMapper.writeValueAsString(expected) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst64( + val p00: NonNullObject, + val p01: NonNullObject, + val p02: NonNullObject, + val p03: NonNullObject, + val p04: NonNullObject, + val p05: NonNullObject, + val p06: NonNullObject, + val p07: NonNullObject, + val p08: NonNullObject, + val p09: NonNullObject, + val p10: NonNullObject, + val p11: NonNullObject, + val p12: NonNullObject, + val p13: NonNullObject, + val p14: NonNullObject, + val p15: NonNullObject, + val p16: NonNullObject, + val p17: NonNullObject, + val p18: NonNullObject, + val p19: NonNullObject, + val p20: NonNullObject, + val p21: NonNullObject, + val p22: NonNullObject, + val p23: NonNullObject, + val p24: NonNullObject, + val p25: NonNullObject, + val p26: NonNullObject, + val p27: NonNullObject, + val p28: NonNullObject, + val p29: NonNullObject, + val p30: NonNullObject, + val p31: NonNullObject, + val p32: NonNullObject, + val p33: NonNullObject, + val p34: NonNullObject, + val p35: NonNullObject, + val p36: NonNullObject, + val p37: NonNullObject, + val p38: NonNullObject, + val p39: NonNullObject, + val p40: NonNullObject, + val p41: NonNullObject, + val p42: NonNullObject, + val p43: NonNullObject, + val p44: NonNullObject, + val p45: NonNullObject, + val p46: NonNullObject, + val p47: NonNullObject, + val p48: NonNullObject, + val p49: NonNullObject, + val p50: NonNullObject, + val p51: NonNullObject, + val p52: NonNullObject, + val p53: NonNullObject, + val p54: NonNullObject, + val p55: NonNullObject, + val p56: NonNullObject, + val p57: NonNullObject, + val p58: NonNullObject, + val p59: NonNullObject, + val p60: NonNullObject, + val p61: NonNullObject, + val p62: NonNullObject, + val p63: NonNullObject + ) + + @Test + fun test64() { + val expected = callPrimaryConstructor { NonNullObject(it.name!!) } + val src = defaultMapper.writeValueAsString(expected) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst65( + val p00: NonNullObject, + val p01: NonNullObject, + val p02: NonNullObject, + val p03: NonNullObject, + val p04: NonNullObject, + val p05: NonNullObject, + val p06: NonNullObject, + val p07: NonNullObject, + val p08: NonNullObject, + val p09: NonNullObject, + val p10: NonNullObject, + val p11: NonNullObject, + val p12: NonNullObject, + val p13: NonNullObject, + val p14: NonNullObject, + val p15: NonNullObject, + val p16: NonNullObject, + val p17: NonNullObject, + val p18: NonNullObject, + val p19: NonNullObject, + val p20: NonNullObject, + val p21: NonNullObject, + val p22: NonNullObject, + val p23: NonNullObject, + val p24: NonNullObject, + val p25: NonNullObject, + val p26: NonNullObject, + val p27: NonNullObject, + val p28: NonNullObject, + val p29: NonNullObject, + val p30: NonNullObject, + val p31: NonNullObject, + val p32: NonNullObject, + val p33: NonNullObject, + val p34: NonNullObject, + val p35: NonNullObject, + val p36: NonNullObject, + val p37: NonNullObject, + val p38: NonNullObject, + val p39: NonNullObject, + val p40: NonNullObject, + val p41: NonNullObject, + val p42: NonNullObject, + val p43: NonNullObject, + val p44: NonNullObject, + val p45: NonNullObject, + val p46: NonNullObject, + val p47: NonNullObject, + val p48: NonNullObject, + val p49: NonNullObject, + val p50: NonNullObject, + val p51: NonNullObject, + val p52: NonNullObject, + val p53: NonNullObject, + val p54: NonNullObject, + val p55: NonNullObject, + val p56: NonNullObject, + val p57: NonNullObject, + val p58: NonNullObject, + val p59: NonNullObject, + val p60: NonNullObject, + val p61: NonNullObject, + val p62: NonNullObject, + val p63: NonNullObject, + val p64: NonNullObject + ) + + @Test + fun test65() { + val expected = callPrimaryConstructor { NonNullObject(it.name!!) } + val src = defaultMapper.writeValueAsString(expected) + assertEquals(expected, defaultMapper.readValue(src)) + } + + // It cannot be a data class because the generated method would exceed the argument size limit. + class DstMax( + val p000: NonNullObject, + val p001: NonNullObject, + val p002: NonNullObject, + val p003: NonNullObject, + val p004: NonNullObject, + val p005: NonNullObject, + val p006: NonNullObject, + val p007: NonNullObject, + val p008: NonNullObject, + val p009: NonNullObject, + val p010: NonNullObject, + val p011: NonNullObject, + val p012: NonNullObject, + val p013: NonNullObject, + val p014: NonNullObject, + val p015: NonNullObject, + val p016: NonNullObject, + val p017: NonNullObject, + val p018: NonNullObject, + val p019: NonNullObject, + val p020: NonNullObject, + val p021: NonNullObject, + val p022: NonNullObject, + val p023: NonNullObject, + val p024: NonNullObject, + val p025: NonNullObject, + val p026: NonNullObject, + val p027: NonNullObject, + val p028: NonNullObject, + val p029: NonNullObject, + val p030: NonNullObject, + val p031: NonNullObject, + val p032: NonNullObject, + val p033: NonNullObject, + val p034: NonNullObject, + val p035: NonNullObject, + val p036: NonNullObject, + val p037: NonNullObject, + val p038: NonNullObject, + val p039: NonNullObject, + val p040: NonNullObject, + val p041: NonNullObject, + val p042: NonNullObject, + val p043: NonNullObject, + val p044: NonNullObject, + val p045: NonNullObject, + val p046: NonNullObject, + val p047: NonNullObject, + val p048: NonNullObject, + val p049: NonNullObject, + val p050: NonNullObject, + val p051: NonNullObject, + val p052: NonNullObject, + val p053: NonNullObject, + val p054: NonNullObject, + val p055: NonNullObject, + val p056: NonNullObject, + val p057: NonNullObject, + val p058: NonNullObject, + val p059: NonNullObject, + val p060: NonNullObject, + val p061: NonNullObject, + val p062: NonNullObject, + val p063: NonNullObject, + val p064: NonNullObject, + val p065: NonNullObject, + val p066: NonNullObject, + val p067: NonNullObject, + val p068: NonNullObject, + val p069: NonNullObject, + val p070: NonNullObject, + val p071: NonNullObject, + val p072: NonNullObject, + val p073: NonNullObject, + val p074: NonNullObject, + val p075: NonNullObject, + val p076: NonNullObject, + val p077: NonNullObject, + val p078: NonNullObject, + val p079: NonNullObject, + val p080: NonNullObject, + val p081: NonNullObject, + val p082: NonNullObject, + val p083: NonNullObject, + val p084: NonNullObject, + val p085: NonNullObject, + val p086: NonNullObject, + val p087: NonNullObject, + val p088: NonNullObject, + val p089: NonNullObject, + val p090: NonNullObject, + val p091: NonNullObject, + val p092: NonNullObject, + val p093: NonNullObject, + val p094: NonNullObject, + val p095: NonNullObject, + val p096: NonNullObject, + val p097: NonNullObject, + val p098: NonNullObject, + val p099: NonNullObject, + val p100: NonNullObject, + val p101: NonNullObject, + val p102: NonNullObject, + val p103: NonNullObject, + val p104: NonNullObject, + val p105: NonNullObject, + val p106: NonNullObject, + val p107: NonNullObject, + val p108: NonNullObject, + val p109: NonNullObject, + val p110: NonNullObject, + val p111: NonNullObject, + val p112: NonNullObject, + val p113: NonNullObject, + val p114: NonNullObject, + val p115: NonNullObject, + val p116: NonNullObject, + val p117: NonNullObject, + val p118: NonNullObject, + val p119: NonNullObject, + val p120: NonNullObject, + val p121: NonNullObject, + val p122: NonNullObject, + val p123: NonNullObject, + val p124: NonNullObject, + val p125: NonNullObject, + val p126: NonNullObject, + val p127: NonNullObject, + val p128: NonNullObject, + val p129: NonNullObject, + val p130: NonNullObject, + val p131: NonNullObject, + val p132: NonNullObject, + val p133: NonNullObject, + val p134: NonNullObject, + val p135: NonNullObject, + val p136: NonNullObject, + val p137: NonNullObject, + val p138: NonNullObject, + val p139: NonNullObject, + val p140: NonNullObject, + val p141: NonNullObject, + val p142: NonNullObject, + val p143: NonNullObject, + val p144: NonNullObject, + val p145: NonNullObject, + val p146: NonNullObject, + val p147: NonNullObject, + val p148: NonNullObject, + val p149: NonNullObject, + val p150: NonNullObject, + val p151: NonNullObject, + val p152: NonNullObject, + val p153: NonNullObject, + val p154: NonNullObject, + val p155: NonNullObject, + val p156: NonNullObject, + val p157: NonNullObject, + val p158: NonNullObject, + val p159: NonNullObject, + val p160: NonNullObject, + val p161: NonNullObject, + val p162: NonNullObject, + val p163: NonNullObject, + val p164: NonNullObject, + val p165: NonNullObject, + val p166: NonNullObject, + val p167: NonNullObject, + val p168: NonNullObject, + val p169: NonNullObject, + val p170: NonNullObject, + val p171: NonNullObject, + val p172: NonNullObject, + val p173: NonNullObject, + val p174: NonNullObject, + val p175: NonNullObject, + val p176: NonNullObject, + val p177: NonNullObject, + val p178: NonNullObject, + val p179: NonNullObject, + val p180: NonNullObject, + val p181: NonNullObject, + val p182: NonNullObject, + val p183: NonNullObject, + val p184: NonNullObject, + val p185: NonNullObject, + val p186: NonNullObject, + val p187: NonNullObject, + val p188: NonNullObject, + val p189: NonNullObject, + val p190: NonNullObject, + val p191: NonNullObject, + val p192: NonNullObject, + val p193: NonNullObject, + val p194: NonNullObject, + val p195: NonNullObject, + val p196: NonNullObject, + val p197: NonNullObject, + val p198: NonNullObject, + val p199: NonNullObject, + val p200: NonNullObject, + val p201: NonNullObject, + val p202: NonNullObject, + val p203: NonNullObject, + val p204: NonNullObject, + val p205: NonNullObject, + val p206: NonNullObject, + val p207: NonNullObject, + val p208: NonNullObject, + val p209: NonNullObject, + val p210: NonNullObject, + val p211: NonNullObject, + val p212: NonNullObject, + val p213: NonNullObject, + val p214: NonNullObject, + val p215: NonNullObject, + val p216: NonNullObject, + val p217: NonNullObject, + val p218: NonNullObject, + val p219: NonNullObject, + val p220: NonNullObject, + val p221: NonNullObject, + val p222: NonNullObject, + val p223: NonNullObject, + val p224: NonNullObject, + val p225: NonNullObject, + val p226: NonNullObject, + val p227: NonNullObject, + val p228: NonNullObject, + val p229: NonNullObject, + val p230: NonNullObject, + val p231: NonNullObject, + val p232: NonNullObject, + val p233: NonNullObject, + val p234: NonNullObject, + val p235: NonNullObject, + val p236: NonNullObject, + val p237: NonNullObject, + val p238: NonNullObject, + val p239: NonNullObject, + val p240: NonNullObject, + val p241: NonNullObject, + val p242: NonNullObject, + val p243: NonNullObject, + val p244: NonNullObject, + val p245: NonNullObject, + val p246: NonNullObject, + val p247: NonNullObject, + val p248: NonNullObject, + val p249: NonNullObject, + val p250: NonNullObject, + val p251: NonNullObject, + val p252: NonNullObject + ) + + @Test + fun testMax() { + val expected = callPrimaryConstructor { NonNullObject(it.name!!) } + val src = defaultMapper.writeValueAsString(expected) + assertReflectEquals(expected, defaultMapper.readValue(src)) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByFactoryWithDefaultArgumentsTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByFactoryWithDefaultArgumentsTest.kt new file mode 100644 index 00000000..809e505c --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByFactoryWithDefaultArgumentsTest.kt @@ -0,0 +1,1411 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.nonNullObject + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.module.kotlin.assertReflectEquals +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NonNullObject +import org.junit.Assert.assertEquals +import kotlin.test.Test + +/** + * Up to argument size 32 there is one mask argument for the default argument, + * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested. + * Also, the maximum argument size that can be set in the constructor is 244, so that case is tested as well. + */ +class DeserializeByFactoryWithDefaultArgumentsTest { + data class Dst32( + val p00: NonNullObject, + val p01: NonNullObject, + val p02: NonNullObject, + val p03: NonNullObject, + val p04: NonNullObject, + val p05: NonNullObject, + val p06: NonNullObject, + val p07: NonNullObject, + val p08: NonNullObject, + val p09: NonNullObject, + val p10: NonNullObject, + val p11: NonNullObject, + val p12: NonNullObject, + val p13: NonNullObject, + val p14: NonNullObject, + val p15: NonNullObject, + val p16: NonNullObject, + val p17: NonNullObject, + val p18: NonNullObject, + val p19: NonNullObject, + val p20: NonNullObject, + val p21: NonNullObject, + val p22: NonNullObject, + val p23: NonNullObject, + val p24: NonNullObject, + val p25: NonNullObject, + val p26: NonNullObject, + val p27: NonNullObject, + val p28: NonNullObject, + val p29: NonNullObject, + val p30: NonNullObject, + val p31: NonNullObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NonNullObject = NonNullObject("p00"), + q01: NonNullObject = NonNullObject("p01"), + q02: NonNullObject = NonNullObject("p02"), + q03: NonNullObject = NonNullObject("p03"), + q04: NonNullObject = NonNullObject("p04"), + q05: NonNullObject = NonNullObject("p05"), + q06: NonNullObject = NonNullObject("p06"), + q07: NonNullObject = NonNullObject("p07"), + q08: NonNullObject = NonNullObject("p08"), + q09: NonNullObject = NonNullObject("p09"), + q10: NonNullObject = NonNullObject("p10"), + q11: NonNullObject = NonNullObject("p11"), + q12: NonNullObject = NonNullObject("p12"), + q13: NonNullObject = NonNullObject("p13"), + q14: NonNullObject = NonNullObject("p14"), + q15: NonNullObject = NonNullObject("p15"), + q16: NonNullObject = NonNullObject("p16"), + q17: NonNullObject = NonNullObject("p17"), + q18: NonNullObject = NonNullObject("p18"), + q19: NonNullObject = NonNullObject("p19"), + q20: NonNullObject = NonNullObject("p20"), + q21: NonNullObject = NonNullObject("p21"), + q22: NonNullObject = NonNullObject("p22"), + q23: NonNullObject = NonNullObject("p23"), + q24: NonNullObject = NonNullObject("p24"), + q25: NonNullObject = NonNullObject("p25"), + q26: NonNullObject = NonNullObject("p26"), + q27: NonNullObject = NonNullObject("p27"), + q28: NonNullObject = NonNullObject("p28"), + q29: NonNullObject = NonNullObject("p29"), + q30: NonNullObject = NonNullObject("p30"), + q31: NonNullObject = NonNullObject("p31") + ) = Dst32( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31 + ) + } + } + + @Test + fun test32() { + assertEquals(Dst32.creator(), defaultMapper.readValue("{}")) + } + + data class Dst33( + val p00: NonNullObject, + val p01: NonNullObject, + val p02: NonNullObject, + val p03: NonNullObject, + val p04: NonNullObject, + val p05: NonNullObject, + val p06: NonNullObject, + val p07: NonNullObject, + val p08: NonNullObject, + val p09: NonNullObject, + val p10: NonNullObject, + val p11: NonNullObject, + val p12: NonNullObject, + val p13: NonNullObject, + val p14: NonNullObject, + val p15: NonNullObject, + val p16: NonNullObject, + val p17: NonNullObject, + val p18: NonNullObject, + val p19: NonNullObject, + val p20: NonNullObject, + val p21: NonNullObject, + val p22: NonNullObject, + val p23: NonNullObject, + val p24: NonNullObject, + val p25: NonNullObject, + val p26: NonNullObject, + val p27: NonNullObject, + val p28: NonNullObject, + val p29: NonNullObject, + val p30: NonNullObject, + val p31: NonNullObject, + val p32: NonNullObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NonNullObject = NonNullObject("p00"), + q01: NonNullObject = NonNullObject("p01"), + q02: NonNullObject = NonNullObject("p02"), + q03: NonNullObject = NonNullObject("p03"), + q04: NonNullObject = NonNullObject("p04"), + q05: NonNullObject = NonNullObject("p05"), + q06: NonNullObject = NonNullObject("p06"), + q07: NonNullObject = NonNullObject("p07"), + q08: NonNullObject = NonNullObject("p08"), + q09: NonNullObject = NonNullObject("p09"), + q10: NonNullObject = NonNullObject("p10"), + q11: NonNullObject = NonNullObject("p11"), + q12: NonNullObject = NonNullObject("p12"), + q13: NonNullObject = NonNullObject("p13"), + q14: NonNullObject = NonNullObject("p14"), + q15: NonNullObject = NonNullObject("p15"), + q16: NonNullObject = NonNullObject("p16"), + q17: NonNullObject = NonNullObject("p17"), + q18: NonNullObject = NonNullObject("p18"), + q19: NonNullObject = NonNullObject("p19"), + q20: NonNullObject = NonNullObject("p20"), + q21: NonNullObject = NonNullObject("p21"), + q22: NonNullObject = NonNullObject("p22"), + q23: NonNullObject = NonNullObject("p23"), + q24: NonNullObject = NonNullObject("p24"), + q25: NonNullObject = NonNullObject("p25"), + q26: NonNullObject = NonNullObject("p26"), + q27: NonNullObject = NonNullObject("p27"), + q28: NonNullObject = NonNullObject("p28"), + q29: NonNullObject = NonNullObject("p29"), + q30: NonNullObject = NonNullObject("p30"), + q31: NonNullObject = NonNullObject("p31"), + q32: NonNullObject = NonNullObject("p32") + ) = Dst33( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32 + ) + } + } + + @Test + fun test33() { + assertEquals(Dst33.creator(), defaultMapper.readValue("{}")) + } + + data class Dst64( + val p00: NonNullObject, + val p01: NonNullObject, + val p02: NonNullObject, + val p03: NonNullObject, + val p04: NonNullObject, + val p05: NonNullObject, + val p06: NonNullObject, + val p07: NonNullObject, + val p08: NonNullObject, + val p09: NonNullObject, + val p10: NonNullObject, + val p11: NonNullObject, + val p12: NonNullObject, + val p13: NonNullObject, + val p14: NonNullObject, + val p15: NonNullObject, + val p16: NonNullObject, + val p17: NonNullObject, + val p18: NonNullObject, + val p19: NonNullObject, + val p20: NonNullObject, + val p21: NonNullObject, + val p22: NonNullObject, + val p23: NonNullObject, + val p24: NonNullObject, + val p25: NonNullObject, + val p26: NonNullObject, + val p27: NonNullObject, + val p28: NonNullObject, + val p29: NonNullObject, + val p30: NonNullObject, + val p31: NonNullObject, + val p32: NonNullObject, + val p33: NonNullObject, + val p34: NonNullObject, + val p35: NonNullObject, + val p36: NonNullObject, + val p37: NonNullObject, + val p38: NonNullObject, + val p39: NonNullObject, + val p40: NonNullObject, + val p41: NonNullObject, + val p42: NonNullObject, + val p43: NonNullObject, + val p44: NonNullObject, + val p45: NonNullObject, + val p46: NonNullObject, + val p47: NonNullObject, + val p48: NonNullObject, + val p49: NonNullObject, + val p50: NonNullObject, + val p51: NonNullObject, + val p52: NonNullObject, + val p53: NonNullObject, + val p54: NonNullObject, + val p55: NonNullObject, + val p56: NonNullObject, + val p57: NonNullObject, + val p58: NonNullObject, + val p59: NonNullObject, + val p60: NonNullObject, + val p61: NonNullObject, + val p62: NonNullObject, + val p63: NonNullObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NonNullObject = NonNullObject("p00"), + q01: NonNullObject = NonNullObject("p01"), + q02: NonNullObject = NonNullObject("p02"), + q03: NonNullObject = NonNullObject("p03"), + q04: NonNullObject = NonNullObject("p04"), + q05: NonNullObject = NonNullObject("p05"), + q06: NonNullObject = NonNullObject("p06"), + q07: NonNullObject = NonNullObject("p07"), + q08: NonNullObject = NonNullObject("p08"), + q09: NonNullObject = NonNullObject("p09"), + q10: NonNullObject = NonNullObject("p10"), + q11: NonNullObject = NonNullObject("p11"), + q12: NonNullObject = NonNullObject("p12"), + q13: NonNullObject = NonNullObject("p13"), + q14: NonNullObject = NonNullObject("p14"), + q15: NonNullObject = NonNullObject("p15"), + q16: NonNullObject = NonNullObject("p16"), + q17: NonNullObject = NonNullObject("p17"), + q18: NonNullObject = NonNullObject("p18"), + q19: NonNullObject = NonNullObject("p19"), + q20: NonNullObject = NonNullObject("p20"), + q21: NonNullObject = NonNullObject("p21"), + q22: NonNullObject = NonNullObject("p22"), + q23: NonNullObject = NonNullObject("p23"), + q24: NonNullObject = NonNullObject("p24"), + q25: NonNullObject = NonNullObject("p25"), + q26: NonNullObject = NonNullObject("p26"), + q27: NonNullObject = NonNullObject("p27"), + q28: NonNullObject = NonNullObject("p28"), + q29: NonNullObject = NonNullObject("p29"), + q30: NonNullObject = NonNullObject("p30"), + q31: NonNullObject = NonNullObject("p31"), + q32: NonNullObject = NonNullObject("p32"), + q33: NonNullObject = NonNullObject("p33"), + q34: NonNullObject = NonNullObject("p34"), + q35: NonNullObject = NonNullObject("p35"), + q36: NonNullObject = NonNullObject("p36"), + q37: NonNullObject = NonNullObject("p37"), + q38: NonNullObject = NonNullObject("p38"), + q39: NonNullObject = NonNullObject("p39"), + q40: NonNullObject = NonNullObject("p40"), + q41: NonNullObject = NonNullObject("p41"), + q42: NonNullObject = NonNullObject("p42"), + q43: NonNullObject = NonNullObject("p43"), + q44: NonNullObject = NonNullObject("p44"), + q45: NonNullObject = NonNullObject("p45"), + q46: NonNullObject = NonNullObject("p46"), + q47: NonNullObject = NonNullObject("p47"), + q48: NonNullObject = NonNullObject("p48"), + q49: NonNullObject = NonNullObject("p49"), + q50: NonNullObject = NonNullObject("p50"), + q51: NonNullObject = NonNullObject("p51"), + q52: NonNullObject = NonNullObject("p52"), + q53: NonNullObject = NonNullObject("p53"), + q54: NonNullObject = NonNullObject("p54"), + q55: NonNullObject = NonNullObject("p55"), + q56: NonNullObject = NonNullObject("p56"), + q57: NonNullObject = NonNullObject("p57"), + q58: NonNullObject = NonNullObject("p58"), + q59: NonNullObject = NonNullObject("p59"), + q60: NonNullObject = NonNullObject("p60"), + q61: NonNullObject = NonNullObject("p61"), + q62: NonNullObject = NonNullObject("p62"), + q63: NonNullObject = NonNullObject("p63") + ) = Dst64( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32, + q33, + q34, + q35, + q36, + q37, + q38, + q39, + q40, + q41, + q42, + q43, + q44, + q45, + q46, + q47, + q48, + q49, + q50, + q51, + q52, + q53, + q54, + q55, + q56, + q57, + q58, + q59, + q60, + q61, + q62, + q63 + ) + } + } + + @Test + fun test64() { + assertEquals(Dst64.creator(), defaultMapper.readValue("{}")) + } + + data class Dst65( + val p00: NonNullObject, + val p01: NonNullObject, + val p02: NonNullObject, + val p03: NonNullObject, + val p04: NonNullObject, + val p05: NonNullObject, + val p06: NonNullObject, + val p07: NonNullObject, + val p08: NonNullObject, + val p09: NonNullObject, + val p10: NonNullObject, + val p11: NonNullObject, + val p12: NonNullObject, + val p13: NonNullObject, + val p14: NonNullObject, + val p15: NonNullObject, + val p16: NonNullObject, + val p17: NonNullObject, + val p18: NonNullObject, + val p19: NonNullObject, + val p20: NonNullObject, + val p21: NonNullObject, + val p22: NonNullObject, + val p23: NonNullObject, + val p24: NonNullObject, + val p25: NonNullObject, + val p26: NonNullObject, + val p27: NonNullObject, + val p28: NonNullObject, + val p29: NonNullObject, + val p30: NonNullObject, + val p31: NonNullObject, + val p32: NonNullObject, + val p33: NonNullObject, + val p34: NonNullObject, + val p35: NonNullObject, + val p36: NonNullObject, + val p37: NonNullObject, + val p38: NonNullObject, + val p39: NonNullObject, + val p40: NonNullObject, + val p41: NonNullObject, + val p42: NonNullObject, + val p43: NonNullObject, + val p44: NonNullObject, + val p45: NonNullObject, + val p46: NonNullObject, + val p47: NonNullObject, + val p48: NonNullObject, + val p49: NonNullObject, + val p50: NonNullObject, + val p51: NonNullObject, + val p52: NonNullObject, + val p53: NonNullObject, + val p54: NonNullObject, + val p55: NonNullObject, + val p56: NonNullObject, + val p57: NonNullObject, + val p58: NonNullObject, + val p59: NonNullObject, + val p60: NonNullObject, + val p61: NonNullObject, + val p62: NonNullObject, + val p63: NonNullObject, + val p64: NonNullObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NonNullObject = NonNullObject("p00"), + q01: NonNullObject = NonNullObject("p01"), + q02: NonNullObject = NonNullObject("p02"), + q03: NonNullObject = NonNullObject("p03"), + q04: NonNullObject = NonNullObject("p04"), + q05: NonNullObject = NonNullObject("p05"), + q06: NonNullObject = NonNullObject("p06"), + q07: NonNullObject = NonNullObject("p07"), + q08: NonNullObject = NonNullObject("p08"), + q09: NonNullObject = NonNullObject("p09"), + q10: NonNullObject = NonNullObject("p10"), + q11: NonNullObject = NonNullObject("p11"), + q12: NonNullObject = NonNullObject("p12"), + q13: NonNullObject = NonNullObject("p13"), + q14: NonNullObject = NonNullObject("p14"), + q15: NonNullObject = NonNullObject("p15"), + q16: NonNullObject = NonNullObject("p16"), + q17: NonNullObject = NonNullObject("p17"), + q18: NonNullObject = NonNullObject("p18"), + q19: NonNullObject = NonNullObject("p19"), + q20: NonNullObject = NonNullObject("p20"), + q21: NonNullObject = NonNullObject("p21"), + q22: NonNullObject = NonNullObject("p22"), + q23: NonNullObject = NonNullObject("p23"), + q24: NonNullObject = NonNullObject("p24"), + q25: NonNullObject = NonNullObject("p25"), + q26: NonNullObject = NonNullObject("p26"), + q27: NonNullObject = NonNullObject("p27"), + q28: NonNullObject = NonNullObject("p28"), + q29: NonNullObject = NonNullObject("p29"), + q30: NonNullObject = NonNullObject("p30"), + q31: NonNullObject = NonNullObject("p31"), + q32: NonNullObject = NonNullObject("p32"), + q33: NonNullObject = NonNullObject("p33"), + q34: NonNullObject = NonNullObject("p34"), + q35: NonNullObject = NonNullObject("p35"), + q36: NonNullObject = NonNullObject("p36"), + q37: NonNullObject = NonNullObject("p37"), + q38: NonNullObject = NonNullObject("p38"), + q39: NonNullObject = NonNullObject("p39"), + q40: NonNullObject = NonNullObject("p40"), + q41: NonNullObject = NonNullObject("p41"), + q42: NonNullObject = NonNullObject("p42"), + q43: NonNullObject = NonNullObject("p43"), + q44: NonNullObject = NonNullObject("p44"), + q45: NonNullObject = NonNullObject("p45"), + q46: NonNullObject = NonNullObject("p46"), + q47: NonNullObject = NonNullObject("p47"), + q48: NonNullObject = NonNullObject("p48"), + q49: NonNullObject = NonNullObject("p49"), + q50: NonNullObject = NonNullObject("p50"), + q51: NonNullObject = NonNullObject("p51"), + q52: NonNullObject = NonNullObject("p52"), + q53: NonNullObject = NonNullObject("p53"), + q54: NonNullObject = NonNullObject("p54"), + q55: NonNullObject = NonNullObject("p55"), + q56: NonNullObject = NonNullObject("p56"), + q57: NonNullObject = NonNullObject("p57"), + q58: NonNullObject = NonNullObject("p58"), + q59: NonNullObject = NonNullObject("p59"), + q60: NonNullObject = NonNullObject("p60"), + q61: NonNullObject = NonNullObject("p61"), + q62: NonNullObject = NonNullObject("p62"), + q63: NonNullObject = NonNullObject("p63"), + q64: NonNullObject = NonNullObject("p64") + ) = Dst65( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32, + q33, + q34, + q35, + q36, + q37, + q38, + q39, + q40, + q41, + q42, + q43, + q44, + q45, + q46, + q47, + q48, + q49, + q50, + q51, + q52, + q53, + q54, + q55, + q56, + q57, + q58, + q59, + q60, + q61, + q62, + q63, + q64 + ) + } + } + + @Test + fun test65() { + assertEquals(Dst65.creator(), defaultMapper.readValue("{}")) + } + + // It cannot be a data class because the generated method would exceed the argument size limit. + class DstMax( + val p000: NonNullObject, + val p001: NonNullObject, + val p002: NonNullObject, + val p003: NonNullObject, + val p004: NonNullObject, + val p005: NonNullObject, + val p006: NonNullObject, + val p007: NonNullObject, + val p008: NonNullObject, + val p009: NonNullObject, + val p010: NonNullObject, + val p011: NonNullObject, + val p012: NonNullObject, + val p013: NonNullObject, + val p014: NonNullObject, + val p015: NonNullObject, + val p016: NonNullObject, + val p017: NonNullObject, + val p018: NonNullObject, + val p019: NonNullObject, + val p020: NonNullObject, + val p021: NonNullObject, + val p022: NonNullObject, + val p023: NonNullObject, + val p024: NonNullObject, + val p025: NonNullObject, + val p026: NonNullObject, + val p027: NonNullObject, + val p028: NonNullObject, + val p029: NonNullObject, + val p030: NonNullObject, + val p031: NonNullObject, + val p032: NonNullObject, + val p033: NonNullObject, + val p034: NonNullObject, + val p035: NonNullObject, + val p036: NonNullObject, + val p037: NonNullObject, + val p038: NonNullObject, + val p039: NonNullObject, + val p040: NonNullObject, + val p041: NonNullObject, + val p042: NonNullObject, + val p043: NonNullObject, + val p044: NonNullObject, + val p045: NonNullObject, + val p046: NonNullObject, + val p047: NonNullObject, + val p048: NonNullObject, + val p049: NonNullObject, + val p050: NonNullObject, + val p051: NonNullObject, + val p052: NonNullObject, + val p053: NonNullObject, + val p054: NonNullObject, + val p055: NonNullObject, + val p056: NonNullObject, + val p057: NonNullObject, + val p058: NonNullObject, + val p059: NonNullObject, + val p060: NonNullObject, + val p061: NonNullObject, + val p062: NonNullObject, + val p063: NonNullObject, + val p064: NonNullObject, + val p065: NonNullObject, + val p066: NonNullObject, + val p067: NonNullObject, + val p068: NonNullObject, + val p069: NonNullObject, + val p070: NonNullObject, + val p071: NonNullObject, + val p072: NonNullObject, + val p073: NonNullObject, + val p074: NonNullObject, + val p075: NonNullObject, + val p076: NonNullObject, + val p077: NonNullObject, + val p078: NonNullObject, + val p079: NonNullObject, + val p080: NonNullObject, + val p081: NonNullObject, + val p082: NonNullObject, + val p083: NonNullObject, + val p084: NonNullObject, + val p085: NonNullObject, + val p086: NonNullObject, + val p087: NonNullObject, + val p088: NonNullObject, + val p089: NonNullObject, + val p090: NonNullObject, + val p091: NonNullObject, + val p092: NonNullObject, + val p093: NonNullObject, + val p094: NonNullObject, + val p095: NonNullObject, + val p096: NonNullObject, + val p097: NonNullObject, + val p098: NonNullObject, + val p099: NonNullObject, + val p100: NonNullObject, + val p101: NonNullObject, + val p102: NonNullObject, + val p103: NonNullObject, + val p104: NonNullObject, + val p105: NonNullObject, + val p106: NonNullObject, + val p107: NonNullObject, + val p108: NonNullObject, + val p109: NonNullObject, + val p110: NonNullObject, + val p111: NonNullObject, + val p112: NonNullObject, + val p113: NonNullObject, + val p114: NonNullObject, + val p115: NonNullObject, + val p116: NonNullObject, + val p117: NonNullObject, + val p118: NonNullObject, + val p119: NonNullObject, + val p120: NonNullObject, + val p121: NonNullObject, + val p122: NonNullObject, + val p123: NonNullObject, + val p124: NonNullObject, + val p125: NonNullObject, + val p126: NonNullObject, + val p127: NonNullObject, + val p128: NonNullObject, + val p129: NonNullObject, + val p130: NonNullObject, + val p131: NonNullObject, + val p132: NonNullObject, + val p133: NonNullObject, + val p134: NonNullObject, + val p135: NonNullObject, + val p136: NonNullObject, + val p137: NonNullObject, + val p138: NonNullObject, + val p139: NonNullObject, + val p140: NonNullObject, + val p141: NonNullObject, + val p142: NonNullObject, + val p143: NonNullObject, + val p144: NonNullObject, + val p145: NonNullObject, + val p146: NonNullObject, + val p147: NonNullObject, + val p148: NonNullObject, + val p149: NonNullObject, + val p150: NonNullObject, + val p151: NonNullObject, + val p152: NonNullObject, + val p153: NonNullObject, + val p154: NonNullObject, + val p155: NonNullObject, + val p156: NonNullObject, + val p157: NonNullObject, + val p158: NonNullObject, + val p159: NonNullObject, + val p160: NonNullObject, + val p161: NonNullObject, + val p162: NonNullObject, + val p163: NonNullObject, + val p164: NonNullObject, + val p165: NonNullObject, + val p166: NonNullObject, + val p167: NonNullObject, + val p168: NonNullObject, + val p169: NonNullObject, + val p170: NonNullObject, + val p171: NonNullObject, + val p172: NonNullObject, + val p173: NonNullObject, + val p174: NonNullObject, + val p175: NonNullObject, + val p176: NonNullObject, + val p177: NonNullObject, + val p178: NonNullObject, + val p179: NonNullObject, + val p180: NonNullObject, + val p181: NonNullObject, + val p182: NonNullObject, + val p183: NonNullObject, + val p184: NonNullObject, + val p185: NonNullObject, + val p186: NonNullObject, + val p187: NonNullObject, + val p188: NonNullObject, + val p189: NonNullObject, + val p190: NonNullObject, + val p191: NonNullObject, + val p192: NonNullObject, + val p193: NonNullObject, + val p194: NonNullObject, + val p195: NonNullObject, + val p196: NonNullObject, + val p197: NonNullObject, + val p198: NonNullObject, + val p199: NonNullObject, + val p200: NonNullObject, + val p201: NonNullObject, + val p202: NonNullObject, + val p203: NonNullObject, + val p204: NonNullObject, + val p205: NonNullObject, + val p206: NonNullObject, + val p207: NonNullObject, + val p208: NonNullObject, + val p209: NonNullObject, + val p210: NonNullObject, + val p211: NonNullObject, + val p212: NonNullObject, + val p213: NonNullObject, + val p214: NonNullObject, + val p215: NonNullObject, + val p216: NonNullObject, + val p217: NonNullObject, + val p218: NonNullObject, + val p219: NonNullObject, + val p220: NonNullObject, + val p221: NonNullObject, + val p222: NonNullObject, + val p223: NonNullObject, + val p224: NonNullObject, + val p225: NonNullObject, + val p226: NonNullObject, + val p227: NonNullObject, + val p228: NonNullObject, + val p229: NonNullObject, + val p230: NonNullObject, + val p231: NonNullObject, + val p232: NonNullObject, + val p233: NonNullObject, + val p234: NonNullObject, + val p235: NonNullObject, + val p236: NonNullObject, + val p237: NonNullObject, + val p238: NonNullObject, + val p239: NonNullObject, + val p240: NonNullObject, + val p241: NonNullObject, + val p242: NonNullObject, + val p243: NonNullObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q000: NonNullObject = NonNullObject("p000"), + q001: NonNullObject = NonNullObject("p001"), + q002: NonNullObject = NonNullObject("p002"), + q003: NonNullObject = NonNullObject("p003"), + q004: NonNullObject = NonNullObject("p004"), + q005: NonNullObject = NonNullObject("p005"), + q006: NonNullObject = NonNullObject("p006"), + q007: NonNullObject = NonNullObject("p007"), + q008: NonNullObject = NonNullObject("p008"), + q009: NonNullObject = NonNullObject("p009"), + q010: NonNullObject = NonNullObject("p010"), + q011: NonNullObject = NonNullObject("p011"), + q012: NonNullObject = NonNullObject("p012"), + q013: NonNullObject = NonNullObject("p013"), + q014: NonNullObject = NonNullObject("p014"), + q015: NonNullObject = NonNullObject("p015"), + q016: NonNullObject = NonNullObject("p016"), + q017: NonNullObject = NonNullObject("p017"), + q018: NonNullObject = NonNullObject("p018"), + q019: NonNullObject = NonNullObject("p019"), + q020: NonNullObject = NonNullObject("p020"), + q021: NonNullObject = NonNullObject("p021"), + q022: NonNullObject = NonNullObject("p022"), + q023: NonNullObject = NonNullObject("p023"), + q024: NonNullObject = NonNullObject("p024"), + q025: NonNullObject = NonNullObject("p025"), + q026: NonNullObject = NonNullObject("p026"), + q027: NonNullObject = NonNullObject("p027"), + q028: NonNullObject = NonNullObject("p028"), + q029: NonNullObject = NonNullObject("p029"), + q030: NonNullObject = NonNullObject("p030"), + q031: NonNullObject = NonNullObject("p031"), + q032: NonNullObject = NonNullObject("p032"), + q033: NonNullObject = NonNullObject("p033"), + q034: NonNullObject = NonNullObject("p034"), + q035: NonNullObject = NonNullObject("p035"), + q036: NonNullObject = NonNullObject("p036"), + q037: NonNullObject = NonNullObject("p037"), + q038: NonNullObject = NonNullObject("p038"), + q039: NonNullObject = NonNullObject("p039"), + q040: NonNullObject = NonNullObject("p040"), + q041: NonNullObject = NonNullObject("p041"), + q042: NonNullObject = NonNullObject("p042"), + q043: NonNullObject = NonNullObject("p043"), + q044: NonNullObject = NonNullObject("p044"), + q045: NonNullObject = NonNullObject("p045"), + q046: NonNullObject = NonNullObject("p046"), + q047: NonNullObject = NonNullObject("p047"), + q048: NonNullObject = NonNullObject("p048"), + q049: NonNullObject = NonNullObject("p049"), + q050: NonNullObject = NonNullObject("p050"), + q051: NonNullObject = NonNullObject("p051"), + q052: NonNullObject = NonNullObject("p052"), + q053: NonNullObject = NonNullObject("p053"), + q054: NonNullObject = NonNullObject("p054"), + q055: NonNullObject = NonNullObject("p055"), + q056: NonNullObject = NonNullObject("p056"), + q057: NonNullObject = NonNullObject("p057"), + q058: NonNullObject = NonNullObject("p058"), + q059: NonNullObject = NonNullObject("p059"), + q060: NonNullObject = NonNullObject("p060"), + q061: NonNullObject = NonNullObject("p061"), + q062: NonNullObject = NonNullObject("p062"), + q063: NonNullObject = NonNullObject("p063"), + q064: NonNullObject = NonNullObject("p064"), + q065: NonNullObject = NonNullObject("p065"), + q066: NonNullObject = NonNullObject("p066"), + q067: NonNullObject = NonNullObject("p067"), + q068: NonNullObject = NonNullObject("p068"), + q069: NonNullObject = NonNullObject("p069"), + q070: NonNullObject = NonNullObject("p070"), + q071: NonNullObject = NonNullObject("p071"), + q072: NonNullObject = NonNullObject("p072"), + q073: NonNullObject = NonNullObject("p073"), + q074: NonNullObject = NonNullObject("p074"), + q075: NonNullObject = NonNullObject("p075"), + q076: NonNullObject = NonNullObject("p076"), + q077: NonNullObject = NonNullObject("p077"), + q078: NonNullObject = NonNullObject("p078"), + q079: NonNullObject = NonNullObject("p079"), + q080: NonNullObject = NonNullObject("p080"), + q081: NonNullObject = NonNullObject("p081"), + q082: NonNullObject = NonNullObject("p082"), + q083: NonNullObject = NonNullObject("p083"), + q084: NonNullObject = NonNullObject("p084"), + q085: NonNullObject = NonNullObject("p085"), + q086: NonNullObject = NonNullObject("p086"), + q087: NonNullObject = NonNullObject("p087"), + q088: NonNullObject = NonNullObject("p088"), + q089: NonNullObject = NonNullObject("p089"), + q090: NonNullObject = NonNullObject("p090"), + q091: NonNullObject = NonNullObject("p091"), + q092: NonNullObject = NonNullObject("p092"), + q093: NonNullObject = NonNullObject("p093"), + q094: NonNullObject = NonNullObject("p094"), + q095: NonNullObject = NonNullObject("p095"), + q096: NonNullObject = NonNullObject("p096"), + q097: NonNullObject = NonNullObject("p097"), + q098: NonNullObject = NonNullObject("p098"), + q099: NonNullObject = NonNullObject("p099"), + q100: NonNullObject = NonNullObject("p100"), + q101: NonNullObject = NonNullObject("p101"), + q102: NonNullObject = NonNullObject("p102"), + q103: NonNullObject = NonNullObject("p103"), + q104: NonNullObject = NonNullObject("p104"), + q105: NonNullObject = NonNullObject("p105"), + q106: NonNullObject = NonNullObject("p106"), + q107: NonNullObject = NonNullObject("p107"), + q108: NonNullObject = NonNullObject("p108"), + q109: NonNullObject = NonNullObject("p109"), + q110: NonNullObject = NonNullObject("p110"), + q111: NonNullObject = NonNullObject("p111"), + q112: NonNullObject = NonNullObject("p112"), + q113: NonNullObject = NonNullObject("p113"), + q114: NonNullObject = NonNullObject("p114"), + q115: NonNullObject = NonNullObject("p115"), + q116: NonNullObject = NonNullObject("p116"), + q117: NonNullObject = NonNullObject("p117"), + q118: NonNullObject = NonNullObject("p118"), + q119: NonNullObject = NonNullObject("p119"), + q120: NonNullObject = NonNullObject("p120"), + q121: NonNullObject = NonNullObject("p121"), + q122: NonNullObject = NonNullObject("p122"), + q123: NonNullObject = NonNullObject("p123"), + q124: NonNullObject = NonNullObject("p124"), + q125: NonNullObject = NonNullObject("p125"), + q126: NonNullObject = NonNullObject("p126"), + q127: NonNullObject = NonNullObject("p127"), + q128: NonNullObject = NonNullObject("p128"), + q129: NonNullObject = NonNullObject("p129"), + q130: NonNullObject = NonNullObject("p130"), + q131: NonNullObject = NonNullObject("p131"), + q132: NonNullObject = NonNullObject("p132"), + q133: NonNullObject = NonNullObject("p133"), + q134: NonNullObject = NonNullObject("p134"), + q135: NonNullObject = NonNullObject("p135"), + q136: NonNullObject = NonNullObject("p136"), + q137: NonNullObject = NonNullObject("p137"), + q138: NonNullObject = NonNullObject("p138"), + q139: NonNullObject = NonNullObject("p139"), + q140: NonNullObject = NonNullObject("p140"), + q141: NonNullObject = NonNullObject("p141"), + q142: NonNullObject = NonNullObject("p142"), + q143: NonNullObject = NonNullObject("p143"), + q144: NonNullObject = NonNullObject("p144"), + q145: NonNullObject = NonNullObject("p145"), + q146: NonNullObject = NonNullObject("p146"), + q147: NonNullObject = NonNullObject("p147"), + q148: NonNullObject = NonNullObject("p148"), + q149: NonNullObject = NonNullObject("p149"), + q150: NonNullObject = NonNullObject("p150"), + q151: NonNullObject = NonNullObject("p151"), + q152: NonNullObject = NonNullObject("p152"), + q153: NonNullObject = NonNullObject("p153"), + q154: NonNullObject = NonNullObject("p154"), + q155: NonNullObject = NonNullObject("p155"), + q156: NonNullObject = NonNullObject("p156"), + q157: NonNullObject = NonNullObject("p157"), + q158: NonNullObject = NonNullObject("p158"), + q159: NonNullObject = NonNullObject("p159"), + q160: NonNullObject = NonNullObject("p160"), + q161: NonNullObject = NonNullObject("p161"), + q162: NonNullObject = NonNullObject("p162"), + q163: NonNullObject = NonNullObject("p163"), + q164: NonNullObject = NonNullObject("p164"), + q165: NonNullObject = NonNullObject("p165"), + q166: NonNullObject = NonNullObject("p166"), + q167: NonNullObject = NonNullObject("p167"), + q168: NonNullObject = NonNullObject("p168"), + q169: NonNullObject = NonNullObject("p169"), + q170: NonNullObject = NonNullObject("p170"), + q171: NonNullObject = NonNullObject("p171"), + q172: NonNullObject = NonNullObject("p172"), + q173: NonNullObject = NonNullObject("p173"), + q174: NonNullObject = NonNullObject("p174"), + q175: NonNullObject = NonNullObject("p175"), + q176: NonNullObject = NonNullObject("p176"), + q177: NonNullObject = NonNullObject("p177"), + q178: NonNullObject = NonNullObject("p178"), + q179: NonNullObject = NonNullObject("p179"), + q180: NonNullObject = NonNullObject("p180"), + q181: NonNullObject = NonNullObject("p181"), + q182: NonNullObject = NonNullObject("p182"), + q183: NonNullObject = NonNullObject("p183"), + q184: NonNullObject = NonNullObject("p184"), + q185: NonNullObject = NonNullObject("p185"), + q186: NonNullObject = NonNullObject("p186"), + q187: NonNullObject = NonNullObject("p187"), + q188: NonNullObject = NonNullObject("p188"), + q189: NonNullObject = NonNullObject("p189"), + q190: NonNullObject = NonNullObject("p190"), + q191: NonNullObject = NonNullObject("p191"), + q192: NonNullObject = NonNullObject("p192"), + q193: NonNullObject = NonNullObject("p193"), + q194: NonNullObject = NonNullObject("p194"), + q195: NonNullObject = NonNullObject("p195"), + q196: NonNullObject = NonNullObject("p196"), + q197: NonNullObject = NonNullObject("p197"), + q198: NonNullObject = NonNullObject("p198"), + q199: NonNullObject = NonNullObject("p199"), + q200: NonNullObject = NonNullObject("p200"), + q201: NonNullObject = NonNullObject("p201"), + q202: NonNullObject = NonNullObject("p202"), + q203: NonNullObject = NonNullObject("p203"), + q204: NonNullObject = NonNullObject("p204"), + q205: NonNullObject = NonNullObject("p205"), + q206: NonNullObject = NonNullObject("p206"), + q207: NonNullObject = NonNullObject("p207"), + q208: NonNullObject = NonNullObject("p208"), + q209: NonNullObject = NonNullObject("p209"), + q210: NonNullObject = NonNullObject("p210"), + q211: NonNullObject = NonNullObject("p211"), + q212: NonNullObject = NonNullObject("p212"), + q213: NonNullObject = NonNullObject("p213"), + q214: NonNullObject = NonNullObject("p214"), + q215: NonNullObject = NonNullObject("p215"), + q216: NonNullObject = NonNullObject("p216"), + q217: NonNullObject = NonNullObject("p217"), + q218: NonNullObject = NonNullObject("p218"), + q219: NonNullObject = NonNullObject("p219"), + q220: NonNullObject = NonNullObject("p220"), + q221: NonNullObject = NonNullObject("p221"), + q222: NonNullObject = NonNullObject("p222"), + q223: NonNullObject = NonNullObject("p223"), + q224: NonNullObject = NonNullObject("p224"), + q225: NonNullObject = NonNullObject("p225"), + q226: NonNullObject = NonNullObject("p226"), + q227: NonNullObject = NonNullObject("p227"), + q228: NonNullObject = NonNullObject("p228"), + q229: NonNullObject = NonNullObject("p229"), + q230: NonNullObject = NonNullObject("p230"), + q231: NonNullObject = NonNullObject("p231"), + q232: NonNullObject = NonNullObject("p232"), + q233: NonNullObject = NonNullObject("p233"), + q234: NonNullObject = NonNullObject("p234"), + q235: NonNullObject = NonNullObject("p235"), + q236: NonNullObject = NonNullObject("p236"), + q237: NonNullObject = NonNullObject("p237"), + q238: NonNullObject = NonNullObject("p238"), + q239: NonNullObject = NonNullObject("p239"), + q240: NonNullObject = NonNullObject("p240"), + q241: NonNullObject = NonNullObject("p241"), + q242: NonNullObject = NonNullObject("p242"), + q243: NonNullObject = NonNullObject("p243") + ) = DstMax( + q000, + q001, + q002, + q003, + q004, + q005, + q006, + q007, + q008, + q009, + q010, + q011, + q012, + q013, + q014, + q015, + q016, + q017, + q018, + q019, + q020, + q021, + q022, + q023, + q024, + q025, + q026, + q027, + q028, + q029, + q030, + q031, + q032, + q033, + q034, + q035, + q036, + q037, + q038, + q039, + q040, + q041, + q042, + q043, + q044, + q045, + q046, + q047, + q048, + q049, + q050, + q051, + q052, + q053, + q054, + q055, + q056, + q057, + q058, + q059, + q060, + q061, + q062, + q063, + q064, + q065, + q066, + q067, + q068, + q069, + q070, + q071, + q072, + q073, + q074, + q075, + q076, + q077, + q078, + q079, + q080, + q081, + q082, + q083, + q084, + q085, + q086, + q087, + q088, + q089, + q090, + q091, + q092, + q093, + q094, + q095, + q096, + q097, + q098, + q099, + q100, + q101, + q102, + q103, + q104, + q105, + q106, + q107, + q108, + q109, + q110, + q111, + q112, + q113, + q114, + q115, + q116, + q117, + q118, + q119, + q120, + q121, + q122, + q123, + q124, + q125, + q126, + q127, + q128, + q129, + q130, + q131, + q132, + q133, + q134, + q135, + q136, + q137, + q138, + q139, + q140, + q141, + q142, + q143, + q144, + q145, + q146, + q147, + q148, + q149, + q150, + q151, + q152, + q153, + q154, + q155, + q156, + q157, + q158, + q159, + q160, + q161, + q162, + q163, + q164, + q165, + q166, + q167, + q168, + q169, + q170, + q171, + q172, + q173, + q174, + q175, + q176, + q177, + q178, + q179, + q180, + q181, + q182, + q183, + q184, + q185, + q186, + q187, + q188, + q189, + q190, + q191, + q192, + q193, + q194, + q195, + q196, + q197, + q198, + q199, + q200, + q201, + q202, + q203, + q204, + q205, + q206, + q207, + q208, + q209, + q210, + q211, + q212, + q213, + q214, + q215, + q216, + q217, + q218, + q219, + q220, + q221, + q222, + q223, + q224, + q225, + q226, + q227, + q228, + q229, + q230, + q231, + q232, + q233, + q234, + q235, + q236, + q237, + q238, + q239, + q240, + q241, + q242, + q243 + ) + } + } + + @Test + fun testMax() { + assertReflectEquals(DstMax.creator(), defaultMapper.readValue("{}")) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByFactoryWithoutDefaultArgumentsTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByFactoryWithoutDefaultArgumentsTest.kt new file mode 100644 index 00000000..ebbb90db --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nonNullObject/DeserializeByFactoryWithoutDefaultArgumentsTest.kt @@ -0,0 +1,1453 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.nonNullObject + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.module.kotlin.assertReflectEquals +import com.fasterxml.jackson.module.kotlin.callPrimaryConstructor +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NonNullObject +import org.junit.Assert.assertEquals +import kotlin.test.Test + +// Convert the property p to q (but not the value) to make it an input to the factory function. +private fun replacePQ(src: String) = src.replace(Regex("""p\d+":""")) { "q" + it.value.substring(1) } + +/** + * Up to argument size 32 there is one mask argument for the default argument, + * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested. + * Also, the maximum size of arguments that can be set by a constructor + * that includes a value class as an argument is 253 (one less by DefaultConstructorMarker), so test that case as well. + */ +class DeserializeByFactoryWithoutDefaultArgumentsTest { + data class Dst32( + val p00: NonNullObject, + val p01: NonNullObject, + val p02: NonNullObject, + val p03: NonNullObject, + val p04: NonNullObject, + val p05: NonNullObject, + val p06: NonNullObject, + val p07: NonNullObject, + val p08: NonNullObject, + val p09: NonNullObject, + val p10: NonNullObject, + val p11: NonNullObject, + val p12: NonNullObject, + val p13: NonNullObject, + val p14: NonNullObject, + val p15: NonNullObject, + val p16: NonNullObject, + val p17: NonNullObject, + val p18: NonNullObject, + val p19: NonNullObject, + val p20: NonNullObject, + val p21: NonNullObject, + val p22: NonNullObject, + val p23: NonNullObject, + val p24: NonNullObject, + val p25: NonNullObject, + val p26: NonNullObject, + val p27: NonNullObject, + val p28: NonNullObject, + val p29: NonNullObject, + val p30: NonNullObject, + val p31: NonNullObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NonNullObject, + q01: NonNullObject, + q02: NonNullObject, + q03: NonNullObject, + q04: NonNullObject, + q05: NonNullObject, + q06: NonNullObject, + q07: NonNullObject, + q08: NonNullObject, + q09: NonNullObject, + q10: NonNullObject, + q11: NonNullObject, + q12: NonNullObject, + q13: NonNullObject, + q14: NonNullObject, + q15: NonNullObject, + q16: NonNullObject, + q17: NonNullObject, + q18: NonNullObject, + q19: NonNullObject, + q20: NonNullObject, + q21: NonNullObject, + q22: NonNullObject, + q23: NonNullObject, + q24: NonNullObject, + q25: NonNullObject, + q26: NonNullObject, + q27: NonNullObject, + q28: NonNullObject, + q29: NonNullObject, + q30: NonNullObject, + q31: NonNullObject + ) = Dst32( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31 + ) + } + } + + @Test + fun test32() { + val expected = callPrimaryConstructor { NonNullObject(it.name!!) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst33( + val p00: NonNullObject, + val p01: NonNullObject, + val p02: NonNullObject, + val p03: NonNullObject, + val p04: NonNullObject, + val p05: NonNullObject, + val p06: NonNullObject, + val p07: NonNullObject, + val p08: NonNullObject, + val p09: NonNullObject, + val p10: NonNullObject, + val p11: NonNullObject, + val p12: NonNullObject, + val p13: NonNullObject, + val p14: NonNullObject, + val p15: NonNullObject, + val p16: NonNullObject, + val p17: NonNullObject, + val p18: NonNullObject, + val p19: NonNullObject, + val p20: NonNullObject, + val p21: NonNullObject, + val p22: NonNullObject, + val p23: NonNullObject, + val p24: NonNullObject, + val p25: NonNullObject, + val p26: NonNullObject, + val p27: NonNullObject, + val p28: NonNullObject, + val p29: NonNullObject, + val p30: NonNullObject, + val p31: NonNullObject, + val p32: NonNullObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NonNullObject, + q01: NonNullObject, + q02: NonNullObject, + q03: NonNullObject, + q04: NonNullObject, + q05: NonNullObject, + q06: NonNullObject, + q07: NonNullObject, + q08: NonNullObject, + q09: NonNullObject, + q10: NonNullObject, + q11: NonNullObject, + q12: NonNullObject, + q13: NonNullObject, + q14: NonNullObject, + q15: NonNullObject, + q16: NonNullObject, + q17: NonNullObject, + q18: NonNullObject, + q19: NonNullObject, + q20: NonNullObject, + q21: NonNullObject, + q22: NonNullObject, + q23: NonNullObject, + q24: NonNullObject, + q25: NonNullObject, + q26: NonNullObject, + q27: NonNullObject, + q28: NonNullObject, + q29: NonNullObject, + q30: NonNullObject, + q31: NonNullObject, + q32: NonNullObject + ) = Dst33( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32 + ) + } + } + + @Test + fun test33() { + val expected = callPrimaryConstructor { NonNullObject(it.name!!) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst64( + val p00: NonNullObject, + val p01: NonNullObject, + val p02: NonNullObject, + val p03: NonNullObject, + val p04: NonNullObject, + val p05: NonNullObject, + val p06: NonNullObject, + val p07: NonNullObject, + val p08: NonNullObject, + val p09: NonNullObject, + val p10: NonNullObject, + val p11: NonNullObject, + val p12: NonNullObject, + val p13: NonNullObject, + val p14: NonNullObject, + val p15: NonNullObject, + val p16: NonNullObject, + val p17: NonNullObject, + val p18: NonNullObject, + val p19: NonNullObject, + val p20: NonNullObject, + val p21: NonNullObject, + val p22: NonNullObject, + val p23: NonNullObject, + val p24: NonNullObject, + val p25: NonNullObject, + val p26: NonNullObject, + val p27: NonNullObject, + val p28: NonNullObject, + val p29: NonNullObject, + val p30: NonNullObject, + val p31: NonNullObject, + val p32: NonNullObject, + val p33: NonNullObject, + val p34: NonNullObject, + val p35: NonNullObject, + val p36: NonNullObject, + val p37: NonNullObject, + val p38: NonNullObject, + val p39: NonNullObject, + val p40: NonNullObject, + val p41: NonNullObject, + val p42: NonNullObject, + val p43: NonNullObject, + val p44: NonNullObject, + val p45: NonNullObject, + val p46: NonNullObject, + val p47: NonNullObject, + val p48: NonNullObject, + val p49: NonNullObject, + val p50: NonNullObject, + val p51: NonNullObject, + val p52: NonNullObject, + val p53: NonNullObject, + val p54: NonNullObject, + val p55: NonNullObject, + val p56: NonNullObject, + val p57: NonNullObject, + val p58: NonNullObject, + val p59: NonNullObject, + val p60: NonNullObject, + val p61: NonNullObject, + val p62: NonNullObject, + val p63: NonNullObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NonNullObject, + q01: NonNullObject, + q02: NonNullObject, + q03: NonNullObject, + q04: NonNullObject, + q05: NonNullObject, + q06: NonNullObject, + q07: NonNullObject, + q08: NonNullObject, + q09: NonNullObject, + q10: NonNullObject, + q11: NonNullObject, + q12: NonNullObject, + q13: NonNullObject, + q14: NonNullObject, + q15: NonNullObject, + q16: NonNullObject, + q17: NonNullObject, + q18: NonNullObject, + q19: NonNullObject, + q20: NonNullObject, + q21: NonNullObject, + q22: NonNullObject, + q23: NonNullObject, + q24: NonNullObject, + q25: NonNullObject, + q26: NonNullObject, + q27: NonNullObject, + q28: NonNullObject, + q29: NonNullObject, + q30: NonNullObject, + q31: NonNullObject, + q32: NonNullObject, + q33: NonNullObject, + q34: NonNullObject, + q35: NonNullObject, + q36: NonNullObject, + q37: NonNullObject, + q38: NonNullObject, + q39: NonNullObject, + q40: NonNullObject, + q41: NonNullObject, + q42: NonNullObject, + q43: NonNullObject, + q44: NonNullObject, + q45: NonNullObject, + q46: NonNullObject, + q47: NonNullObject, + q48: NonNullObject, + q49: NonNullObject, + q50: NonNullObject, + q51: NonNullObject, + q52: NonNullObject, + q53: NonNullObject, + q54: NonNullObject, + q55: NonNullObject, + q56: NonNullObject, + q57: NonNullObject, + q58: NonNullObject, + q59: NonNullObject, + q60: NonNullObject, + q61: NonNullObject, + q62: NonNullObject, + q63: NonNullObject + ) = Dst64( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32, + q33, + q34, + q35, + q36, + q37, + q38, + q39, + q40, + q41, + q42, + q43, + q44, + q45, + q46, + q47, + q48, + q49, + q50, + q51, + q52, + q53, + q54, + q55, + q56, + q57, + q58, + q59, + q60, + q61, + q62, + q63 + ) + } + } + + @Test + fun test64() { + val expected = callPrimaryConstructor { NonNullObject(it.name!!) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst65( + val p00: NonNullObject, + val p01: NonNullObject, + val p02: NonNullObject, + val p03: NonNullObject, + val p04: NonNullObject, + val p05: NonNullObject, + val p06: NonNullObject, + val p07: NonNullObject, + val p08: NonNullObject, + val p09: NonNullObject, + val p10: NonNullObject, + val p11: NonNullObject, + val p12: NonNullObject, + val p13: NonNullObject, + val p14: NonNullObject, + val p15: NonNullObject, + val p16: NonNullObject, + val p17: NonNullObject, + val p18: NonNullObject, + val p19: NonNullObject, + val p20: NonNullObject, + val p21: NonNullObject, + val p22: NonNullObject, + val p23: NonNullObject, + val p24: NonNullObject, + val p25: NonNullObject, + val p26: NonNullObject, + val p27: NonNullObject, + val p28: NonNullObject, + val p29: NonNullObject, + val p30: NonNullObject, + val p31: NonNullObject, + val p32: NonNullObject, + val p33: NonNullObject, + val p34: NonNullObject, + val p35: NonNullObject, + val p36: NonNullObject, + val p37: NonNullObject, + val p38: NonNullObject, + val p39: NonNullObject, + val p40: NonNullObject, + val p41: NonNullObject, + val p42: NonNullObject, + val p43: NonNullObject, + val p44: NonNullObject, + val p45: NonNullObject, + val p46: NonNullObject, + val p47: NonNullObject, + val p48: NonNullObject, + val p49: NonNullObject, + val p50: NonNullObject, + val p51: NonNullObject, + val p52: NonNullObject, + val p53: NonNullObject, + val p54: NonNullObject, + val p55: NonNullObject, + val p56: NonNullObject, + val p57: NonNullObject, + val p58: NonNullObject, + val p59: NonNullObject, + val p60: NonNullObject, + val p61: NonNullObject, + val p62: NonNullObject, + val p63: NonNullObject, + val p64: NonNullObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NonNullObject, + q01: NonNullObject, + q02: NonNullObject, + q03: NonNullObject, + q04: NonNullObject, + q05: NonNullObject, + q06: NonNullObject, + q07: NonNullObject, + q08: NonNullObject, + q09: NonNullObject, + q10: NonNullObject, + q11: NonNullObject, + q12: NonNullObject, + q13: NonNullObject, + q14: NonNullObject, + q15: NonNullObject, + q16: NonNullObject, + q17: NonNullObject, + q18: NonNullObject, + q19: NonNullObject, + q20: NonNullObject, + q21: NonNullObject, + q22: NonNullObject, + q23: NonNullObject, + q24: NonNullObject, + q25: NonNullObject, + q26: NonNullObject, + q27: NonNullObject, + q28: NonNullObject, + q29: NonNullObject, + q30: NonNullObject, + q31: NonNullObject, + q32: NonNullObject, + q33: NonNullObject, + q34: NonNullObject, + q35: NonNullObject, + q36: NonNullObject, + q37: NonNullObject, + q38: NonNullObject, + q39: NonNullObject, + q40: NonNullObject, + q41: NonNullObject, + q42: NonNullObject, + q43: NonNullObject, + q44: NonNullObject, + q45: NonNullObject, + q46: NonNullObject, + q47: NonNullObject, + q48: NonNullObject, + q49: NonNullObject, + q50: NonNullObject, + q51: NonNullObject, + q52: NonNullObject, + q53: NonNullObject, + q54: NonNullObject, + q55: NonNullObject, + q56: NonNullObject, + q57: NonNullObject, + q58: NonNullObject, + q59: NonNullObject, + q60: NonNullObject, + q61: NonNullObject, + q62: NonNullObject, + q63: NonNullObject, + q64: NonNullObject + ) = Dst65( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32, + q33, + q34, + q35, + q36, + q37, + q38, + q39, + q40, + q41, + q42, + q43, + q44, + q45, + q46, + q47, + q48, + q49, + q50, + q51, + q52, + q53, + q54, + q55, + q56, + q57, + q58, + q59, + q60, + q61, + q62, + q63, + q64 + ) + } + } + + @Test + fun test65() { + val expected = callPrimaryConstructor { NonNullObject(it.name!!) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertEquals(expected, defaultMapper.readValue(src)) + } + + // It cannot be a data class because the generated method would exceed the argument size limit. + class DstMax( + val p000: NonNullObject, + val p001: NonNullObject, + val p002: NonNullObject, + val p003: NonNullObject, + val p004: NonNullObject, + val p005: NonNullObject, + val p006: NonNullObject, + val p007: NonNullObject, + val p008: NonNullObject, + val p009: NonNullObject, + val p010: NonNullObject, + val p011: NonNullObject, + val p012: NonNullObject, + val p013: NonNullObject, + val p014: NonNullObject, + val p015: NonNullObject, + val p016: NonNullObject, + val p017: NonNullObject, + val p018: NonNullObject, + val p019: NonNullObject, + val p020: NonNullObject, + val p021: NonNullObject, + val p022: NonNullObject, + val p023: NonNullObject, + val p024: NonNullObject, + val p025: NonNullObject, + val p026: NonNullObject, + val p027: NonNullObject, + val p028: NonNullObject, + val p029: NonNullObject, + val p030: NonNullObject, + val p031: NonNullObject, + val p032: NonNullObject, + val p033: NonNullObject, + val p034: NonNullObject, + val p035: NonNullObject, + val p036: NonNullObject, + val p037: NonNullObject, + val p038: NonNullObject, + val p039: NonNullObject, + val p040: NonNullObject, + val p041: NonNullObject, + val p042: NonNullObject, + val p043: NonNullObject, + val p044: NonNullObject, + val p045: NonNullObject, + val p046: NonNullObject, + val p047: NonNullObject, + val p048: NonNullObject, + val p049: NonNullObject, + val p050: NonNullObject, + val p051: NonNullObject, + val p052: NonNullObject, + val p053: NonNullObject, + val p054: NonNullObject, + val p055: NonNullObject, + val p056: NonNullObject, + val p057: NonNullObject, + val p058: NonNullObject, + val p059: NonNullObject, + val p060: NonNullObject, + val p061: NonNullObject, + val p062: NonNullObject, + val p063: NonNullObject, + val p064: NonNullObject, + val p065: NonNullObject, + val p066: NonNullObject, + val p067: NonNullObject, + val p068: NonNullObject, + val p069: NonNullObject, + val p070: NonNullObject, + val p071: NonNullObject, + val p072: NonNullObject, + val p073: NonNullObject, + val p074: NonNullObject, + val p075: NonNullObject, + val p076: NonNullObject, + val p077: NonNullObject, + val p078: NonNullObject, + val p079: NonNullObject, + val p080: NonNullObject, + val p081: NonNullObject, + val p082: NonNullObject, + val p083: NonNullObject, + val p084: NonNullObject, + val p085: NonNullObject, + val p086: NonNullObject, + val p087: NonNullObject, + val p088: NonNullObject, + val p089: NonNullObject, + val p090: NonNullObject, + val p091: NonNullObject, + val p092: NonNullObject, + val p093: NonNullObject, + val p094: NonNullObject, + val p095: NonNullObject, + val p096: NonNullObject, + val p097: NonNullObject, + val p098: NonNullObject, + val p099: NonNullObject, + val p100: NonNullObject, + val p101: NonNullObject, + val p102: NonNullObject, + val p103: NonNullObject, + val p104: NonNullObject, + val p105: NonNullObject, + val p106: NonNullObject, + val p107: NonNullObject, + val p108: NonNullObject, + val p109: NonNullObject, + val p110: NonNullObject, + val p111: NonNullObject, + val p112: NonNullObject, + val p113: NonNullObject, + val p114: NonNullObject, + val p115: NonNullObject, + val p116: NonNullObject, + val p117: NonNullObject, + val p118: NonNullObject, + val p119: NonNullObject, + val p120: NonNullObject, + val p121: NonNullObject, + val p122: NonNullObject, + val p123: NonNullObject, + val p124: NonNullObject, + val p125: NonNullObject, + val p126: NonNullObject, + val p127: NonNullObject, + val p128: NonNullObject, + val p129: NonNullObject, + val p130: NonNullObject, + val p131: NonNullObject, + val p132: NonNullObject, + val p133: NonNullObject, + val p134: NonNullObject, + val p135: NonNullObject, + val p136: NonNullObject, + val p137: NonNullObject, + val p138: NonNullObject, + val p139: NonNullObject, + val p140: NonNullObject, + val p141: NonNullObject, + val p142: NonNullObject, + val p143: NonNullObject, + val p144: NonNullObject, + val p145: NonNullObject, + val p146: NonNullObject, + val p147: NonNullObject, + val p148: NonNullObject, + val p149: NonNullObject, + val p150: NonNullObject, + val p151: NonNullObject, + val p152: NonNullObject, + val p153: NonNullObject, + val p154: NonNullObject, + val p155: NonNullObject, + val p156: NonNullObject, + val p157: NonNullObject, + val p158: NonNullObject, + val p159: NonNullObject, + val p160: NonNullObject, + val p161: NonNullObject, + val p162: NonNullObject, + val p163: NonNullObject, + val p164: NonNullObject, + val p165: NonNullObject, + val p166: NonNullObject, + val p167: NonNullObject, + val p168: NonNullObject, + val p169: NonNullObject, + val p170: NonNullObject, + val p171: NonNullObject, + val p172: NonNullObject, + val p173: NonNullObject, + val p174: NonNullObject, + val p175: NonNullObject, + val p176: NonNullObject, + val p177: NonNullObject, + val p178: NonNullObject, + val p179: NonNullObject, + val p180: NonNullObject, + val p181: NonNullObject, + val p182: NonNullObject, + val p183: NonNullObject, + val p184: NonNullObject, + val p185: NonNullObject, + val p186: NonNullObject, + val p187: NonNullObject, + val p188: NonNullObject, + val p189: NonNullObject, + val p190: NonNullObject, + val p191: NonNullObject, + val p192: NonNullObject, + val p193: NonNullObject, + val p194: NonNullObject, + val p195: NonNullObject, + val p196: NonNullObject, + val p197: NonNullObject, + val p198: NonNullObject, + val p199: NonNullObject, + val p200: NonNullObject, + val p201: NonNullObject, + val p202: NonNullObject, + val p203: NonNullObject, + val p204: NonNullObject, + val p205: NonNullObject, + val p206: NonNullObject, + val p207: NonNullObject, + val p208: NonNullObject, + val p209: NonNullObject, + val p210: NonNullObject, + val p211: NonNullObject, + val p212: NonNullObject, + val p213: NonNullObject, + val p214: NonNullObject, + val p215: NonNullObject, + val p216: NonNullObject, + val p217: NonNullObject, + val p218: NonNullObject, + val p219: NonNullObject, + val p220: NonNullObject, + val p221: NonNullObject, + val p222: NonNullObject, + val p223: NonNullObject, + val p224: NonNullObject, + val p225: NonNullObject, + val p226: NonNullObject, + val p227: NonNullObject, + val p228: NonNullObject, + val p229: NonNullObject, + val p230: NonNullObject, + val p231: NonNullObject, + val p232: NonNullObject, + val p233: NonNullObject, + val p234: NonNullObject, + val p235: NonNullObject, + val p236: NonNullObject, + val p237: NonNullObject, + val p238: NonNullObject, + val p239: NonNullObject, + val p240: NonNullObject, + val p241: NonNullObject, + val p242: NonNullObject, + val p243: NonNullObject, + val p244: NonNullObject, + val p245: NonNullObject, + val p246: NonNullObject, + val p247: NonNullObject, + val p248: NonNullObject, + val p249: NonNullObject, + val p250: NonNullObject, + val p251: NonNullObject, + val p252: NonNullObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q000: NonNullObject, + q001: NonNullObject, + q002: NonNullObject, + q003: NonNullObject, + q004: NonNullObject, + q005: NonNullObject, + q006: NonNullObject, + q007: NonNullObject, + q008: NonNullObject, + q009: NonNullObject, + q010: NonNullObject, + q011: NonNullObject, + q012: NonNullObject, + q013: NonNullObject, + q014: NonNullObject, + q015: NonNullObject, + q016: NonNullObject, + q017: NonNullObject, + q018: NonNullObject, + q019: NonNullObject, + q020: NonNullObject, + q021: NonNullObject, + q022: NonNullObject, + q023: NonNullObject, + q024: NonNullObject, + q025: NonNullObject, + q026: NonNullObject, + q027: NonNullObject, + q028: NonNullObject, + q029: NonNullObject, + q030: NonNullObject, + q031: NonNullObject, + q032: NonNullObject, + q033: NonNullObject, + q034: NonNullObject, + q035: NonNullObject, + q036: NonNullObject, + q037: NonNullObject, + q038: NonNullObject, + q039: NonNullObject, + q040: NonNullObject, + q041: NonNullObject, + q042: NonNullObject, + q043: NonNullObject, + q044: NonNullObject, + q045: NonNullObject, + q046: NonNullObject, + q047: NonNullObject, + q048: NonNullObject, + q049: NonNullObject, + q050: NonNullObject, + q051: NonNullObject, + q052: NonNullObject, + q053: NonNullObject, + q054: NonNullObject, + q055: NonNullObject, + q056: NonNullObject, + q057: NonNullObject, + q058: NonNullObject, + q059: NonNullObject, + q060: NonNullObject, + q061: NonNullObject, + q062: NonNullObject, + q063: NonNullObject, + q064: NonNullObject, + q065: NonNullObject, + q066: NonNullObject, + q067: NonNullObject, + q068: NonNullObject, + q069: NonNullObject, + q070: NonNullObject, + q071: NonNullObject, + q072: NonNullObject, + q073: NonNullObject, + q074: NonNullObject, + q075: NonNullObject, + q076: NonNullObject, + q077: NonNullObject, + q078: NonNullObject, + q079: NonNullObject, + q080: NonNullObject, + q081: NonNullObject, + q082: NonNullObject, + q083: NonNullObject, + q084: NonNullObject, + q085: NonNullObject, + q086: NonNullObject, + q087: NonNullObject, + q088: NonNullObject, + q089: NonNullObject, + q090: NonNullObject, + q091: NonNullObject, + q092: NonNullObject, + q093: NonNullObject, + q094: NonNullObject, + q095: NonNullObject, + q096: NonNullObject, + q097: NonNullObject, + q098: NonNullObject, + q099: NonNullObject, + q100: NonNullObject, + q101: NonNullObject, + q102: NonNullObject, + q103: NonNullObject, + q104: NonNullObject, + q105: NonNullObject, + q106: NonNullObject, + q107: NonNullObject, + q108: NonNullObject, + q109: NonNullObject, + q110: NonNullObject, + q111: NonNullObject, + q112: NonNullObject, + q113: NonNullObject, + q114: NonNullObject, + q115: NonNullObject, + q116: NonNullObject, + q117: NonNullObject, + q118: NonNullObject, + q119: NonNullObject, + q120: NonNullObject, + q121: NonNullObject, + q122: NonNullObject, + q123: NonNullObject, + q124: NonNullObject, + q125: NonNullObject, + q126: NonNullObject, + q127: NonNullObject, + q128: NonNullObject, + q129: NonNullObject, + q130: NonNullObject, + q131: NonNullObject, + q132: NonNullObject, + q133: NonNullObject, + q134: NonNullObject, + q135: NonNullObject, + q136: NonNullObject, + q137: NonNullObject, + q138: NonNullObject, + q139: NonNullObject, + q140: NonNullObject, + q141: NonNullObject, + q142: NonNullObject, + q143: NonNullObject, + q144: NonNullObject, + q145: NonNullObject, + q146: NonNullObject, + q147: NonNullObject, + q148: NonNullObject, + q149: NonNullObject, + q150: NonNullObject, + q151: NonNullObject, + q152: NonNullObject, + q153: NonNullObject, + q154: NonNullObject, + q155: NonNullObject, + q156: NonNullObject, + q157: NonNullObject, + q158: NonNullObject, + q159: NonNullObject, + q160: NonNullObject, + q161: NonNullObject, + q162: NonNullObject, + q163: NonNullObject, + q164: NonNullObject, + q165: NonNullObject, + q166: NonNullObject, + q167: NonNullObject, + q168: NonNullObject, + q169: NonNullObject, + q170: NonNullObject, + q171: NonNullObject, + q172: NonNullObject, + q173: NonNullObject, + q174: NonNullObject, + q175: NonNullObject, + q176: NonNullObject, + q177: NonNullObject, + q178: NonNullObject, + q179: NonNullObject, + q180: NonNullObject, + q181: NonNullObject, + q182: NonNullObject, + q183: NonNullObject, + q184: NonNullObject, + q185: NonNullObject, + q186: NonNullObject, + q187: NonNullObject, + q188: NonNullObject, + q189: NonNullObject, + q190: NonNullObject, + q191: NonNullObject, + q192: NonNullObject, + q193: NonNullObject, + q194: NonNullObject, + q195: NonNullObject, + q196: NonNullObject, + q197: NonNullObject, + q198: NonNullObject, + q199: NonNullObject, + q200: NonNullObject, + q201: NonNullObject, + q202: NonNullObject, + q203: NonNullObject, + q204: NonNullObject, + q205: NonNullObject, + q206: NonNullObject, + q207: NonNullObject, + q208: NonNullObject, + q209: NonNullObject, + q210: NonNullObject, + q211: NonNullObject, + q212: NonNullObject, + q213: NonNullObject, + q214: NonNullObject, + q215: NonNullObject, + q216: NonNullObject, + q217: NonNullObject, + q218: NonNullObject, + q219: NonNullObject, + q220: NonNullObject, + q221: NonNullObject, + q222: NonNullObject, + q223: NonNullObject, + q224: NonNullObject, + q225: NonNullObject, + q226: NonNullObject, + q227: NonNullObject, + q228: NonNullObject, + q229: NonNullObject, + q230: NonNullObject, + q231: NonNullObject, + q232: NonNullObject, + q233: NonNullObject, + q234: NonNullObject, + q235: NonNullObject, + q236: NonNullObject, + q237: NonNullObject, + q238: NonNullObject, + q239: NonNullObject, + q240: NonNullObject, + q241: NonNullObject, + q242: NonNullObject, + q243: NonNullObject, + q244: NonNullObject, + q245: NonNullObject, + q246: NonNullObject, + q247: NonNullObject, + q248: NonNullObject, + q249: NonNullObject, + q250: NonNullObject, + q251: NonNullObject, + q252: NonNullObject + ) = DstMax( + q000, + q001, + q002, + q003, + q004, + q005, + q006, + q007, + q008, + q009, + q010, + q011, + q012, + q013, + q014, + q015, + q016, + q017, + q018, + q019, + q020, + q021, + q022, + q023, + q024, + q025, + q026, + q027, + q028, + q029, + q030, + q031, + q032, + q033, + q034, + q035, + q036, + q037, + q038, + q039, + q040, + q041, + q042, + q043, + q044, + q045, + q046, + q047, + q048, + q049, + q050, + q051, + q052, + q053, + q054, + q055, + q056, + q057, + q058, + q059, + q060, + q061, + q062, + q063, + q064, + q065, + q066, + q067, + q068, + q069, + q070, + q071, + q072, + q073, + q074, + q075, + q076, + q077, + q078, + q079, + q080, + q081, + q082, + q083, + q084, + q085, + q086, + q087, + q088, + q089, + q090, + q091, + q092, + q093, + q094, + q095, + q096, + q097, + q098, + q099, + q100, + q101, + q102, + q103, + q104, + q105, + q106, + q107, + q108, + q109, + q110, + q111, + q112, + q113, + q114, + q115, + q116, + q117, + q118, + q119, + q120, + q121, + q122, + q123, + q124, + q125, + q126, + q127, + q128, + q129, + q130, + q131, + q132, + q133, + q134, + q135, + q136, + q137, + q138, + q139, + q140, + q141, + q142, + q143, + q144, + q145, + q146, + q147, + q148, + q149, + q150, + q151, + q152, + q153, + q154, + q155, + q156, + q157, + q158, + q159, + q160, + q161, + q162, + q163, + q164, + q165, + q166, + q167, + q168, + q169, + q170, + q171, + q172, + q173, + q174, + q175, + q176, + q177, + q178, + q179, + q180, + q181, + q182, + q183, + q184, + q185, + q186, + q187, + q188, + q189, + q190, + q191, + q192, + q193, + q194, + q195, + q196, + q197, + q198, + q199, + q200, + q201, + q202, + q203, + q204, + q205, + q206, + q207, + q208, + q209, + q210, + q211, + q212, + q213, + q214, + q215, + q216, + q217, + q218, + q219, + q220, + q221, + q222, + q223, + q224, + q225, + q226, + q227, + q228, + q229, + q230, + q231, + q232, + q233, + q234, + q235, + q236, + q237, + q238, + q239, + q240, + q241, + q242, + q243, + q244, + q245, + q246, + q247, + q248, + q249, + q250, + q251, + q252 + ) + } + } + + @Test + fun testMax() { + val expected = callPrimaryConstructor { NonNullObject(it.name!!) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertReflectEquals(expected, defaultMapper.readValue(src)) + } +} From a1d1873596bb1beea509110f17b692d0597cc9bc Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 13:44:14 +0900 Subject: [PATCH 13/20] Add value class parameter tests using NullableObject --- ...zeByConstructorWithDefaultArgumentsTest.kt | 499 ++++++ ...yConstructorWithoutDefaultArgumentsTest.kt | 515 ++++++ ...ializeByFactoryWithDefaultArgumentsTest.kt | 1411 ++++++++++++++++ ...izeByFactoryWithoutDefaultArgumentsTest.kt | 1453 +++++++++++++++++ 4 files changed, 3878 insertions(+) create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByConstructorWithDefaultArgumentsTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByConstructorWithoutDefaultArgumentsTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByFactoryWithDefaultArgumentsTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByFactoryWithoutDefaultArgumentsTest.kt diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByConstructorWithDefaultArgumentsTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByConstructorWithDefaultArgumentsTest.kt new file mode 100644 index 00000000..133096d2 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByConstructorWithDefaultArgumentsTest.kt @@ -0,0 +1,499 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.nullableObject + +import com.fasterxml.jackson.module.kotlin.assertReflectEquals +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NullableObject +import org.junit.Assert.assertEquals +import kotlin.reflect.jvm.internal.KotlinReflectionInternalError +import kotlin.test.Test + +/** + * Up to argument size 32 there is one mask argument for the default argument, + * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested. + * Also, if the default argument is set, the maximum argument size that can be set in the constructor is 245, + * so that case is tested as well. + */ +class DeserializeByConstructorWithDefaultArgumentsTest { + data class Dst32( + val p00: NullableObject? = NullableObject("0"), + val p01: NullableObject? = NullableObject("1"), + val p02: NullableObject? = NullableObject("2"), + val p03: NullableObject? = NullableObject("3"), + val p04: NullableObject? = NullableObject("4"), + val p05: NullableObject? = NullableObject("5"), + val p06: NullableObject? = NullableObject("6"), + val p07: NullableObject? = NullableObject("7"), + val p08: NullableObject? = NullableObject("8"), + val p09: NullableObject? = NullableObject("9"), + val p10: NullableObject? = NullableObject("10"), + val p11: NullableObject? = NullableObject("11"), + val p12: NullableObject? = NullableObject("12"), + val p13: NullableObject? = NullableObject("13"), + val p14: NullableObject? = NullableObject("14"), + val p15: NullableObject? = NullableObject("15"), + val p16: NullableObject? = NullableObject("16"), + val p17: NullableObject? = NullableObject("17"), + val p18: NullableObject? = NullableObject("18"), + val p19: NullableObject? = NullableObject("19"), + val p20: NullableObject? = NullableObject("20"), + val p21: NullableObject? = NullableObject("21"), + val p22: NullableObject? = NullableObject("22"), + val p23: NullableObject? = NullableObject("23"), + val p24: NullableObject? = NullableObject("24"), + val p25: NullableObject? = NullableObject("25"), + val p26: NullableObject? = NullableObject("26"), + val p27: NullableObject? = NullableObject("27"), + val p28: NullableObject? = NullableObject("28"), + val p29: NullableObject? = NullableObject("29"), + val p30: NullableObject? = NullableObject("30"), + val p31: NullableObject? = NullableObject("31") + ) + + // #762 + @Test(expected = KotlinReflectionInternalError::class) + fun test32() { + assertEquals(Dst32(), defaultMapper.readValue("{}")) + } + + data class Dst33( + val p00: NullableObject? = NullableObject("0"), + val p01: NullableObject? = NullableObject("1"), + val p02: NullableObject? = NullableObject("2"), + val p03: NullableObject? = NullableObject("3"), + val p04: NullableObject? = NullableObject("4"), + val p05: NullableObject? = NullableObject("5"), + val p06: NullableObject? = NullableObject("6"), + val p07: NullableObject? = NullableObject("7"), + val p08: NullableObject? = NullableObject("8"), + val p09: NullableObject? = NullableObject("9"), + val p10: NullableObject? = NullableObject("10"), + val p11: NullableObject? = NullableObject("11"), + val p12: NullableObject? = NullableObject("12"), + val p13: NullableObject? = NullableObject("13"), + val p14: NullableObject? = NullableObject("14"), + val p15: NullableObject? = NullableObject("15"), + val p16: NullableObject? = NullableObject("16"), + val p17: NullableObject? = NullableObject("17"), + val p18: NullableObject? = NullableObject("18"), + val p19: NullableObject? = NullableObject("19"), + val p20: NullableObject? = NullableObject("20"), + val p21: NullableObject? = NullableObject("21"), + val p22: NullableObject? = NullableObject("22"), + val p23: NullableObject? = NullableObject("23"), + val p24: NullableObject? = NullableObject("24"), + val p25: NullableObject? = NullableObject("25"), + val p26: NullableObject? = NullableObject("26"), + val p27: NullableObject? = NullableObject("27"), + val p28: NullableObject? = NullableObject("28"), + val p29: NullableObject? = NullableObject("29"), + val p30: NullableObject? = NullableObject("30"), + val p31: NullableObject? = NullableObject("31"), + val p32: NullableObject? = NullableObject("32") + ) + + @Test + fun test33() { + assertEquals(Dst33(), defaultMapper.readValue("{}")) + } + + data class Dst64( + val p00: NullableObject? = NullableObject("0"), + val p01: NullableObject? = NullableObject("1"), + val p02: NullableObject? = NullableObject("2"), + val p03: NullableObject? = NullableObject("3"), + val p04: NullableObject? = NullableObject("4"), + val p05: NullableObject? = NullableObject("5"), + val p06: NullableObject? = NullableObject("6"), + val p07: NullableObject? = NullableObject("7"), + val p08: NullableObject? = NullableObject("8"), + val p09: NullableObject? = NullableObject("9"), + val p10: NullableObject? = NullableObject("10"), + val p11: NullableObject? = NullableObject("11"), + val p12: NullableObject? = NullableObject("12"), + val p13: NullableObject? = NullableObject("13"), + val p14: NullableObject? = NullableObject("14"), + val p15: NullableObject? = NullableObject("15"), + val p16: NullableObject? = NullableObject("16"), + val p17: NullableObject? = NullableObject("17"), + val p18: NullableObject? = NullableObject("18"), + val p19: NullableObject? = NullableObject("19"), + val p20: NullableObject? = NullableObject("20"), + val p21: NullableObject? = NullableObject("21"), + val p22: NullableObject? = NullableObject("22"), + val p23: NullableObject? = NullableObject("23"), + val p24: NullableObject? = NullableObject("24"), + val p25: NullableObject? = NullableObject("25"), + val p26: NullableObject? = NullableObject("26"), + val p27: NullableObject? = NullableObject("27"), + val p28: NullableObject? = NullableObject("28"), + val p29: NullableObject? = NullableObject("29"), + val p30: NullableObject? = NullableObject("30"), + val p31: NullableObject? = NullableObject("31"), + val p32: NullableObject? = NullableObject("32"), + val p33: NullableObject? = NullableObject("33"), + val p34: NullableObject? = NullableObject("34"), + val p35: NullableObject? = NullableObject("35"), + val p36: NullableObject? = NullableObject("36"), + val p37: NullableObject? = NullableObject("37"), + val p38: NullableObject? = NullableObject("38"), + val p39: NullableObject? = NullableObject("39"), + val p40: NullableObject? = NullableObject("40"), + val p41: NullableObject? = NullableObject("41"), + val p42: NullableObject? = NullableObject("42"), + val p43: NullableObject? = NullableObject("43"), + val p44: NullableObject? = NullableObject("44"), + val p45: NullableObject? = NullableObject("45"), + val p46: NullableObject? = NullableObject("46"), + val p47: NullableObject? = NullableObject("47"), + val p48: NullableObject? = NullableObject("48"), + val p49: NullableObject? = NullableObject("49"), + val p50: NullableObject? = NullableObject("50"), + val p51: NullableObject? = NullableObject("51"), + val p52: NullableObject? = NullableObject("52"), + val p53: NullableObject? = NullableObject("53"), + val p54: NullableObject? = NullableObject("54"), + val p55: NullableObject? = NullableObject("55"), + val p56: NullableObject? = NullableObject("56"), + val p57: NullableObject? = NullableObject("57"), + val p58: NullableObject? = NullableObject("58"), + val p59: NullableObject? = NullableObject("59"), + val p60: NullableObject? = NullableObject("60"), + val p61: NullableObject? = NullableObject("61"), + val p62: NullableObject? = NullableObject("62"), + val p63: NullableObject? = NullableObject("63") + ) + + // #762 + @Test(expected = KotlinReflectionInternalError::class) + fun test64() { + assertEquals(Dst64(), defaultMapper.readValue("{}")) + } + + data class Dst65( + val p00: NullableObject? = NullableObject("0"), + val p01: NullableObject? = NullableObject("1"), + val p02: NullableObject? = NullableObject("2"), + val p03: NullableObject? = NullableObject("3"), + val p04: NullableObject? = NullableObject("4"), + val p05: NullableObject? = NullableObject("5"), + val p06: NullableObject? = NullableObject("6"), + val p07: NullableObject? = NullableObject("7"), + val p08: NullableObject? = NullableObject("8"), + val p09: NullableObject? = NullableObject("9"), + val p10: NullableObject? = NullableObject("10"), + val p11: NullableObject? = NullableObject("11"), + val p12: NullableObject? = NullableObject("12"), + val p13: NullableObject? = NullableObject("13"), + val p14: NullableObject? = NullableObject("14"), + val p15: NullableObject? = NullableObject("15"), + val p16: NullableObject? = NullableObject("16"), + val p17: NullableObject? = NullableObject("17"), + val p18: NullableObject? = NullableObject("18"), + val p19: NullableObject? = NullableObject("19"), + val p20: NullableObject? = NullableObject("20"), + val p21: NullableObject? = NullableObject("21"), + val p22: NullableObject? = NullableObject("22"), + val p23: NullableObject? = NullableObject("23"), + val p24: NullableObject? = NullableObject("24"), + val p25: NullableObject? = NullableObject("25"), + val p26: NullableObject? = NullableObject("26"), + val p27: NullableObject? = NullableObject("27"), + val p28: NullableObject? = NullableObject("28"), + val p29: NullableObject? = NullableObject("29"), + val p30: NullableObject? = NullableObject("30"), + val p31: NullableObject? = NullableObject("31"), + val p32: NullableObject? = NullableObject("32"), + val p33: NullableObject? = NullableObject("33"), + val p34: NullableObject? = NullableObject("34"), + val p35: NullableObject? = NullableObject("35"), + val p36: NullableObject? = NullableObject("36"), + val p37: NullableObject? = NullableObject("37"), + val p38: NullableObject? = NullableObject("38"), + val p39: NullableObject? = NullableObject("39"), + val p40: NullableObject? = NullableObject("40"), + val p41: NullableObject? = NullableObject("41"), + val p42: NullableObject? = NullableObject("42"), + val p43: NullableObject? = NullableObject("43"), + val p44: NullableObject? = NullableObject("44"), + val p45: NullableObject? = NullableObject("45"), + val p46: NullableObject? = NullableObject("46"), + val p47: NullableObject? = NullableObject("47"), + val p48: NullableObject? = NullableObject("48"), + val p49: NullableObject? = NullableObject("49"), + val p50: NullableObject? = NullableObject("50"), + val p51: NullableObject? = NullableObject("51"), + val p52: NullableObject? = NullableObject("52"), + val p53: NullableObject? = NullableObject("53"), + val p54: NullableObject? = NullableObject("54"), + val p55: NullableObject? = NullableObject("55"), + val p56: NullableObject? = NullableObject("56"), + val p57: NullableObject? = NullableObject("57"), + val p58: NullableObject? = NullableObject("58"), + val p59: NullableObject? = NullableObject("59"), + val p60: NullableObject? = NullableObject("60"), + val p61: NullableObject? = NullableObject("61"), + val p62: NullableObject? = NullableObject("62"), + val p63: NullableObject? = NullableObject("63"), + val p64: NullableObject? = NullableObject("64") + ) + + @Test + fun test65() { + assertEquals(Dst65(), defaultMapper.readValue("{}")) + } + + // It cannot be a data class because the generated method would exceed the argument size limit. + class DstMax( + val p000: NullableObject? = NullableObject("0"), + val p001: NullableObject? = NullableObject("1"), + val p002: NullableObject? = NullableObject("2"), + val p003: NullableObject? = NullableObject("3"), + val p004: NullableObject? = NullableObject("4"), + val p005: NullableObject? = NullableObject("5"), + val p006: NullableObject? = NullableObject("6"), + val p007: NullableObject? = NullableObject("7"), + val p008: NullableObject? = NullableObject("8"), + val p009: NullableObject? = NullableObject("9"), + val p010: NullableObject? = NullableObject("10"), + val p011: NullableObject? = NullableObject("11"), + val p012: NullableObject? = NullableObject("12"), + val p013: NullableObject? = NullableObject("13"), + val p014: NullableObject? = NullableObject("14"), + val p015: NullableObject? = NullableObject("15"), + val p016: NullableObject? = NullableObject("16"), + val p017: NullableObject? = NullableObject("17"), + val p018: NullableObject? = NullableObject("18"), + val p019: NullableObject? = NullableObject("19"), + val p020: NullableObject? = NullableObject("20"), + val p021: NullableObject? = NullableObject("21"), + val p022: NullableObject? = NullableObject("22"), + val p023: NullableObject? = NullableObject("23"), + val p024: NullableObject? = NullableObject("24"), + val p025: NullableObject? = NullableObject("25"), + val p026: NullableObject? = NullableObject("26"), + val p027: NullableObject? = NullableObject("27"), + val p028: NullableObject? = NullableObject("28"), + val p029: NullableObject? = NullableObject("29"), + val p030: NullableObject? = NullableObject("30"), + val p031: NullableObject? = NullableObject("31"), + val p032: NullableObject? = NullableObject("32"), + val p033: NullableObject? = NullableObject("33"), + val p034: NullableObject? = NullableObject("34"), + val p035: NullableObject? = NullableObject("35"), + val p036: NullableObject? = NullableObject("36"), + val p037: NullableObject? = NullableObject("37"), + val p038: NullableObject? = NullableObject("38"), + val p039: NullableObject? = NullableObject("39"), + val p040: NullableObject? = NullableObject("40"), + val p041: NullableObject? = NullableObject("41"), + val p042: NullableObject? = NullableObject("42"), + val p043: NullableObject? = NullableObject("43"), + val p044: NullableObject? = NullableObject("44"), + val p045: NullableObject? = NullableObject("45"), + val p046: NullableObject? = NullableObject("46"), + val p047: NullableObject? = NullableObject("47"), + val p048: NullableObject? = NullableObject("48"), + val p049: NullableObject? = NullableObject("49"), + val p050: NullableObject? = NullableObject("50"), + val p051: NullableObject? = NullableObject("51"), + val p052: NullableObject? = NullableObject("52"), + val p053: NullableObject? = NullableObject("53"), + val p054: NullableObject? = NullableObject("54"), + val p055: NullableObject? = NullableObject("55"), + val p056: NullableObject? = NullableObject("56"), + val p057: NullableObject? = NullableObject("57"), + val p058: NullableObject? = NullableObject("58"), + val p059: NullableObject? = NullableObject("59"), + val p060: NullableObject? = NullableObject("60"), + val p061: NullableObject? = NullableObject("61"), + val p062: NullableObject? = NullableObject("62"), + val p063: NullableObject? = NullableObject("63"), + val p064: NullableObject? = NullableObject("64"), + val p065: NullableObject? = NullableObject("65"), + val p066: NullableObject? = NullableObject("66"), + val p067: NullableObject? = NullableObject("67"), + val p068: NullableObject? = NullableObject("68"), + val p069: NullableObject? = NullableObject("69"), + val p070: NullableObject? = NullableObject("70"), + val p071: NullableObject? = NullableObject("71"), + val p072: NullableObject? = NullableObject("72"), + val p073: NullableObject? = NullableObject("73"), + val p074: NullableObject? = NullableObject("74"), + val p075: NullableObject? = NullableObject("75"), + val p076: NullableObject? = NullableObject("76"), + val p077: NullableObject? = NullableObject("77"), + val p078: NullableObject? = NullableObject("78"), + val p079: NullableObject? = NullableObject("79"), + val p080: NullableObject? = NullableObject("80"), + val p081: NullableObject? = NullableObject("81"), + val p082: NullableObject? = NullableObject("82"), + val p083: NullableObject? = NullableObject("83"), + val p084: NullableObject? = NullableObject("84"), + val p085: NullableObject? = NullableObject("85"), + val p086: NullableObject? = NullableObject("86"), + val p087: NullableObject? = NullableObject("87"), + val p088: NullableObject? = NullableObject("88"), + val p089: NullableObject? = NullableObject("89"), + val p090: NullableObject? = NullableObject("90"), + val p091: NullableObject? = NullableObject("91"), + val p092: NullableObject? = NullableObject("92"), + val p093: NullableObject? = NullableObject("93"), + val p094: NullableObject? = NullableObject("94"), + val p095: NullableObject? = NullableObject("95"), + val p096: NullableObject? = NullableObject("96"), + val p097: NullableObject? = NullableObject("97"), + val p098: NullableObject? = NullableObject("98"), + val p099: NullableObject? = NullableObject("99"), + val p100: NullableObject? = NullableObject("100"), + val p101: NullableObject? = NullableObject("101"), + val p102: NullableObject? = NullableObject("102"), + val p103: NullableObject? = NullableObject("103"), + val p104: NullableObject? = NullableObject("104"), + val p105: NullableObject? = NullableObject("105"), + val p106: NullableObject? = NullableObject("106"), + val p107: NullableObject? = NullableObject("107"), + val p108: NullableObject? = NullableObject("108"), + val p109: NullableObject? = NullableObject("109"), + val p110: NullableObject? = NullableObject("110"), + val p111: NullableObject? = NullableObject("111"), + val p112: NullableObject? = NullableObject("112"), + val p113: NullableObject? = NullableObject("113"), + val p114: NullableObject? = NullableObject("114"), + val p115: NullableObject? = NullableObject("115"), + val p116: NullableObject? = NullableObject("116"), + val p117: NullableObject? = NullableObject("117"), + val p118: NullableObject? = NullableObject("118"), + val p119: NullableObject? = NullableObject("119"), + val p120: NullableObject? = NullableObject("120"), + val p121: NullableObject? = NullableObject("121"), + val p122: NullableObject? = NullableObject("122"), + val p123: NullableObject? = NullableObject("123"), + val p124: NullableObject? = NullableObject("124"), + val p125: NullableObject? = NullableObject("125"), + val p126: NullableObject? = NullableObject("126"), + val p127: NullableObject? = NullableObject("127"), + val p128: NullableObject? = NullableObject("128"), + val p129: NullableObject? = NullableObject("129"), + val p130: NullableObject? = NullableObject("130"), + val p131: NullableObject? = NullableObject("131"), + val p132: NullableObject? = NullableObject("132"), + val p133: NullableObject? = NullableObject("133"), + val p134: NullableObject? = NullableObject("134"), + val p135: NullableObject? = NullableObject("135"), + val p136: NullableObject? = NullableObject("136"), + val p137: NullableObject? = NullableObject("137"), + val p138: NullableObject? = NullableObject("138"), + val p139: NullableObject? = NullableObject("139"), + val p140: NullableObject? = NullableObject("140"), + val p141: NullableObject? = NullableObject("141"), + val p142: NullableObject? = NullableObject("142"), + val p143: NullableObject? = NullableObject("143"), + val p144: NullableObject? = NullableObject("144"), + val p145: NullableObject? = NullableObject("145"), + val p146: NullableObject? = NullableObject("146"), + val p147: NullableObject? = NullableObject("147"), + val p148: NullableObject? = NullableObject("148"), + val p149: NullableObject? = NullableObject("149"), + val p150: NullableObject? = NullableObject("150"), + val p151: NullableObject? = NullableObject("151"), + val p152: NullableObject? = NullableObject("152"), + val p153: NullableObject? = NullableObject("153"), + val p154: NullableObject? = NullableObject("154"), + val p155: NullableObject? = NullableObject("155"), + val p156: NullableObject? = NullableObject("156"), + val p157: NullableObject? = NullableObject("157"), + val p158: NullableObject? = NullableObject("158"), + val p159: NullableObject? = NullableObject("159"), + val p160: NullableObject? = NullableObject("160"), + val p161: NullableObject? = NullableObject("161"), + val p162: NullableObject? = NullableObject("162"), + val p163: NullableObject? = NullableObject("163"), + val p164: NullableObject? = NullableObject("164"), + val p165: NullableObject? = NullableObject("165"), + val p166: NullableObject? = NullableObject("166"), + val p167: NullableObject? = NullableObject("167"), + val p168: NullableObject? = NullableObject("168"), + val p169: NullableObject? = NullableObject("169"), + val p170: NullableObject? = NullableObject("170"), + val p171: NullableObject? = NullableObject("171"), + val p172: NullableObject? = NullableObject("172"), + val p173: NullableObject? = NullableObject("173"), + val p174: NullableObject? = NullableObject("174"), + val p175: NullableObject? = NullableObject("175"), + val p176: NullableObject? = NullableObject("176"), + val p177: NullableObject? = NullableObject("177"), + val p178: NullableObject? = NullableObject("178"), + val p179: NullableObject? = NullableObject("179"), + val p180: NullableObject? = NullableObject("180"), + val p181: NullableObject? = NullableObject("181"), + val p182: NullableObject? = NullableObject("182"), + val p183: NullableObject? = NullableObject("183"), + val p184: NullableObject? = NullableObject("184"), + val p185: NullableObject? = NullableObject("185"), + val p186: NullableObject? = NullableObject("186"), + val p187: NullableObject? = NullableObject("187"), + val p188: NullableObject? = NullableObject("188"), + val p189: NullableObject? = NullableObject("189"), + val p190: NullableObject? = NullableObject("190"), + val p191: NullableObject? = NullableObject("191"), + val p192: NullableObject? = NullableObject("192"), + val p193: NullableObject? = NullableObject("193"), + val p194: NullableObject? = NullableObject("194"), + val p195: NullableObject? = NullableObject("195"), + val p196: NullableObject? = NullableObject("196"), + val p197: NullableObject? = NullableObject("197"), + val p198: NullableObject? = NullableObject("198"), + val p199: NullableObject? = NullableObject("199"), + val p200: NullableObject? = NullableObject("200"), + val p201: NullableObject? = NullableObject("201"), + val p202: NullableObject? = NullableObject("202"), + val p203: NullableObject? = NullableObject("203"), + val p204: NullableObject? = NullableObject("204"), + val p205: NullableObject? = NullableObject("205"), + val p206: NullableObject? = NullableObject("206"), + val p207: NullableObject? = NullableObject("207"), + val p208: NullableObject? = NullableObject("208"), + val p209: NullableObject? = NullableObject("209"), + val p210: NullableObject? = NullableObject("210"), + val p211: NullableObject? = NullableObject("211"), + val p212: NullableObject? = NullableObject("212"), + val p213: NullableObject? = NullableObject("213"), + val p214: NullableObject? = NullableObject("214"), + val p215: NullableObject? = NullableObject("215"), + val p216: NullableObject? = NullableObject("216"), + val p217: NullableObject? = NullableObject("217"), + val p218: NullableObject? = NullableObject("218"), + val p219: NullableObject? = NullableObject("219"), + val p220: NullableObject? = NullableObject("220"), + val p221: NullableObject? = NullableObject("221"), + val p222: NullableObject? = NullableObject("222"), + val p223: NullableObject? = NullableObject("223"), + val p224: NullableObject? = NullableObject("224"), + val p225: NullableObject? = NullableObject("225"), + val p226: NullableObject? = NullableObject("226"), + val p227: NullableObject? = NullableObject("227"), + val p228: NullableObject? = NullableObject("228"), + val p229: NullableObject? = NullableObject("229"), + val p230: NullableObject? = NullableObject("230"), + val p231: NullableObject? = NullableObject("231"), + val p232: NullableObject? = NullableObject("232"), + val p233: NullableObject? = NullableObject("233"), + val p234: NullableObject? = NullableObject("234"), + val p235: NullableObject? = NullableObject("235"), + val p236: NullableObject? = NullableObject("236"), + val p237: NullableObject? = NullableObject("237"), + val p238: NullableObject? = NullableObject("238"), + val p239: NullableObject? = NullableObject("239"), + val p240: NullableObject? = NullableObject("240"), + val p241: NullableObject? = NullableObject("241"), + val p242: NullableObject? = NullableObject("242"), + val p243: NullableObject? = NullableObject("243"), + val p244: NullableObject? = NullableObject("244") + ) + + @Test + fun testMax() { + assertReflectEquals(DstMax(), defaultMapper.readValue("{}")) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByConstructorWithoutDefaultArgumentsTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByConstructorWithoutDefaultArgumentsTest.kt new file mode 100644 index 00000000..4971417c --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByConstructorWithoutDefaultArgumentsTest.kt @@ -0,0 +1,515 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.nullableObject + +import com.fasterxml.jackson.module.kotlin.assertReflectEquals +import com.fasterxml.jackson.module.kotlin.callPrimaryConstructor +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NullableObject +import org.junit.Assert.assertEquals +import kotlin.test.Test + +/** + * Up to argument size 32 there is one mask argument for the default argument, + * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested. + * Also, the maximum size of arguments that can be set by a constructor + * that includes a value class as an argument is 253 (one less by DefaultConstructorMarker), so test that case as well. + */ +class DeserializeByConstructorWithoutDefaultArgumentsTest { + data class Dst32( + val p00: NullableObject, + val p01: NullableObject, + val p02: NullableObject, + val p03: NullableObject, + val p04: NullableObject, + val p05: NullableObject, + val p06: NullableObject, + val p07: NullableObject, + val p08: NullableObject, + val p09: NullableObject, + val p10: NullableObject, + val p11: NullableObject, + val p12: NullableObject, + val p13: NullableObject, + val p14: NullableObject, + val p15: NullableObject, + val p16: NullableObject, + val p17: NullableObject, + val p18: NullableObject, + val p19: NullableObject, + val p20: NullableObject, + val p21: NullableObject, + val p22: NullableObject, + val p23: NullableObject, + val p24: NullableObject, + val p25: NullableObject, + val p26: NullableObject, + val p27: NullableObject, + val p28: NullableObject, + val p29: NullableObject, + val p30: NullableObject, + val p31: NullableObject + ) + + @Test + fun test32() { + val expected = callPrimaryConstructor { NullableObject(it.name!!) } + val src = defaultMapper.writeValueAsString(expected) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst33( + val p00: NullableObject, + val p01: NullableObject, + val p02: NullableObject, + val p03: NullableObject, + val p04: NullableObject, + val p05: NullableObject, + val p06: NullableObject, + val p07: NullableObject, + val p08: NullableObject, + val p09: NullableObject, + val p10: NullableObject, + val p11: NullableObject, + val p12: NullableObject, + val p13: NullableObject, + val p14: NullableObject, + val p15: NullableObject, + val p16: NullableObject, + val p17: NullableObject, + val p18: NullableObject, + val p19: NullableObject, + val p20: NullableObject, + val p21: NullableObject, + val p22: NullableObject, + val p23: NullableObject, + val p24: NullableObject, + val p25: NullableObject, + val p26: NullableObject, + val p27: NullableObject, + val p28: NullableObject, + val p29: NullableObject, + val p30: NullableObject, + val p31: NullableObject, + val p32: NullableObject + ) + + @Test + fun test33() { + val expected = callPrimaryConstructor { NullableObject(it.name!!) } + val src = defaultMapper.writeValueAsString(expected) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst64( + val p00: NullableObject, + val p01: NullableObject, + val p02: NullableObject, + val p03: NullableObject, + val p04: NullableObject, + val p05: NullableObject, + val p06: NullableObject, + val p07: NullableObject, + val p08: NullableObject, + val p09: NullableObject, + val p10: NullableObject, + val p11: NullableObject, + val p12: NullableObject, + val p13: NullableObject, + val p14: NullableObject, + val p15: NullableObject, + val p16: NullableObject, + val p17: NullableObject, + val p18: NullableObject, + val p19: NullableObject, + val p20: NullableObject, + val p21: NullableObject, + val p22: NullableObject, + val p23: NullableObject, + val p24: NullableObject, + val p25: NullableObject, + val p26: NullableObject, + val p27: NullableObject, + val p28: NullableObject, + val p29: NullableObject, + val p30: NullableObject, + val p31: NullableObject, + val p32: NullableObject, + val p33: NullableObject, + val p34: NullableObject, + val p35: NullableObject, + val p36: NullableObject, + val p37: NullableObject, + val p38: NullableObject, + val p39: NullableObject, + val p40: NullableObject, + val p41: NullableObject, + val p42: NullableObject, + val p43: NullableObject, + val p44: NullableObject, + val p45: NullableObject, + val p46: NullableObject, + val p47: NullableObject, + val p48: NullableObject, + val p49: NullableObject, + val p50: NullableObject, + val p51: NullableObject, + val p52: NullableObject, + val p53: NullableObject, + val p54: NullableObject, + val p55: NullableObject, + val p56: NullableObject, + val p57: NullableObject, + val p58: NullableObject, + val p59: NullableObject, + val p60: NullableObject, + val p61: NullableObject, + val p62: NullableObject, + val p63: NullableObject + ) + + @Test + fun test64() { + val expected = callPrimaryConstructor { NullableObject(it.name!!) } + val src = defaultMapper.writeValueAsString(expected) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst65( + val p00: NullableObject, + val p01: NullableObject, + val p02: NullableObject, + val p03: NullableObject, + val p04: NullableObject, + val p05: NullableObject, + val p06: NullableObject, + val p07: NullableObject, + val p08: NullableObject, + val p09: NullableObject, + val p10: NullableObject, + val p11: NullableObject, + val p12: NullableObject, + val p13: NullableObject, + val p14: NullableObject, + val p15: NullableObject, + val p16: NullableObject, + val p17: NullableObject, + val p18: NullableObject, + val p19: NullableObject, + val p20: NullableObject, + val p21: NullableObject, + val p22: NullableObject, + val p23: NullableObject, + val p24: NullableObject, + val p25: NullableObject, + val p26: NullableObject, + val p27: NullableObject, + val p28: NullableObject, + val p29: NullableObject, + val p30: NullableObject, + val p31: NullableObject, + val p32: NullableObject, + val p33: NullableObject, + val p34: NullableObject, + val p35: NullableObject, + val p36: NullableObject, + val p37: NullableObject, + val p38: NullableObject, + val p39: NullableObject, + val p40: NullableObject, + val p41: NullableObject, + val p42: NullableObject, + val p43: NullableObject, + val p44: NullableObject, + val p45: NullableObject, + val p46: NullableObject, + val p47: NullableObject, + val p48: NullableObject, + val p49: NullableObject, + val p50: NullableObject, + val p51: NullableObject, + val p52: NullableObject, + val p53: NullableObject, + val p54: NullableObject, + val p55: NullableObject, + val p56: NullableObject, + val p57: NullableObject, + val p58: NullableObject, + val p59: NullableObject, + val p60: NullableObject, + val p61: NullableObject, + val p62: NullableObject, + val p63: NullableObject, + val p64: NullableObject + ) + + @Test + fun test65() { + val expected = callPrimaryConstructor { NullableObject(it.name!!) } + val src = defaultMapper.writeValueAsString(expected) + assertEquals(expected, defaultMapper.readValue(src)) + } + + // It cannot be a data class because the generated method would exceed the argument size limit. + class DstMax( + val p000: NullableObject, + val p001: NullableObject, + val p002: NullableObject, + val p003: NullableObject, + val p004: NullableObject, + val p005: NullableObject, + val p006: NullableObject, + val p007: NullableObject, + val p008: NullableObject, + val p009: NullableObject, + val p010: NullableObject, + val p011: NullableObject, + val p012: NullableObject, + val p013: NullableObject, + val p014: NullableObject, + val p015: NullableObject, + val p016: NullableObject, + val p017: NullableObject, + val p018: NullableObject, + val p019: NullableObject, + val p020: NullableObject, + val p021: NullableObject, + val p022: NullableObject, + val p023: NullableObject, + val p024: NullableObject, + val p025: NullableObject, + val p026: NullableObject, + val p027: NullableObject, + val p028: NullableObject, + val p029: NullableObject, + val p030: NullableObject, + val p031: NullableObject, + val p032: NullableObject, + val p033: NullableObject, + val p034: NullableObject, + val p035: NullableObject, + val p036: NullableObject, + val p037: NullableObject, + val p038: NullableObject, + val p039: NullableObject, + val p040: NullableObject, + val p041: NullableObject, + val p042: NullableObject, + val p043: NullableObject, + val p044: NullableObject, + val p045: NullableObject, + val p046: NullableObject, + val p047: NullableObject, + val p048: NullableObject, + val p049: NullableObject, + val p050: NullableObject, + val p051: NullableObject, + val p052: NullableObject, + val p053: NullableObject, + val p054: NullableObject, + val p055: NullableObject, + val p056: NullableObject, + val p057: NullableObject, + val p058: NullableObject, + val p059: NullableObject, + val p060: NullableObject, + val p061: NullableObject, + val p062: NullableObject, + val p063: NullableObject, + val p064: NullableObject, + val p065: NullableObject, + val p066: NullableObject, + val p067: NullableObject, + val p068: NullableObject, + val p069: NullableObject, + val p070: NullableObject, + val p071: NullableObject, + val p072: NullableObject, + val p073: NullableObject, + val p074: NullableObject, + val p075: NullableObject, + val p076: NullableObject, + val p077: NullableObject, + val p078: NullableObject, + val p079: NullableObject, + val p080: NullableObject, + val p081: NullableObject, + val p082: NullableObject, + val p083: NullableObject, + val p084: NullableObject, + val p085: NullableObject, + val p086: NullableObject, + val p087: NullableObject, + val p088: NullableObject, + val p089: NullableObject, + val p090: NullableObject, + val p091: NullableObject, + val p092: NullableObject, + val p093: NullableObject, + val p094: NullableObject, + val p095: NullableObject, + val p096: NullableObject, + val p097: NullableObject, + val p098: NullableObject, + val p099: NullableObject, + val p100: NullableObject, + val p101: NullableObject, + val p102: NullableObject, + val p103: NullableObject, + val p104: NullableObject, + val p105: NullableObject, + val p106: NullableObject, + val p107: NullableObject, + val p108: NullableObject, + val p109: NullableObject, + val p110: NullableObject, + val p111: NullableObject, + val p112: NullableObject, + val p113: NullableObject, + val p114: NullableObject, + val p115: NullableObject, + val p116: NullableObject, + val p117: NullableObject, + val p118: NullableObject, + val p119: NullableObject, + val p120: NullableObject, + val p121: NullableObject, + val p122: NullableObject, + val p123: NullableObject, + val p124: NullableObject, + val p125: NullableObject, + val p126: NullableObject, + val p127: NullableObject, + val p128: NullableObject, + val p129: NullableObject, + val p130: NullableObject, + val p131: NullableObject, + val p132: NullableObject, + val p133: NullableObject, + val p134: NullableObject, + val p135: NullableObject, + val p136: NullableObject, + val p137: NullableObject, + val p138: NullableObject, + val p139: NullableObject, + val p140: NullableObject, + val p141: NullableObject, + val p142: NullableObject, + val p143: NullableObject, + val p144: NullableObject, + val p145: NullableObject, + val p146: NullableObject, + val p147: NullableObject, + val p148: NullableObject, + val p149: NullableObject, + val p150: NullableObject, + val p151: NullableObject, + val p152: NullableObject, + val p153: NullableObject, + val p154: NullableObject, + val p155: NullableObject, + val p156: NullableObject, + val p157: NullableObject, + val p158: NullableObject, + val p159: NullableObject, + val p160: NullableObject, + val p161: NullableObject, + val p162: NullableObject, + val p163: NullableObject, + val p164: NullableObject, + val p165: NullableObject, + val p166: NullableObject, + val p167: NullableObject, + val p168: NullableObject, + val p169: NullableObject, + val p170: NullableObject, + val p171: NullableObject, + val p172: NullableObject, + val p173: NullableObject, + val p174: NullableObject, + val p175: NullableObject, + val p176: NullableObject, + val p177: NullableObject, + val p178: NullableObject, + val p179: NullableObject, + val p180: NullableObject, + val p181: NullableObject, + val p182: NullableObject, + val p183: NullableObject, + val p184: NullableObject, + val p185: NullableObject, + val p186: NullableObject, + val p187: NullableObject, + val p188: NullableObject, + val p189: NullableObject, + val p190: NullableObject, + val p191: NullableObject, + val p192: NullableObject, + val p193: NullableObject, + val p194: NullableObject, + val p195: NullableObject, + val p196: NullableObject, + val p197: NullableObject, + val p198: NullableObject, + val p199: NullableObject, + val p200: NullableObject, + val p201: NullableObject, + val p202: NullableObject, + val p203: NullableObject, + val p204: NullableObject, + val p205: NullableObject, + val p206: NullableObject, + val p207: NullableObject, + val p208: NullableObject, + val p209: NullableObject, + val p210: NullableObject, + val p211: NullableObject, + val p212: NullableObject, + val p213: NullableObject, + val p214: NullableObject, + val p215: NullableObject, + val p216: NullableObject, + val p217: NullableObject, + val p218: NullableObject, + val p219: NullableObject, + val p220: NullableObject, + val p221: NullableObject, + val p222: NullableObject, + val p223: NullableObject, + val p224: NullableObject, + val p225: NullableObject, + val p226: NullableObject, + val p227: NullableObject, + val p228: NullableObject, + val p229: NullableObject, + val p230: NullableObject, + val p231: NullableObject, + val p232: NullableObject, + val p233: NullableObject, + val p234: NullableObject, + val p235: NullableObject, + val p236: NullableObject, + val p237: NullableObject, + val p238: NullableObject, + val p239: NullableObject, + val p240: NullableObject, + val p241: NullableObject, + val p242: NullableObject, + val p243: NullableObject, + val p244: NullableObject, + val p245: NullableObject, + val p246: NullableObject, + val p247: NullableObject, + val p248: NullableObject, + val p249: NullableObject, + val p250: NullableObject, + val p251: NullableObject, + val p252: NullableObject + ) + + @Test + fun testMax() { + val expected = callPrimaryConstructor { NullableObject(it.name!!) } + val src = defaultMapper.writeValueAsString(expected) + assertReflectEquals(expected, defaultMapper.readValue(src)) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByFactoryWithDefaultArgumentsTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByFactoryWithDefaultArgumentsTest.kt new file mode 100644 index 00000000..15339b9b --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByFactoryWithDefaultArgumentsTest.kt @@ -0,0 +1,1411 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.nullableObject + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.module.kotlin.assertReflectEquals +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NullableObject +import org.junit.Assert.assertEquals +import kotlin.test.Test + +/** + * Up to argument size 32 there is one mask argument for the default argument, + * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested. + * Also, the maximum argument size that can be set in the constructor is 244, so that case is tested as well. + */ +class DeserializeByFactoryWithDefaultArgumentsTest { + data class Dst32( + val p00: NullableObject?, + val p01: NullableObject?, + val p02: NullableObject?, + val p03: NullableObject?, + val p04: NullableObject?, + val p05: NullableObject?, + val p06: NullableObject?, + val p07: NullableObject?, + val p08: NullableObject?, + val p09: NullableObject?, + val p10: NullableObject?, + val p11: NullableObject?, + val p12: NullableObject?, + val p13: NullableObject?, + val p14: NullableObject?, + val p15: NullableObject?, + val p16: NullableObject?, + val p17: NullableObject?, + val p18: NullableObject?, + val p19: NullableObject?, + val p20: NullableObject?, + val p21: NullableObject?, + val p22: NullableObject?, + val p23: NullableObject?, + val p24: NullableObject?, + val p25: NullableObject?, + val p26: NullableObject?, + val p27: NullableObject?, + val p28: NullableObject?, + val p29: NullableObject?, + val p30: NullableObject?, + val p31: NullableObject? + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NullableObject? = NullableObject("p00"), + q01: NullableObject? = NullableObject("p01"), + q02: NullableObject? = NullableObject("p02"), + q03: NullableObject? = NullableObject("p03"), + q04: NullableObject? = NullableObject("p04"), + q05: NullableObject? = NullableObject("p05"), + q06: NullableObject? = NullableObject("p06"), + q07: NullableObject? = NullableObject("p07"), + q08: NullableObject? = NullableObject("p08"), + q09: NullableObject? = NullableObject("p09"), + q10: NullableObject? = NullableObject("p10"), + q11: NullableObject? = NullableObject("p11"), + q12: NullableObject? = NullableObject("p12"), + q13: NullableObject? = NullableObject("p13"), + q14: NullableObject? = NullableObject("p14"), + q15: NullableObject? = NullableObject("p15"), + q16: NullableObject? = NullableObject("p16"), + q17: NullableObject? = NullableObject("p17"), + q18: NullableObject? = NullableObject("p18"), + q19: NullableObject? = NullableObject("p19"), + q20: NullableObject? = NullableObject("p20"), + q21: NullableObject? = NullableObject("p21"), + q22: NullableObject? = NullableObject("p22"), + q23: NullableObject? = NullableObject("p23"), + q24: NullableObject? = NullableObject("p24"), + q25: NullableObject? = NullableObject("p25"), + q26: NullableObject? = NullableObject("p26"), + q27: NullableObject? = NullableObject("p27"), + q28: NullableObject? = NullableObject("p28"), + q29: NullableObject? = NullableObject("p29"), + q30: NullableObject? = NullableObject("p30"), + q31: NullableObject? = NullableObject("p31") + ) = Dst32( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31 + ) + } + } + + @Test + fun test32() { + assertEquals(Dst32.creator(), defaultMapper.readValue("{}")) + } + + data class Dst33( + val p00: NullableObject?, + val p01: NullableObject?, + val p02: NullableObject?, + val p03: NullableObject?, + val p04: NullableObject?, + val p05: NullableObject?, + val p06: NullableObject?, + val p07: NullableObject?, + val p08: NullableObject?, + val p09: NullableObject?, + val p10: NullableObject?, + val p11: NullableObject?, + val p12: NullableObject?, + val p13: NullableObject?, + val p14: NullableObject?, + val p15: NullableObject?, + val p16: NullableObject?, + val p17: NullableObject?, + val p18: NullableObject?, + val p19: NullableObject?, + val p20: NullableObject?, + val p21: NullableObject?, + val p22: NullableObject?, + val p23: NullableObject?, + val p24: NullableObject?, + val p25: NullableObject?, + val p26: NullableObject?, + val p27: NullableObject?, + val p28: NullableObject?, + val p29: NullableObject?, + val p30: NullableObject?, + val p31: NullableObject?, + val p32: NullableObject? + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NullableObject? = NullableObject("p00"), + q01: NullableObject? = NullableObject("p01"), + q02: NullableObject? = NullableObject("p02"), + q03: NullableObject? = NullableObject("p03"), + q04: NullableObject? = NullableObject("p04"), + q05: NullableObject? = NullableObject("p05"), + q06: NullableObject? = NullableObject("p06"), + q07: NullableObject? = NullableObject("p07"), + q08: NullableObject? = NullableObject("p08"), + q09: NullableObject? = NullableObject("p09"), + q10: NullableObject? = NullableObject("p10"), + q11: NullableObject? = NullableObject("p11"), + q12: NullableObject? = NullableObject("p12"), + q13: NullableObject? = NullableObject("p13"), + q14: NullableObject? = NullableObject("p14"), + q15: NullableObject? = NullableObject("p15"), + q16: NullableObject? = NullableObject("p16"), + q17: NullableObject? = NullableObject("p17"), + q18: NullableObject? = NullableObject("p18"), + q19: NullableObject? = NullableObject("p19"), + q20: NullableObject? = NullableObject("p20"), + q21: NullableObject? = NullableObject("p21"), + q22: NullableObject? = NullableObject("p22"), + q23: NullableObject? = NullableObject("p23"), + q24: NullableObject? = NullableObject("p24"), + q25: NullableObject? = NullableObject("p25"), + q26: NullableObject? = NullableObject("p26"), + q27: NullableObject? = NullableObject("p27"), + q28: NullableObject? = NullableObject("p28"), + q29: NullableObject? = NullableObject("p29"), + q30: NullableObject? = NullableObject("p30"), + q31: NullableObject? = NullableObject("p31"), + q32: NullableObject? = NullableObject("p32") + ) = Dst33( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32 + ) + } + } + + @Test + fun test33() { + assertEquals(Dst33.creator(), defaultMapper.readValue("{}")) + } + + data class Dst64( + val p00: NullableObject?, + val p01: NullableObject?, + val p02: NullableObject?, + val p03: NullableObject?, + val p04: NullableObject?, + val p05: NullableObject?, + val p06: NullableObject?, + val p07: NullableObject?, + val p08: NullableObject?, + val p09: NullableObject?, + val p10: NullableObject?, + val p11: NullableObject?, + val p12: NullableObject?, + val p13: NullableObject?, + val p14: NullableObject?, + val p15: NullableObject?, + val p16: NullableObject?, + val p17: NullableObject?, + val p18: NullableObject?, + val p19: NullableObject?, + val p20: NullableObject?, + val p21: NullableObject?, + val p22: NullableObject?, + val p23: NullableObject?, + val p24: NullableObject?, + val p25: NullableObject?, + val p26: NullableObject?, + val p27: NullableObject?, + val p28: NullableObject?, + val p29: NullableObject?, + val p30: NullableObject?, + val p31: NullableObject?, + val p32: NullableObject?, + val p33: NullableObject?, + val p34: NullableObject?, + val p35: NullableObject?, + val p36: NullableObject?, + val p37: NullableObject?, + val p38: NullableObject?, + val p39: NullableObject?, + val p40: NullableObject?, + val p41: NullableObject?, + val p42: NullableObject?, + val p43: NullableObject?, + val p44: NullableObject?, + val p45: NullableObject?, + val p46: NullableObject?, + val p47: NullableObject?, + val p48: NullableObject?, + val p49: NullableObject?, + val p50: NullableObject?, + val p51: NullableObject?, + val p52: NullableObject?, + val p53: NullableObject?, + val p54: NullableObject?, + val p55: NullableObject?, + val p56: NullableObject?, + val p57: NullableObject?, + val p58: NullableObject?, + val p59: NullableObject?, + val p60: NullableObject?, + val p61: NullableObject?, + val p62: NullableObject?, + val p63: NullableObject? + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NullableObject? = NullableObject("p00"), + q01: NullableObject? = NullableObject("p01"), + q02: NullableObject? = NullableObject("p02"), + q03: NullableObject? = NullableObject("p03"), + q04: NullableObject? = NullableObject("p04"), + q05: NullableObject? = NullableObject("p05"), + q06: NullableObject? = NullableObject("p06"), + q07: NullableObject? = NullableObject("p07"), + q08: NullableObject? = NullableObject("p08"), + q09: NullableObject? = NullableObject("p09"), + q10: NullableObject? = NullableObject("p10"), + q11: NullableObject? = NullableObject("p11"), + q12: NullableObject? = NullableObject("p12"), + q13: NullableObject? = NullableObject("p13"), + q14: NullableObject? = NullableObject("p14"), + q15: NullableObject? = NullableObject("p15"), + q16: NullableObject? = NullableObject("p16"), + q17: NullableObject? = NullableObject("p17"), + q18: NullableObject? = NullableObject("p18"), + q19: NullableObject? = NullableObject("p19"), + q20: NullableObject? = NullableObject("p20"), + q21: NullableObject? = NullableObject("p21"), + q22: NullableObject? = NullableObject("p22"), + q23: NullableObject? = NullableObject("p23"), + q24: NullableObject? = NullableObject("p24"), + q25: NullableObject? = NullableObject("p25"), + q26: NullableObject? = NullableObject("p26"), + q27: NullableObject? = NullableObject("p27"), + q28: NullableObject? = NullableObject("p28"), + q29: NullableObject? = NullableObject("p29"), + q30: NullableObject? = NullableObject("p30"), + q31: NullableObject? = NullableObject("p31"), + q32: NullableObject? = NullableObject("p32"), + q33: NullableObject? = NullableObject("p33"), + q34: NullableObject? = NullableObject("p34"), + q35: NullableObject? = NullableObject("p35"), + q36: NullableObject? = NullableObject("p36"), + q37: NullableObject? = NullableObject("p37"), + q38: NullableObject? = NullableObject("p38"), + q39: NullableObject? = NullableObject("p39"), + q40: NullableObject? = NullableObject("p40"), + q41: NullableObject? = NullableObject("p41"), + q42: NullableObject? = NullableObject("p42"), + q43: NullableObject? = NullableObject("p43"), + q44: NullableObject? = NullableObject("p44"), + q45: NullableObject? = NullableObject("p45"), + q46: NullableObject? = NullableObject("p46"), + q47: NullableObject? = NullableObject("p47"), + q48: NullableObject? = NullableObject("p48"), + q49: NullableObject? = NullableObject("p49"), + q50: NullableObject? = NullableObject("p50"), + q51: NullableObject? = NullableObject("p51"), + q52: NullableObject? = NullableObject("p52"), + q53: NullableObject? = NullableObject("p53"), + q54: NullableObject? = NullableObject("p54"), + q55: NullableObject? = NullableObject("p55"), + q56: NullableObject? = NullableObject("p56"), + q57: NullableObject? = NullableObject("p57"), + q58: NullableObject? = NullableObject("p58"), + q59: NullableObject? = NullableObject("p59"), + q60: NullableObject? = NullableObject("p60"), + q61: NullableObject? = NullableObject("p61"), + q62: NullableObject? = NullableObject("p62"), + q63: NullableObject? = NullableObject("p63") + ) = Dst64( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32, + q33, + q34, + q35, + q36, + q37, + q38, + q39, + q40, + q41, + q42, + q43, + q44, + q45, + q46, + q47, + q48, + q49, + q50, + q51, + q52, + q53, + q54, + q55, + q56, + q57, + q58, + q59, + q60, + q61, + q62, + q63 + ) + } + } + + @Test + fun test64() { + assertEquals(Dst64.creator(), defaultMapper.readValue("{}")) + } + + data class Dst65( + val p00: NullableObject?, + val p01: NullableObject?, + val p02: NullableObject?, + val p03: NullableObject?, + val p04: NullableObject?, + val p05: NullableObject?, + val p06: NullableObject?, + val p07: NullableObject?, + val p08: NullableObject?, + val p09: NullableObject?, + val p10: NullableObject?, + val p11: NullableObject?, + val p12: NullableObject?, + val p13: NullableObject?, + val p14: NullableObject?, + val p15: NullableObject?, + val p16: NullableObject?, + val p17: NullableObject?, + val p18: NullableObject?, + val p19: NullableObject?, + val p20: NullableObject?, + val p21: NullableObject?, + val p22: NullableObject?, + val p23: NullableObject?, + val p24: NullableObject?, + val p25: NullableObject?, + val p26: NullableObject?, + val p27: NullableObject?, + val p28: NullableObject?, + val p29: NullableObject?, + val p30: NullableObject?, + val p31: NullableObject?, + val p32: NullableObject?, + val p33: NullableObject?, + val p34: NullableObject?, + val p35: NullableObject?, + val p36: NullableObject?, + val p37: NullableObject?, + val p38: NullableObject?, + val p39: NullableObject?, + val p40: NullableObject?, + val p41: NullableObject?, + val p42: NullableObject?, + val p43: NullableObject?, + val p44: NullableObject?, + val p45: NullableObject?, + val p46: NullableObject?, + val p47: NullableObject?, + val p48: NullableObject?, + val p49: NullableObject?, + val p50: NullableObject?, + val p51: NullableObject?, + val p52: NullableObject?, + val p53: NullableObject?, + val p54: NullableObject?, + val p55: NullableObject?, + val p56: NullableObject?, + val p57: NullableObject?, + val p58: NullableObject?, + val p59: NullableObject?, + val p60: NullableObject?, + val p61: NullableObject?, + val p62: NullableObject?, + val p63: NullableObject?, + val p64: NullableObject? + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NullableObject? = NullableObject("p00"), + q01: NullableObject? = NullableObject("p01"), + q02: NullableObject? = NullableObject("p02"), + q03: NullableObject? = NullableObject("p03"), + q04: NullableObject? = NullableObject("p04"), + q05: NullableObject? = NullableObject("p05"), + q06: NullableObject? = NullableObject("p06"), + q07: NullableObject? = NullableObject("p07"), + q08: NullableObject? = NullableObject("p08"), + q09: NullableObject? = NullableObject("p09"), + q10: NullableObject? = NullableObject("p10"), + q11: NullableObject? = NullableObject("p11"), + q12: NullableObject? = NullableObject("p12"), + q13: NullableObject? = NullableObject("p13"), + q14: NullableObject? = NullableObject("p14"), + q15: NullableObject? = NullableObject("p15"), + q16: NullableObject? = NullableObject("p16"), + q17: NullableObject? = NullableObject("p17"), + q18: NullableObject? = NullableObject("p18"), + q19: NullableObject? = NullableObject("p19"), + q20: NullableObject? = NullableObject("p20"), + q21: NullableObject? = NullableObject("p21"), + q22: NullableObject? = NullableObject("p22"), + q23: NullableObject? = NullableObject("p23"), + q24: NullableObject? = NullableObject("p24"), + q25: NullableObject? = NullableObject("p25"), + q26: NullableObject? = NullableObject("p26"), + q27: NullableObject? = NullableObject("p27"), + q28: NullableObject? = NullableObject("p28"), + q29: NullableObject? = NullableObject("p29"), + q30: NullableObject? = NullableObject("p30"), + q31: NullableObject? = NullableObject("p31"), + q32: NullableObject? = NullableObject("p32"), + q33: NullableObject? = NullableObject("p33"), + q34: NullableObject? = NullableObject("p34"), + q35: NullableObject? = NullableObject("p35"), + q36: NullableObject? = NullableObject("p36"), + q37: NullableObject? = NullableObject("p37"), + q38: NullableObject? = NullableObject("p38"), + q39: NullableObject? = NullableObject("p39"), + q40: NullableObject? = NullableObject("p40"), + q41: NullableObject? = NullableObject("p41"), + q42: NullableObject? = NullableObject("p42"), + q43: NullableObject? = NullableObject("p43"), + q44: NullableObject? = NullableObject("p44"), + q45: NullableObject? = NullableObject("p45"), + q46: NullableObject? = NullableObject("p46"), + q47: NullableObject? = NullableObject("p47"), + q48: NullableObject? = NullableObject("p48"), + q49: NullableObject? = NullableObject("p49"), + q50: NullableObject? = NullableObject("p50"), + q51: NullableObject? = NullableObject("p51"), + q52: NullableObject? = NullableObject("p52"), + q53: NullableObject? = NullableObject("p53"), + q54: NullableObject? = NullableObject("p54"), + q55: NullableObject? = NullableObject("p55"), + q56: NullableObject? = NullableObject("p56"), + q57: NullableObject? = NullableObject("p57"), + q58: NullableObject? = NullableObject("p58"), + q59: NullableObject? = NullableObject("p59"), + q60: NullableObject? = NullableObject("p60"), + q61: NullableObject? = NullableObject("p61"), + q62: NullableObject? = NullableObject("p62"), + q63: NullableObject? = NullableObject("p63"), + q64: NullableObject? = NullableObject("p64") + ) = Dst65( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32, + q33, + q34, + q35, + q36, + q37, + q38, + q39, + q40, + q41, + q42, + q43, + q44, + q45, + q46, + q47, + q48, + q49, + q50, + q51, + q52, + q53, + q54, + q55, + q56, + q57, + q58, + q59, + q60, + q61, + q62, + q63, + q64 + ) + } + } + + @Test + fun test65() { + assertEquals(Dst65.creator(), defaultMapper.readValue("{}")) + } + + // It cannot be a data class because the generated method would exceed the argument size limit. + class DstMax( + val p000: NullableObject?, + val p001: NullableObject?, + val p002: NullableObject?, + val p003: NullableObject?, + val p004: NullableObject?, + val p005: NullableObject?, + val p006: NullableObject?, + val p007: NullableObject?, + val p008: NullableObject?, + val p009: NullableObject?, + val p010: NullableObject?, + val p011: NullableObject?, + val p012: NullableObject?, + val p013: NullableObject?, + val p014: NullableObject?, + val p015: NullableObject?, + val p016: NullableObject?, + val p017: NullableObject?, + val p018: NullableObject?, + val p019: NullableObject?, + val p020: NullableObject?, + val p021: NullableObject?, + val p022: NullableObject?, + val p023: NullableObject?, + val p024: NullableObject?, + val p025: NullableObject?, + val p026: NullableObject?, + val p027: NullableObject?, + val p028: NullableObject?, + val p029: NullableObject?, + val p030: NullableObject?, + val p031: NullableObject?, + val p032: NullableObject?, + val p033: NullableObject?, + val p034: NullableObject?, + val p035: NullableObject?, + val p036: NullableObject?, + val p037: NullableObject?, + val p038: NullableObject?, + val p039: NullableObject?, + val p040: NullableObject?, + val p041: NullableObject?, + val p042: NullableObject?, + val p043: NullableObject?, + val p044: NullableObject?, + val p045: NullableObject?, + val p046: NullableObject?, + val p047: NullableObject?, + val p048: NullableObject?, + val p049: NullableObject?, + val p050: NullableObject?, + val p051: NullableObject?, + val p052: NullableObject?, + val p053: NullableObject?, + val p054: NullableObject?, + val p055: NullableObject?, + val p056: NullableObject?, + val p057: NullableObject?, + val p058: NullableObject?, + val p059: NullableObject?, + val p060: NullableObject?, + val p061: NullableObject?, + val p062: NullableObject?, + val p063: NullableObject?, + val p064: NullableObject?, + val p065: NullableObject?, + val p066: NullableObject?, + val p067: NullableObject?, + val p068: NullableObject?, + val p069: NullableObject?, + val p070: NullableObject?, + val p071: NullableObject?, + val p072: NullableObject?, + val p073: NullableObject?, + val p074: NullableObject?, + val p075: NullableObject?, + val p076: NullableObject?, + val p077: NullableObject?, + val p078: NullableObject?, + val p079: NullableObject?, + val p080: NullableObject?, + val p081: NullableObject?, + val p082: NullableObject?, + val p083: NullableObject?, + val p084: NullableObject?, + val p085: NullableObject?, + val p086: NullableObject?, + val p087: NullableObject?, + val p088: NullableObject?, + val p089: NullableObject?, + val p090: NullableObject?, + val p091: NullableObject?, + val p092: NullableObject?, + val p093: NullableObject?, + val p094: NullableObject?, + val p095: NullableObject?, + val p096: NullableObject?, + val p097: NullableObject?, + val p098: NullableObject?, + val p099: NullableObject?, + val p100: NullableObject?, + val p101: NullableObject?, + val p102: NullableObject?, + val p103: NullableObject?, + val p104: NullableObject?, + val p105: NullableObject?, + val p106: NullableObject?, + val p107: NullableObject?, + val p108: NullableObject?, + val p109: NullableObject?, + val p110: NullableObject?, + val p111: NullableObject?, + val p112: NullableObject?, + val p113: NullableObject?, + val p114: NullableObject?, + val p115: NullableObject?, + val p116: NullableObject?, + val p117: NullableObject?, + val p118: NullableObject?, + val p119: NullableObject?, + val p120: NullableObject?, + val p121: NullableObject?, + val p122: NullableObject?, + val p123: NullableObject?, + val p124: NullableObject?, + val p125: NullableObject?, + val p126: NullableObject?, + val p127: NullableObject?, + val p128: NullableObject?, + val p129: NullableObject?, + val p130: NullableObject?, + val p131: NullableObject?, + val p132: NullableObject?, + val p133: NullableObject?, + val p134: NullableObject?, + val p135: NullableObject?, + val p136: NullableObject?, + val p137: NullableObject?, + val p138: NullableObject?, + val p139: NullableObject?, + val p140: NullableObject?, + val p141: NullableObject?, + val p142: NullableObject?, + val p143: NullableObject?, + val p144: NullableObject?, + val p145: NullableObject?, + val p146: NullableObject?, + val p147: NullableObject?, + val p148: NullableObject?, + val p149: NullableObject?, + val p150: NullableObject?, + val p151: NullableObject?, + val p152: NullableObject?, + val p153: NullableObject?, + val p154: NullableObject?, + val p155: NullableObject?, + val p156: NullableObject?, + val p157: NullableObject?, + val p158: NullableObject?, + val p159: NullableObject?, + val p160: NullableObject?, + val p161: NullableObject?, + val p162: NullableObject?, + val p163: NullableObject?, + val p164: NullableObject?, + val p165: NullableObject?, + val p166: NullableObject?, + val p167: NullableObject?, + val p168: NullableObject?, + val p169: NullableObject?, + val p170: NullableObject?, + val p171: NullableObject?, + val p172: NullableObject?, + val p173: NullableObject?, + val p174: NullableObject?, + val p175: NullableObject?, + val p176: NullableObject?, + val p177: NullableObject?, + val p178: NullableObject?, + val p179: NullableObject?, + val p180: NullableObject?, + val p181: NullableObject?, + val p182: NullableObject?, + val p183: NullableObject?, + val p184: NullableObject?, + val p185: NullableObject?, + val p186: NullableObject?, + val p187: NullableObject?, + val p188: NullableObject?, + val p189: NullableObject?, + val p190: NullableObject?, + val p191: NullableObject?, + val p192: NullableObject?, + val p193: NullableObject?, + val p194: NullableObject?, + val p195: NullableObject?, + val p196: NullableObject?, + val p197: NullableObject?, + val p198: NullableObject?, + val p199: NullableObject?, + val p200: NullableObject?, + val p201: NullableObject?, + val p202: NullableObject?, + val p203: NullableObject?, + val p204: NullableObject?, + val p205: NullableObject?, + val p206: NullableObject?, + val p207: NullableObject?, + val p208: NullableObject?, + val p209: NullableObject?, + val p210: NullableObject?, + val p211: NullableObject?, + val p212: NullableObject?, + val p213: NullableObject?, + val p214: NullableObject?, + val p215: NullableObject?, + val p216: NullableObject?, + val p217: NullableObject?, + val p218: NullableObject?, + val p219: NullableObject?, + val p220: NullableObject?, + val p221: NullableObject?, + val p222: NullableObject?, + val p223: NullableObject?, + val p224: NullableObject?, + val p225: NullableObject?, + val p226: NullableObject?, + val p227: NullableObject?, + val p228: NullableObject?, + val p229: NullableObject?, + val p230: NullableObject?, + val p231: NullableObject?, + val p232: NullableObject?, + val p233: NullableObject?, + val p234: NullableObject?, + val p235: NullableObject?, + val p236: NullableObject?, + val p237: NullableObject?, + val p238: NullableObject?, + val p239: NullableObject?, + val p240: NullableObject?, + val p241: NullableObject?, + val p242: NullableObject?, + val p243: NullableObject? + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q000: NullableObject? = NullableObject("p000"), + q001: NullableObject? = NullableObject("p001"), + q002: NullableObject? = NullableObject("p002"), + q003: NullableObject? = NullableObject("p003"), + q004: NullableObject? = NullableObject("p004"), + q005: NullableObject? = NullableObject("p005"), + q006: NullableObject? = NullableObject("p006"), + q007: NullableObject? = NullableObject("p007"), + q008: NullableObject? = NullableObject("p008"), + q009: NullableObject? = NullableObject("p009"), + q010: NullableObject? = NullableObject("p010"), + q011: NullableObject? = NullableObject("p011"), + q012: NullableObject? = NullableObject("p012"), + q013: NullableObject? = NullableObject("p013"), + q014: NullableObject? = NullableObject("p014"), + q015: NullableObject? = NullableObject("p015"), + q016: NullableObject? = NullableObject("p016"), + q017: NullableObject? = NullableObject("p017"), + q018: NullableObject? = NullableObject("p018"), + q019: NullableObject? = NullableObject("p019"), + q020: NullableObject? = NullableObject("p020"), + q021: NullableObject? = NullableObject("p021"), + q022: NullableObject? = NullableObject("p022"), + q023: NullableObject? = NullableObject("p023"), + q024: NullableObject? = NullableObject("p024"), + q025: NullableObject? = NullableObject("p025"), + q026: NullableObject? = NullableObject("p026"), + q027: NullableObject? = NullableObject("p027"), + q028: NullableObject? = NullableObject("p028"), + q029: NullableObject? = NullableObject("p029"), + q030: NullableObject? = NullableObject("p030"), + q031: NullableObject? = NullableObject("p031"), + q032: NullableObject? = NullableObject("p032"), + q033: NullableObject? = NullableObject("p033"), + q034: NullableObject? = NullableObject("p034"), + q035: NullableObject? = NullableObject("p035"), + q036: NullableObject? = NullableObject("p036"), + q037: NullableObject? = NullableObject("p037"), + q038: NullableObject? = NullableObject("p038"), + q039: NullableObject? = NullableObject("p039"), + q040: NullableObject? = NullableObject("p040"), + q041: NullableObject? = NullableObject("p041"), + q042: NullableObject? = NullableObject("p042"), + q043: NullableObject? = NullableObject("p043"), + q044: NullableObject? = NullableObject("p044"), + q045: NullableObject? = NullableObject("p045"), + q046: NullableObject? = NullableObject("p046"), + q047: NullableObject? = NullableObject("p047"), + q048: NullableObject? = NullableObject("p048"), + q049: NullableObject? = NullableObject("p049"), + q050: NullableObject? = NullableObject("p050"), + q051: NullableObject? = NullableObject("p051"), + q052: NullableObject? = NullableObject("p052"), + q053: NullableObject? = NullableObject("p053"), + q054: NullableObject? = NullableObject("p054"), + q055: NullableObject? = NullableObject("p055"), + q056: NullableObject? = NullableObject("p056"), + q057: NullableObject? = NullableObject("p057"), + q058: NullableObject? = NullableObject("p058"), + q059: NullableObject? = NullableObject("p059"), + q060: NullableObject? = NullableObject("p060"), + q061: NullableObject? = NullableObject("p061"), + q062: NullableObject? = NullableObject("p062"), + q063: NullableObject? = NullableObject("p063"), + q064: NullableObject? = NullableObject("p064"), + q065: NullableObject? = NullableObject("p065"), + q066: NullableObject? = NullableObject("p066"), + q067: NullableObject? = NullableObject("p067"), + q068: NullableObject? = NullableObject("p068"), + q069: NullableObject? = NullableObject("p069"), + q070: NullableObject? = NullableObject("p070"), + q071: NullableObject? = NullableObject("p071"), + q072: NullableObject? = NullableObject("p072"), + q073: NullableObject? = NullableObject("p073"), + q074: NullableObject? = NullableObject("p074"), + q075: NullableObject? = NullableObject("p075"), + q076: NullableObject? = NullableObject("p076"), + q077: NullableObject? = NullableObject("p077"), + q078: NullableObject? = NullableObject("p078"), + q079: NullableObject? = NullableObject("p079"), + q080: NullableObject? = NullableObject("p080"), + q081: NullableObject? = NullableObject("p081"), + q082: NullableObject? = NullableObject("p082"), + q083: NullableObject? = NullableObject("p083"), + q084: NullableObject? = NullableObject("p084"), + q085: NullableObject? = NullableObject("p085"), + q086: NullableObject? = NullableObject("p086"), + q087: NullableObject? = NullableObject("p087"), + q088: NullableObject? = NullableObject("p088"), + q089: NullableObject? = NullableObject("p089"), + q090: NullableObject? = NullableObject("p090"), + q091: NullableObject? = NullableObject("p091"), + q092: NullableObject? = NullableObject("p092"), + q093: NullableObject? = NullableObject("p093"), + q094: NullableObject? = NullableObject("p094"), + q095: NullableObject? = NullableObject("p095"), + q096: NullableObject? = NullableObject("p096"), + q097: NullableObject? = NullableObject("p097"), + q098: NullableObject? = NullableObject("p098"), + q099: NullableObject? = NullableObject("p099"), + q100: NullableObject? = NullableObject("p100"), + q101: NullableObject? = NullableObject("p101"), + q102: NullableObject? = NullableObject("p102"), + q103: NullableObject? = NullableObject("p103"), + q104: NullableObject? = NullableObject("p104"), + q105: NullableObject? = NullableObject("p105"), + q106: NullableObject? = NullableObject("p106"), + q107: NullableObject? = NullableObject("p107"), + q108: NullableObject? = NullableObject("p108"), + q109: NullableObject? = NullableObject("p109"), + q110: NullableObject? = NullableObject("p110"), + q111: NullableObject? = NullableObject("p111"), + q112: NullableObject? = NullableObject("p112"), + q113: NullableObject? = NullableObject("p113"), + q114: NullableObject? = NullableObject("p114"), + q115: NullableObject? = NullableObject("p115"), + q116: NullableObject? = NullableObject("p116"), + q117: NullableObject? = NullableObject("p117"), + q118: NullableObject? = NullableObject("p118"), + q119: NullableObject? = NullableObject("p119"), + q120: NullableObject? = NullableObject("p120"), + q121: NullableObject? = NullableObject("p121"), + q122: NullableObject? = NullableObject("p122"), + q123: NullableObject? = NullableObject("p123"), + q124: NullableObject? = NullableObject("p124"), + q125: NullableObject? = NullableObject("p125"), + q126: NullableObject? = NullableObject("p126"), + q127: NullableObject? = NullableObject("p127"), + q128: NullableObject? = NullableObject("p128"), + q129: NullableObject? = NullableObject("p129"), + q130: NullableObject? = NullableObject("p130"), + q131: NullableObject? = NullableObject("p131"), + q132: NullableObject? = NullableObject("p132"), + q133: NullableObject? = NullableObject("p133"), + q134: NullableObject? = NullableObject("p134"), + q135: NullableObject? = NullableObject("p135"), + q136: NullableObject? = NullableObject("p136"), + q137: NullableObject? = NullableObject("p137"), + q138: NullableObject? = NullableObject("p138"), + q139: NullableObject? = NullableObject("p139"), + q140: NullableObject? = NullableObject("p140"), + q141: NullableObject? = NullableObject("p141"), + q142: NullableObject? = NullableObject("p142"), + q143: NullableObject? = NullableObject("p143"), + q144: NullableObject? = NullableObject("p144"), + q145: NullableObject? = NullableObject("p145"), + q146: NullableObject? = NullableObject("p146"), + q147: NullableObject? = NullableObject("p147"), + q148: NullableObject? = NullableObject("p148"), + q149: NullableObject? = NullableObject("p149"), + q150: NullableObject? = NullableObject("p150"), + q151: NullableObject? = NullableObject("p151"), + q152: NullableObject? = NullableObject("p152"), + q153: NullableObject? = NullableObject("p153"), + q154: NullableObject? = NullableObject("p154"), + q155: NullableObject? = NullableObject("p155"), + q156: NullableObject? = NullableObject("p156"), + q157: NullableObject? = NullableObject("p157"), + q158: NullableObject? = NullableObject("p158"), + q159: NullableObject? = NullableObject("p159"), + q160: NullableObject? = NullableObject("p160"), + q161: NullableObject? = NullableObject("p161"), + q162: NullableObject? = NullableObject("p162"), + q163: NullableObject? = NullableObject("p163"), + q164: NullableObject? = NullableObject("p164"), + q165: NullableObject? = NullableObject("p165"), + q166: NullableObject? = NullableObject("p166"), + q167: NullableObject? = NullableObject("p167"), + q168: NullableObject? = NullableObject("p168"), + q169: NullableObject? = NullableObject("p169"), + q170: NullableObject? = NullableObject("p170"), + q171: NullableObject? = NullableObject("p171"), + q172: NullableObject? = NullableObject("p172"), + q173: NullableObject? = NullableObject("p173"), + q174: NullableObject? = NullableObject("p174"), + q175: NullableObject? = NullableObject("p175"), + q176: NullableObject? = NullableObject("p176"), + q177: NullableObject? = NullableObject("p177"), + q178: NullableObject? = NullableObject("p178"), + q179: NullableObject? = NullableObject("p179"), + q180: NullableObject? = NullableObject("p180"), + q181: NullableObject? = NullableObject("p181"), + q182: NullableObject? = NullableObject("p182"), + q183: NullableObject? = NullableObject("p183"), + q184: NullableObject? = NullableObject("p184"), + q185: NullableObject? = NullableObject("p185"), + q186: NullableObject? = NullableObject("p186"), + q187: NullableObject? = NullableObject("p187"), + q188: NullableObject? = NullableObject("p188"), + q189: NullableObject? = NullableObject("p189"), + q190: NullableObject? = NullableObject("p190"), + q191: NullableObject? = NullableObject("p191"), + q192: NullableObject? = NullableObject("p192"), + q193: NullableObject? = NullableObject("p193"), + q194: NullableObject? = NullableObject("p194"), + q195: NullableObject? = NullableObject("p195"), + q196: NullableObject? = NullableObject("p196"), + q197: NullableObject? = NullableObject("p197"), + q198: NullableObject? = NullableObject("p198"), + q199: NullableObject? = NullableObject("p199"), + q200: NullableObject? = NullableObject("p200"), + q201: NullableObject? = NullableObject("p201"), + q202: NullableObject? = NullableObject("p202"), + q203: NullableObject? = NullableObject("p203"), + q204: NullableObject? = NullableObject("p204"), + q205: NullableObject? = NullableObject("p205"), + q206: NullableObject? = NullableObject("p206"), + q207: NullableObject? = NullableObject("p207"), + q208: NullableObject? = NullableObject("p208"), + q209: NullableObject? = NullableObject("p209"), + q210: NullableObject? = NullableObject("p210"), + q211: NullableObject? = NullableObject("p211"), + q212: NullableObject? = NullableObject("p212"), + q213: NullableObject? = NullableObject("p213"), + q214: NullableObject? = NullableObject("p214"), + q215: NullableObject? = NullableObject("p215"), + q216: NullableObject? = NullableObject("p216"), + q217: NullableObject? = NullableObject("p217"), + q218: NullableObject? = NullableObject("p218"), + q219: NullableObject? = NullableObject("p219"), + q220: NullableObject? = NullableObject("p220"), + q221: NullableObject? = NullableObject("p221"), + q222: NullableObject? = NullableObject("p222"), + q223: NullableObject? = NullableObject("p223"), + q224: NullableObject? = NullableObject("p224"), + q225: NullableObject? = NullableObject("p225"), + q226: NullableObject? = NullableObject("p226"), + q227: NullableObject? = NullableObject("p227"), + q228: NullableObject? = NullableObject("p228"), + q229: NullableObject? = NullableObject("p229"), + q230: NullableObject? = NullableObject("p230"), + q231: NullableObject? = NullableObject("p231"), + q232: NullableObject? = NullableObject("p232"), + q233: NullableObject? = NullableObject("p233"), + q234: NullableObject? = NullableObject("p234"), + q235: NullableObject? = NullableObject("p235"), + q236: NullableObject? = NullableObject("p236"), + q237: NullableObject? = NullableObject("p237"), + q238: NullableObject? = NullableObject("p238"), + q239: NullableObject? = NullableObject("p239"), + q240: NullableObject? = NullableObject("p240"), + q241: NullableObject? = NullableObject("p241"), + q242: NullableObject? = NullableObject("p242"), + q243: NullableObject? = NullableObject("p243") + ) = DstMax( + q000, + q001, + q002, + q003, + q004, + q005, + q006, + q007, + q008, + q009, + q010, + q011, + q012, + q013, + q014, + q015, + q016, + q017, + q018, + q019, + q020, + q021, + q022, + q023, + q024, + q025, + q026, + q027, + q028, + q029, + q030, + q031, + q032, + q033, + q034, + q035, + q036, + q037, + q038, + q039, + q040, + q041, + q042, + q043, + q044, + q045, + q046, + q047, + q048, + q049, + q050, + q051, + q052, + q053, + q054, + q055, + q056, + q057, + q058, + q059, + q060, + q061, + q062, + q063, + q064, + q065, + q066, + q067, + q068, + q069, + q070, + q071, + q072, + q073, + q074, + q075, + q076, + q077, + q078, + q079, + q080, + q081, + q082, + q083, + q084, + q085, + q086, + q087, + q088, + q089, + q090, + q091, + q092, + q093, + q094, + q095, + q096, + q097, + q098, + q099, + q100, + q101, + q102, + q103, + q104, + q105, + q106, + q107, + q108, + q109, + q110, + q111, + q112, + q113, + q114, + q115, + q116, + q117, + q118, + q119, + q120, + q121, + q122, + q123, + q124, + q125, + q126, + q127, + q128, + q129, + q130, + q131, + q132, + q133, + q134, + q135, + q136, + q137, + q138, + q139, + q140, + q141, + q142, + q143, + q144, + q145, + q146, + q147, + q148, + q149, + q150, + q151, + q152, + q153, + q154, + q155, + q156, + q157, + q158, + q159, + q160, + q161, + q162, + q163, + q164, + q165, + q166, + q167, + q168, + q169, + q170, + q171, + q172, + q173, + q174, + q175, + q176, + q177, + q178, + q179, + q180, + q181, + q182, + q183, + q184, + q185, + q186, + q187, + q188, + q189, + q190, + q191, + q192, + q193, + q194, + q195, + q196, + q197, + q198, + q199, + q200, + q201, + q202, + q203, + q204, + q205, + q206, + q207, + q208, + q209, + q210, + q211, + q212, + q213, + q214, + q215, + q216, + q217, + q218, + q219, + q220, + q221, + q222, + q223, + q224, + q225, + q226, + q227, + q228, + q229, + q230, + q231, + q232, + q233, + q234, + q235, + q236, + q237, + q238, + q239, + q240, + q241, + q242, + q243 + ) + } + } + + @Test + fun testMax() { + assertReflectEquals(DstMax.creator(), defaultMapper.readValue("{}")) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByFactoryWithoutDefaultArgumentsTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByFactoryWithoutDefaultArgumentsTest.kt new file mode 100644 index 00000000..f56b2acf --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/nullableObject/DeserializeByFactoryWithoutDefaultArgumentsTest.kt @@ -0,0 +1,1453 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.nullableObject + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.module.kotlin.assertReflectEquals +import com.fasterxml.jackson.module.kotlin.callPrimaryConstructor +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.NullableObject +import org.junit.Assert.assertEquals +import kotlin.test.Test + +// Convert the property p to q (but not the value) to make it an input to the factory function. +private fun replacePQ(src: String) = src.replace(Regex("""p\d+":""")) { "q" + it.value.substring(1) } + +/** + * Up to argument size 32 there is one mask argument for the default argument, + * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested. + * Also, the maximum size of arguments that can be set by a constructor + * that includes a value class as an argument is 253 (one less by DefaultConstructorMarker), so test that case as well. + */ +class DeserializeByFactoryWithoutDefaultArgumentsTest { + data class Dst32( + val p00: NullableObject, + val p01: NullableObject, + val p02: NullableObject, + val p03: NullableObject, + val p04: NullableObject, + val p05: NullableObject, + val p06: NullableObject, + val p07: NullableObject, + val p08: NullableObject, + val p09: NullableObject, + val p10: NullableObject, + val p11: NullableObject, + val p12: NullableObject, + val p13: NullableObject, + val p14: NullableObject, + val p15: NullableObject, + val p16: NullableObject, + val p17: NullableObject, + val p18: NullableObject, + val p19: NullableObject, + val p20: NullableObject, + val p21: NullableObject, + val p22: NullableObject, + val p23: NullableObject, + val p24: NullableObject, + val p25: NullableObject, + val p26: NullableObject, + val p27: NullableObject, + val p28: NullableObject, + val p29: NullableObject, + val p30: NullableObject, + val p31: NullableObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NullableObject, + q01: NullableObject, + q02: NullableObject, + q03: NullableObject, + q04: NullableObject, + q05: NullableObject, + q06: NullableObject, + q07: NullableObject, + q08: NullableObject, + q09: NullableObject, + q10: NullableObject, + q11: NullableObject, + q12: NullableObject, + q13: NullableObject, + q14: NullableObject, + q15: NullableObject, + q16: NullableObject, + q17: NullableObject, + q18: NullableObject, + q19: NullableObject, + q20: NullableObject, + q21: NullableObject, + q22: NullableObject, + q23: NullableObject, + q24: NullableObject, + q25: NullableObject, + q26: NullableObject, + q27: NullableObject, + q28: NullableObject, + q29: NullableObject, + q30: NullableObject, + q31: NullableObject + ) = Dst32( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31 + ) + } + } + + @Test + fun test32() { + val expected = callPrimaryConstructor { NullableObject(it.name!!) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst33( + val p00: NullableObject, + val p01: NullableObject, + val p02: NullableObject, + val p03: NullableObject, + val p04: NullableObject, + val p05: NullableObject, + val p06: NullableObject, + val p07: NullableObject, + val p08: NullableObject, + val p09: NullableObject, + val p10: NullableObject, + val p11: NullableObject, + val p12: NullableObject, + val p13: NullableObject, + val p14: NullableObject, + val p15: NullableObject, + val p16: NullableObject, + val p17: NullableObject, + val p18: NullableObject, + val p19: NullableObject, + val p20: NullableObject, + val p21: NullableObject, + val p22: NullableObject, + val p23: NullableObject, + val p24: NullableObject, + val p25: NullableObject, + val p26: NullableObject, + val p27: NullableObject, + val p28: NullableObject, + val p29: NullableObject, + val p30: NullableObject, + val p31: NullableObject, + val p32: NullableObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NullableObject, + q01: NullableObject, + q02: NullableObject, + q03: NullableObject, + q04: NullableObject, + q05: NullableObject, + q06: NullableObject, + q07: NullableObject, + q08: NullableObject, + q09: NullableObject, + q10: NullableObject, + q11: NullableObject, + q12: NullableObject, + q13: NullableObject, + q14: NullableObject, + q15: NullableObject, + q16: NullableObject, + q17: NullableObject, + q18: NullableObject, + q19: NullableObject, + q20: NullableObject, + q21: NullableObject, + q22: NullableObject, + q23: NullableObject, + q24: NullableObject, + q25: NullableObject, + q26: NullableObject, + q27: NullableObject, + q28: NullableObject, + q29: NullableObject, + q30: NullableObject, + q31: NullableObject, + q32: NullableObject + ) = Dst33( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32 + ) + } + } + + @Test + fun test33() { + val expected = callPrimaryConstructor { NullableObject(it.name!!) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst64( + val p00: NullableObject, + val p01: NullableObject, + val p02: NullableObject, + val p03: NullableObject, + val p04: NullableObject, + val p05: NullableObject, + val p06: NullableObject, + val p07: NullableObject, + val p08: NullableObject, + val p09: NullableObject, + val p10: NullableObject, + val p11: NullableObject, + val p12: NullableObject, + val p13: NullableObject, + val p14: NullableObject, + val p15: NullableObject, + val p16: NullableObject, + val p17: NullableObject, + val p18: NullableObject, + val p19: NullableObject, + val p20: NullableObject, + val p21: NullableObject, + val p22: NullableObject, + val p23: NullableObject, + val p24: NullableObject, + val p25: NullableObject, + val p26: NullableObject, + val p27: NullableObject, + val p28: NullableObject, + val p29: NullableObject, + val p30: NullableObject, + val p31: NullableObject, + val p32: NullableObject, + val p33: NullableObject, + val p34: NullableObject, + val p35: NullableObject, + val p36: NullableObject, + val p37: NullableObject, + val p38: NullableObject, + val p39: NullableObject, + val p40: NullableObject, + val p41: NullableObject, + val p42: NullableObject, + val p43: NullableObject, + val p44: NullableObject, + val p45: NullableObject, + val p46: NullableObject, + val p47: NullableObject, + val p48: NullableObject, + val p49: NullableObject, + val p50: NullableObject, + val p51: NullableObject, + val p52: NullableObject, + val p53: NullableObject, + val p54: NullableObject, + val p55: NullableObject, + val p56: NullableObject, + val p57: NullableObject, + val p58: NullableObject, + val p59: NullableObject, + val p60: NullableObject, + val p61: NullableObject, + val p62: NullableObject, + val p63: NullableObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NullableObject, + q01: NullableObject, + q02: NullableObject, + q03: NullableObject, + q04: NullableObject, + q05: NullableObject, + q06: NullableObject, + q07: NullableObject, + q08: NullableObject, + q09: NullableObject, + q10: NullableObject, + q11: NullableObject, + q12: NullableObject, + q13: NullableObject, + q14: NullableObject, + q15: NullableObject, + q16: NullableObject, + q17: NullableObject, + q18: NullableObject, + q19: NullableObject, + q20: NullableObject, + q21: NullableObject, + q22: NullableObject, + q23: NullableObject, + q24: NullableObject, + q25: NullableObject, + q26: NullableObject, + q27: NullableObject, + q28: NullableObject, + q29: NullableObject, + q30: NullableObject, + q31: NullableObject, + q32: NullableObject, + q33: NullableObject, + q34: NullableObject, + q35: NullableObject, + q36: NullableObject, + q37: NullableObject, + q38: NullableObject, + q39: NullableObject, + q40: NullableObject, + q41: NullableObject, + q42: NullableObject, + q43: NullableObject, + q44: NullableObject, + q45: NullableObject, + q46: NullableObject, + q47: NullableObject, + q48: NullableObject, + q49: NullableObject, + q50: NullableObject, + q51: NullableObject, + q52: NullableObject, + q53: NullableObject, + q54: NullableObject, + q55: NullableObject, + q56: NullableObject, + q57: NullableObject, + q58: NullableObject, + q59: NullableObject, + q60: NullableObject, + q61: NullableObject, + q62: NullableObject, + q63: NullableObject + ) = Dst64( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32, + q33, + q34, + q35, + q36, + q37, + q38, + q39, + q40, + q41, + q42, + q43, + q44, + q45, + q46, + q47, + q48, + q49, + q50, + q51, + q52, + q53, + q54, + q55, + q56, + q57, + q58, + q59, + q60, + q61, + q62, + q63 + ) + } + } + + @Test + fun test64() { + val expected = callPrimaryConstructor { NullableObject(it.name!!) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst65( + val p00: NullableObject, + val p01: NullableObject, + val p02: NullableObject, + val p03: NullableObject, + val p04: NullableObject, + val p05: NullableObject, + val p06: NullableObject, + val p07: NullableObject, + val p08: NullableObject, + val p09: NullableObject, + val p10: NullableObject, + val p11: NullableObject, + val p12: NullableObject, + val p13: NullableObject, + val p14: NullableObject, + val p15: NullableObject, + val p16: NullableObject, + val p17: NullableObject, + val p18: NullableObject, + val p19: NullableObject, + val p20: NullableObject, + val p21: NullableObject, + val p22: NullableObject, + val p23: NullableObject, + val p24: NullableObject, + val p25: NullableObject, + val p26: NullableObject, + val p27: NullableObject, + val p28: NullableObject, + val p29: NullableObject, + val p30: NullableObject, + val p31: NullableObject, + val p32: NullableObject, + val p33: NullableObject, + val p34: NullableObject, + val p35: NullableObject, + val p36: NullableObject, + val p37: NullableObject, + val p38: NullableObject, + val p39: NullableObject, + val p40: NullableObject, + val p41: NullableObject, + val p42: NullableObject, + val p43: NullableObject, + val p44: NullableObject, + val p45: NullableObject, + val p46: NullableObject, + val p47: NullableObject, + val p48: NullableObject, + val p49: NullableObject, + val p50: NullableObject, + val p51: NullableObject, + val p52: NullableObject, + val p53: NullableObject, + val p54: NullableObject, + val p55: NullableObject, + val p56: NullableObject, + val p57: NullableObject, + val p58: NullableObject, + val p59: NullableObject, + val p60: NullableObject, + val p61: NullableObject, + val p62: NullableObject, + val p63: NullableObject, + val p64: NullableObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: NullableObject, + q01: NullableObject, + q02: NullableObject, + q03: NullableObject, + q04: NullableObject, + q05: NullableObject, + q06: NullableObject, + q07: NullableObject, + q08: NullableObject, + q09: NullableObject, + q10: NullableObject, + q11: NullableObject, + q12: NullableObject, + q13: NullableObject, + q14: NullableObject, + q15: NullableObject, + q16: NullableObject, + q17: NullableObject, + q18: NullableObject, + q19: NullableObject, + q20: NullableObject, + q21: NullableObject, + q22: NullableObject, + q23: NullableObject, + q24: NullableObject, + q25: NullableObject, + q26: NullableObject, + q27: NullableObject, + q28: NullableObject, + q29: NullableObject, + q30: NullableObject, + q31: NullableObject, + q32: NullableObject, + q33: NullableObject, + q34: NullableObject, + q35: NullableObject, + q36: NullableObject, + q37: NullableObject, + q38: NullableObject, + q39: NullableObject, + q40: NullableObject, + q41: NullableObject, + q42: NullableObject, + q43: NullableObject, + q44: NullableObject, + q45: NullableObject, + q46: NullableObject, + q47: NullableObject, + q48: NullableObject, + q49: NullableObject, + q50: NullableObject, + q51: NullableObject, + q52: NullableObject, + q53: NullableObject, + q54: NullableObject, + q55: NullableObject, + q56: NullableObject, + q57: NullableObject, + q58: NullableObject, + q59: NullableObject, + q60: NullableObject, + q61: NullableObject, + q62: NullableObject, + q63: NullableObject, + q64: NullableObject + ) = Dst65( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32, + q33, + q34, + q35, + q36, + q37, + q38, + q39, + q40, + q41, + q42, + q43, + q44, + q45, + q46, + q47, + q48, + q49, + q50, + q51, + q52, + q53, + q54, + q55, + q56, + q57, + q58, + q59, + q60, + q61, + q62, + q63, + q64 + ) + } + } + + @Test + fun test65() { + val expected = callPrimaryConstructor { NullableObject(it.name!!) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertEquals(expected, defaultMapper.readValue(src)) + } + + // It cannot be a data class because the generated method would exceed the argument size limit. + class DstMax( + val p000: NullableObject, + val p001: NullableObject, + val p002: NullableObject, + val p003: NullableObject, + val p004: NullableObject, + val p005: NullableObject, + val p006: NullableObject, + val p007: NullableObject, + val p008: NullableObject, + val p009: NullableObject, + val p010: NullableObject, + val p011: NullableObject, + val p012: NullableObject, + val p013: NullableObject, + val p014: NullableObject, + val p015: NullableObject, + val p016: NullableObject, + val p017: NullableObject, + val p018: NullableObject, + val p019: NullableObject, + val p020: NullableObject, + val p021: NullableObject, + val p022: NullableObject, + val p023: NullableObject, + val p024: NullableObject, + val p025: NullableObject, + val p026: NullableObject, + val p027: NullableObject, + val p028: NullableObject, + val p029: NullableObject, + val p030: NullableObject, + val p031: NullableObject, + val p032: NullableObject, + val p033: NullableObject, + val p034: NullableObject, + val p035: NullableObject, + val p036: NullableObject, + val p037: NullableObject, + val p038: NullableObject, + val p039: NullableObject, + val p040: NullableObject, + val p041: NullableObject, + val p042: NullableObject, + val p043: NullableObject, + val p044: NullableObject, + val p045: NullableObject, + val p046: NullableObject, + val p047: NullableObject, + val p048: NullableObject, + val p049: NullableObject, + val p050: NullableObject, + val p051: NullableObject, + val p052: NullableObject, + val p053: NullableObject, + val p054: NullableObject, + val p055: NullableObject, + val p056: NullableObject, + val p057: NullableObject, + val p058: NullableObject, + val p059: NullableObject, + val p060: NullableObject, + val p061: NullableObject, + val p062: NullableObject, + val p063: NullableObject, + val p064: NullableObject, + val p065: NullableObject, + val p066: NullableObject, + val p067: NullableObject, + val p068: NullableObject, + val p069: NullableObject, + val p070: NullableObject, + val p071: NullableObject, + val p072: NullableObject, + val p073: NullableObject, + val p074: NullableObject, + val p075: NullableObject, + val p076: NullableObject, + val p077: NullableObject, + val p078: NullableObject, + val p079: NullableObject, + val p080: NullableObject, + val p081: NullableObject, + val p082: NullableObject, + val p083: NullableObject, + val p084: NullableObject, + val p085: NullableObject, + val p086: NullableObject, + val p087: NullableObject, + val p088: NullableObject, + val p089: NullableObject, + val p090: NullableObject, + val p091: NullableObject, + val p092: NullableObject, + val p093: NullableObject, + val p094: NullableObject, + val p095: NullableObject, + val p096: NullableObject, + val p097: NullableObject, + val p098: NullableObject, + val p099: NullableObject, + val p100: NullableObject, + val p101: NullableObject, + val p102: NullableObject, + val p103: NullableObject, + val p104: NullableObject, + val p105: NullableObject, + val p106: NullableObject, + val p107: NullableObject, + val p108: NullableObject, + val p109: NullableObject, + val p110: NullableObject, + val p111: NullableObject, + val p112: NullableObject, + val p113: NullableObject, + val p114: NullableObject, + val p115: NullableObject, + val p116: NullableObject, + val p117: NullableObject, + val p118: NullableObject, + val p119: NullableObject, + val p120: NullableObject, + val p121: NullableObject, + val p122: NullableObject, + val p123: NullableObject, + val p124: NullableObject, + val p125: NullableObject, + val p126: NullableObject, + val p127: NullableObject, + val p128: NullableObject, + val p129: NullableObject, + val p130: NullableObject, + val p131: NullableObject, + val p132: NullableObject, + val p133: NullableObject, + val p134: NullableObject, + val p135: NullableObject, + val p136: NullableObject, + val p137: NullableObject, + val p138: NullableObject, + val p139: NullableObject, + val p140: NullableObject, + val p141: NullableObject, + val p142: NullableObject, + val p143: NullableObject, + val p144: NullableObject, + val p145: NullableObject, + val p146: NullableObject, + val p147: NullableObject, + val p148: NullableObject, + val p149: NullableObject, + val p150: NullableObject, + val p151: NullableObject, + val p152: NullableObject, + val p153: NullableObject, + val p154: NullableObject, + val p155: NullableObject, + val p156: NullableObject, + val p157: NullableObject, + val p158: NullableObject, + val p159: NullableObject, + val p160: NullableObject, + val p161: NullableObject, + val p162: NullableObject, + val p163: NullableObject, + val p164: NullableObject, + val p165: NullableObject, + val p166: NullableObject, + val p167: NullableObject, + val p168: NullableObject, + val p169: NullableObject, + val p170: NullableObject, + val p171: NullableObject, + val p172: NullableObject, + val p173: NullableObject, + val p174: NullableObject, + val p175: NullableObject, + val p176: NullableObject, + val p177: NullableObject, + val p178: NullableObject, + val p179: NullableObject, + val p180: NullableObject, + val p181: NullableObject, + val p182: NullableObject, + val p183: NullableObject, + val p184: NullableObject, + val p185: NullableObject, + val p186: NullableObject, + val p187: NullableObject, + val p188: NullableObject, + val p189: NullableObject, + val p190: NullableObject, + val p191: NullableObject, + val p192: NullableObject, + val p193: NullableObject, + val p194: NullableObject, + val p195: NullableObject, + val p196: NullableObject, + val p197: NullableObject, + val p198: NullableObject, + val p199: NullableObject, + val p200: NullableObject, + val p201: NullableObject, + val p202: NullableObject, + val p203: NullableObject, + val p204: NullableObject, + val p205: NullableObject, + val p206: NullableObject, + val p207: NullableObject, + val p208: NullableObject, + val p209: NullableObject, + val p210: NullableObject, + val p211: NullableObject, + val p212: NullableObject, + val p213: NullableObject, + val p214: NullableObject, + val p215: NullableObject, + val p216: NullableObject, + val p217: NullableObject, + val p218: NullableObject, + val p219: NullableObject, + val p220: NullableObject, + val p221: NullableObject, + val p222: NullableObject, + val p223: NullableObject, + val p224: NullableObject, + val p225: NullableObject, + val p226: NullableObject, + val p227: NullableObject, + val p228: NullableObject, + val p229: NullableObject, + val p230: NullableObject, + val p231: NullableObject, + val p232: NullableObject, + val p233: NullableObject, + val p234: NullableObject, + val p235: NullableObject, + val p236: NullableObject, + val p237: NullableObject, + val p238: NullableObject, + val p239: NullableObject, + val p240: NullableObject, + val p241: NullableObject, + val p242: NullableObject, + val p243: NullableObject, + val p244: NullableObject, + val p245: NullableObject, + val p246: NullableObject, + val p247: NullableObject, + val p248: NullableObject, + val p249: NullableObject, + val p250: NullableObject, + val p251: NullableObject, + val p252: NullableObject + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q000: NullableObject, + q001: NullableObject, + q002: NullableObject, + q003: NullableObject, + q004: NullableObject, + q005: NullableObject, + q006: NullableObject, + q007: NullableObject, + q008: NullableObject, + q009: NullableObject, + q010: NullableObject, + q011: NullableObject, + q012: NullableObject, + q013: NullableObject, + q014: NullableObject, + q015: NullableObject, + q016: NullableObject, + q017: NullableObject, + q018: NullableObject, + q019: NullableObject, + q020: NullableObject, + q021: NullableObject, + q022: NullableObject, + q023: NullableObject, + q024: NullableObject, + q025: NullableObject, + q026: NullableObject, + q027: NullableObject, + q028: NullableObject, + q029: NullableObject, + q030: NullableObject, + q031: NullableObject, + q032: NullableObject, + q033: NullableObject, + q034: NullableObject, + q035: NullableObject, + q036: NullableObject, + q037: NullableObject, + q038: NullableObject, + q039: NullableObject, + q040: NullableObject, + q041: NullableObject, + q042: NullableObject, + q043: NullableObject, + q044: NullableObject, + q045: NullableObject, + q046: NullableObject, + q047: NullableObject, + q048: NullableObject, + q049: NullableObject, + q050: NullableObject, + q051: NullableObject, + q052: NullableObject, + q053: NullableObject, + q054: NullableObject, + q055: NullableObject, + q056: NullableObject, + q057: NullableObject, + q058: NullableObject, + q059: NullableObject, + q060: NullableObject, + q061: NullableObject, + q062: NullableObject, + q063: NullableObject, + q064: NullableObject, + q065: NullableObject, + q066: NullableObject, + q067: NullableObject, + q068: NullableObject, + q069: NullableObject, + q070: NullableObject, + q071: NullableObject, + q072: NullableObject, + q073: NullableObject, + q074: NullableObject, + q075: NullableObject, + q076: NullableObject, + q077: NullableObject, + q078: NullableObject, + q079: NullableObject, + q080: NullableObject, + q081: NullableObject, + q082: NullableObject, + q083: NullableObject, + q084: NullableObject, + q085: NullableObject, + q086: NullableObject, + q087: NullableObject, + q088: NullableObject, + q089: NullableObject, + q090: NullableObject, + q091: NullableObject, + q092: NullableObject, + q093: NullableObject, + q094: NullableObject, + q095: NullableObject, + q096: NullableObject, + q097: NullableObject, + q098: NullableObject, + q099: NullableObject, + q100: NullableObject, + q101: NullableObject, + q102: NullableObject, + q103: NullableObject, + q104: NullableObject, + q105: NullableObject, + q106: NullableObject, + q107: NullableObject, + q108: NullableObject, + q109: NullableObject, + q110: NullableObject, + q111: NullableObject, + q112: NullableObject, + q113: NullableObject, + q114: NullableObject, + q115: NullableObject, + q116: NullableObject, + q117: NullableObject, + q118: NullableObject, + q119: NullableObject, + q120: NullableObject, + q121: NullableObject, + q122: NullableObject, + q123: NullableObject, + q124: NullableObject, + q125: NullableObject, + q126: NullableObject, + q127: NullableObject, + q128: NullableObject, + q129: NullableObject, + q130: NullableObject, + q131: NullableObject, + q132: NullableObject, + q133: NullableObject, + q134: NullableObject, + q135: NullableObject, + q136: NullableObject, + q137: NullableObject, + q138: NullableObject, + q139: NullableObject, + q140: NullableObject, + q141: NullableObject, + q142: NullableObject, + q143: NullableObject, + q144: NullableObject, + q145: NullableObject, + q146: NullableObject, + q147: NullableObject, + q148: NullableObject, + q149: NullableObject, + q150: NullableObject, + q151: NullableObject, + q152: NullableObject, + q153: NullableObject, + q154: NullableObject, + q155: NullableObject, + q156: NullableObject, + q157: NullableObject, + q158: NullableObject, + q159: NullableObject, + q160: NullableObject, + q161: NullableObject, + q162: NullableObject, + q163: NullableObject, + q164: NullableObject, + q165: NullableObject, + q166: NullableObject, + q167: NullableObject, + q168: NullableObject, + q169: NullableObject, + q170: NullableObject, + q171: NullableObject, + q172: NullableObject, + q173: NullableObject, + q174: NullableObject, + q175: NullableObject, + q176: NullableObject, + q177: NullableObject, + q178: NullableObject, + q179: NullableObject, + q180: NullableObject, + q181: NullableObject, + q182: NullableObject, + q183: NullableObject, + q184: NullableObject, + q185: NullableObject, + q186: NullableObject, + q187: NullableObject, + q188: NullableObject, + q189: NullableObject, + q190: NullableObject, + q191: NullableObject, + q192: NullableObject, + q193: NullableObject, + q194: NullableObject, + q195: NullableObject, + q196: NullableObject, + q197: NullableObject, + q198: NullableObject, + q199: NullableObject, + q200: NullableObject, + q201: NullableObject, + q202: NullableObject, + q203: NullableObject, + q204: NullableObject, + q205: NullableObject, + q206: NullableObject, + q207: NullableObject, + q208: NullableObject, + q209: NullableObject, + q210: NullableObject, + q211: NullableObject, + q212: NullableObject, + q213: NullableObject, + q214: NullableObject, + q215: NullableObject, + q216: NullableObject, + q217: NullableObject, + q218: NullableObject, + q219: NullableObject, + q220: NullableObject, + q221: NullableObject, + q222: NullableObject, + q223: NullableObject, + q224: NullableObject, + q225: NullableObject, + q226: NullableObject, + q227: NullableObject, + q228: NullableObject, + q229: NullableObject, + q230: NullableObject, + q231: NullableObject, + q232: NullableObject, + q233: NullableObject, + q234: NullableObject, + q235: NullableObject, + q236: NullableObject, + q237: NullableObject, + q238: NullableObject, + q239: NullableObject, + q240: NullableObject, + q241: NullableObject, + q242: NullableObject, + q243: NullableObject, + q244: NullableObject, + q245: NullableObject, + q246: NullableObject, + q247: NullableObject, + q248: NullableObject, + q249: NullableObject, + q250: NullableObject, + q251: NullableObject, + q252: NullableObject + ) = DstMax( + q000, + q001, + q002, + q003, + q004, + q005, + q006, + q007, + q008, + q009, + q010, + q011, + q012, + q013, + q014, + q015, + q016, + q017, + q018, + q019, + q020, + q021, + q022, + q023, + q024, + q025, + q026, + q027, + q028, + q029, + q030, + q031, + q032, + q033, + q034, + q035, + q036, + q037, + q038, + q039, + q040, + q041, + q042, + q043, + q044, + q045, + q046, + q047, + q048, + q049, + q050, + q051, + q052, + q053, + q054, + q055, + q056, + q057, + q058, + q059, + q060, + q061, + q062, + q063, + q064, + q065, + q066, + q067, + q068, + q069, + q070, + q071, + q072, + q073, + q074, + q075, + q076, + q077, + q078, + q079, + q080, + q081, + q082, + q083, + q084, + q085, + q086, + q087, + q088, + q089, + q090, + q091, + q092, + q093, + q094, + q095, + q096, + q097, + q098, + q099, + q100, + q101, + q102, + q103, + q104, + q105, + q106, + q107, + q108, + q109, + q110, + q111, + q112, + q113, + q114, + q115, + q116, + q117, + q118, + q119, + q120, + q121, + q122, + q123, + q124, + q125, + q126, + q127, + q128, + q129, + q130, + q131, + q132, + q133, + q134, + q135, + q136, + q137, + q138, + q139, + q140, + q141, + q142, + q143, + q144, + q145, + q146, + q147, + q148, + q149, + q150, + q151, + q152, + q153, + q154, + q155, + q156, + q157, + q158, + q159, + q160, + q161, + q162, + q163, + q164, + q165, + q166, + q167, + q168, + q169, + q170, + q171, + q172, + q173, + q174, + q175, + q176, + q177, + q178, + q179, + q180, + q181, + q182, + q183, + q184, + q185, + q186, + q187, + q188, + q189, + q190, + q191, + q192, + q193, + q194, + q195, + q196, + q197, + q198, + q199, + q200, + q201, + q202, + q203, + q204, + q205, + q206, + q207, + q208, + q209, + q210, + q211, + q212, + q213, + q214, + q215, + q216, + q217, + q218, + q219, + q220, + q221, + q222, + q223, + q224, + q225, + q226, + q227, + q228, + q229, + q230, + q231, + q232, + q233, + q234, + q235, + q236, + q237, + q238, + q239, + q240, + q241, + q242, + q243, + q244, + q245, + q246, + q247, + q248, + q249, + q250, + q251, + q252 + ) + } + } + + @Test + fun testMax() { + val expected = callPrimaryConstructor { NullableObject(it.name!!) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertReflectEquals(expected, defaultMapper.readValue(src)) + } +} From 818c4d54fdb09bb7203a89af3beebabb2a5f8700 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 13:50:48 +0900 Subject: [PATCH 14/20] Add value class parameter tests using Primitive --- ...zeByConstructorWithDefaultArgumentsTest.kt | 499 ++++++ ...yConstructorWithoutDefaultArgumentsTest.kt | 515 ++++++ ...ializeByFactoryWithDefaultArgumentsTest.kt | 1411 ++++++++++++++++ ...izeByFactoryWithoutDefaultArgumentsTest.kt | 1453 +++++++++++++++++ 4 files changed, 3878 insertions(+) create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByConstructorWithDefaultArgumentsTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByConstructorWithoutDefaultArgumentsTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByFactoryWithDefaultArgumentsTest.kt create mode 100644 src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByFactoryWithoutDefaultArgumentsTest.kt diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByConstructorWithDefaultArgumentsTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByConstructorWithDefaultArgumentsTest.kt new file mode 100644 index 00000000..5c1af34d --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByConstructorWithDefaultArgumentsTest.kt @@ -0,0 +1,499 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.primitive + +import com.fasterxml.jackson.module.kotlin.assertReflectEquals +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.Primitive +import org.junit.Assert.assertEquals +import kotlin.reflect.jvm.internal.KotlinReflectionInternalError +import kotlin.test.Test + +/** + * Up to argument size 32 there is one mask argument for the default argument, + * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested. + * Also, if the default argument is set, the maximum argument size that can be set in the constructor is 245, + * so that case is tested as well. + */ +class DeserializeByConstructorWithDefaultArgumentsTest { + data class Dst32( + val p00: Primitive = Primitive(0), + val p01: Primitive = Primitive(1), + val p02: Primitive = Primitive(2), + val p03: Primitive = Primitive(3), + val p04: Primitive = Primitive(4), + val p05: Primitive = Primitive(5), + val p06: Primitive = Primitive(6), + val p07: Primitive = Primitive(7), + val p08: Primitive = Primitive(8), + val p09: Primitive = Primitive(9), + val p10: Primitive = Primitive(10), + val p11: Primitive = Primitive(11), + val p12: Primitive = Primitive(12), + val p13: Primitive = Primitive(13), + val p14: Primitive = Primitive(14), + val p15: Primitive = Primitive(15), + val p16: Primitive = Primitive(16), + val p17: Primitive = Primitive(17), + val p18: Primitive = Primitive(18), + val p19: Primitive = Primitive(19), + val p20: Primitive = Primitive(20), + val p21: Primitive = Primitive(21), + val p22: Primitive = Primitive(22), + val p23: Primitive = Primitive(23), + val p24: Primitive = Primitive(24), + val p25: Primitive = Primitive(25), + val p26: Primitive = Primitive(26), + val p27: Primitive = Primitive(27), + val p28: Primitive = Primitive(28), + val p29: Primitive = Primitive(29), + val p30: Primitive = Primitive(30), + val p31: Primitive = Primitive(31) + ) + + // #762 + @Test(expected = KotlinReflectionInternalError::class) + fun test32() { + assertEquals(Dst32(), defaultMapper.readValue("{}")) + } + + data class Dst33( + val p00: Primitive = Primitive(0), + val p01: Primitive = Primitive(1), + val p02: Primitive = Primitive(2), + val p03: Primitive = Primitive(3), + val p04: Primitive = Primitive(4), + val p05: Primitive = Primitive(5), + val p06: Primitive = Primitive(6), + val p07: Primitive = Primitive(7), + val p08: Primitive = Primitive(8), + val p09: Primitive = Primitive(9), + val p10: Primitive = Primitive(10), + val p11: Primitive = Primitive(11), + val p12: Primitive = Primitive(12), + val p13: Primitive = Primitive(13), + val p14: Primitive = Primitive(14), + val p15: Primitive = Primitive(15), + val p16: Primitive = Primitive(16), + val p17: Primitive = Primitive(17), + val p18: Primitive = Primitive(18), + val p19: Primitive = Primitive(19), + val p20: Primitive = Primitive(20), + val p21: Primitive = Primitive(21), + val p22: Primitive = Primitive(22), + val p23: Primitive = Primitive(23), + val p24: Primitive = Primitive(24), + val p25: Primitive = Primitive(25), + val p26: Primitive = Primitive(26), + val p27: Primitive = Primitive(27), + val p28: Primitive = Primitive(28), + val p29: Primitive = Primitive(29), + val p30: Primitive = Primitive(30), + val p31: Primitive = Primitive(31), + val p32: Primitive = Primitive(32) + ) + + @Test + fun test33() { + assertEquals(Dst33(), defaultMapper.readValue("{}")) + } + + data class Dst64( + val p00: Primitive = Primitive(0), + val p01: Primitive = Primitive(1), + val p02: Primitive = Primitive(2), + val p03: Primitive = Primitive(3), + val p04: Primitive = Primitive(4), + val p05: Primitive = Primitive(5), + val p06: Primitive = Primitive(6), + val p07: Primitive = Primitive(7), + val p08: Primitive = Primitive(8), + val p09: Primitive = Primitive(9), + val p10: Primitive = Primitive(10), + val p11: Primitive = Primitive(11), + val p12: Primitive = Primitive(12), + val p13: Primitive = Primitive(13), + val p14: Primitive = Primitive(14), + val p15: Primitive = Primitive(15), + val p16: Primitive = Primitive(16), + val p17: Primitive = Primitive(17), + val p18: Primitive = Primitive(18), + val p19: Primitive = Primitive(19), + val p20: Primitive = Primitive(20), + val p21: Primitive = Primitive(21), + val p22: Primitive = Primitive(22), + val p23: Primitive = Primitive(23), + val p24: Primitive = Primitive(24), + val p25: Primitive = Primitive(25), + val p26: Primitive = Primitive(26), + val p27: Primitive = Primitive(27), + val p28: Primitive = Primitive(28), + val p29: Primitive = Primitive(29), + val p30: Primitive = Primitive(30), + val p31: Primitive = Primitive(31), + val p32: Primitive = Primitive(32), + val p33: Primitive = Primitive(33), + val p34: Primitive = Primitive(34), + val p35: Primitive = Primitive(35), + val p36: Primitive = Primitive(36), + val p37: Primitive = Primitive(37), + val p38: Primitive = Primitive(38), + val p39: Primitive = Primitive(39), + val p40: Primitive = Primitive(40), + val p41: Primitive = Primitive(41), + val p42: Primitive = Primitive(42), + val p43: Primitive = Primitive(43), + val p44: Primitive = Primitive(44), + val p45: Primitive = Primitive(45), + val p46: Primitive = Primitive(46), + val p47: Primitive = Primitive(47), + val p48: Primitive = Primitive(48), + val p49: Primitive = Primitive(49), + val p50: Primitive = Primitive(50), + val p51: Primitive = Primitive(51), + val p52: Primitive = Primitive(52), + val p53: Primitive = Primitive(53), + val p54: Primitive = Primitive(54), + val p55: Primitive = Primitive(55), + val p56: Primitive = Primitive(56), + val p57: Primitive = Primitive(57), + val p58: Primitive = Primitive(58), + val p59: Primitive = Primitive(59), + val p60: Primitive = Primitive(60), + val p61: Primitive = Primitive(61), + val p62: Primitive = Primitive(62), + val p63: Primitive = Primitive(63) + ) + + // #762 + @Test(expected = KotlinReflectionInternalError::class) + fun test64() { + assertEquals(Dst64(), defaultMapper.readValue("{}")) + } + + data class Dst65( + val p00: Primitive = Primitive(0), + val p01: Primitive = Primitive(1), + val p02: Primitive = Primitive(2), + val p03: Primitive = Primitive(3), + val p04: Primitive = Primitive(4), + val p05: Primitive = Primitive(5), + val p06: Primitive = Primitive(6), + val p07: Primitive = Primitive(7), + val p08: Primitive = Primitive(8), + val p09: Primitive = Primitive(9), + val p10: Primitive = Primitive(10), + val p11: Primitive = Primitive(11), + val p12: Primitive = Primitive(12), + val p13: Primitive = Primitive(13), + val p14: Primitive = Primitive(14), + val p15: Primitive = Primitive(15), + val p16: Primitive = Primitive(16), + val p17: Primitive = Primitive(17), + val p18: Primitive = Primitive(18), + val p19: Primitive = Primitive(19), + val p20: Primitive = Primitive(20), + val p21: Primitive = Primitive(21), + val p22: Primitive = Primitive(22), + val p23: Primitive = Primitive(23), + val p24: Primitive = Primitive(24), + val p25: Primitive = Primitive(25), + val p26: Primitive = Primitive(26), + val p27: Primitive = Primitive(27), + val p28: Primitive = Primitive(28), + val p29: Primitive = Primitive(29), + val p30: Primitive = Primitive(30), + val p31: Primitive = Primitive(31), + val p32: Primitive = Primitive(32), + val p33: Primitive = Primitive(33), + val p34: Primitive = Primitive(34), + val p35: Primitive = Primitive(35), + val p36: Primitive = Primitive(36), + val p37: Primitive = Primitive(37), + val p38: Primitive = Primitive(38), + val p39: Primitive = Primitive(39), + val p40: Primitive = Primitive(40), + val p41: Primitive = Primitive(41), + val p42: Primitive = Primitive(42), + val p43: Primitive = Primitive(43), + val p44: Primitive = Primitive(44), + val p45: Primitive = Primitive(45), + val p46: Primitive = Primitive(46), + val p47: Primitive = Primitive(47), + val p48: Primitive = Primitive(48), + val p49: Primitive = Primitive(49), + val p50: Primitive = Primitive(50), + val p51: Primitive = Primitive(51), + val p52: Primitive = Primitive(52), + val p53: Primitive = Primitive(53), + val p54: Primitive = Primitive(54), + val p55: Primitive = Primitive(55), + val p56: Primitive = Primitive(56), + val p57: Primitive = Primitive(57), + val p58: Primitive = Primitive(58), + val p59: Primitive = Primitive(59), + val p60: Primitive = Primitive(60), + val p61: Primitive = Primitive(61), + val p62: Primitive = Primitive(62), + val p63: Primitive = Primitive(63), + val p64: Primitive = Primitive(64) + ) + + @Test + fun test65() { + assertEquals(Dst65(), defaultMapper.readValue("{}")) + } + + // It cannot be a data class because the generated method would exceed the argument size limit. + class DstMax( + val p000: Primitive = Primitive(0), + val p001: Primitive = Primitive(1), + val p002: Primitive = Primitive(2), + val p003: Primitive = Primitive(3), + val p004: Primitive = Primitive(4), + val p005: Primitive = Primitive(5), + val p006: Primitive = Primitive(6), + val p007: Primitive = Primitive(7), + val p008: Primitive = Primitive(8), + val p009: Primitive = Primitive(9), + val p010: Primitive = Primitive(10), + val p011: Primitive = Primitive(11), + val p012: Primitive = Primitive(12), + val p013: Primitive = Primitive(13), + val p014: Primitive = Primitive(14), + val p015: Primitive = Primitive(15), + val p016: Primitive = Primitive(16), + val p017: Primitive = Primitive(17), + val p018: Primitive = Primitive(18), + val p019: Primitive = Primitive(19), + val p020: Primitive = Primitive(20), + val p021: Primitive = Primitive(21), + val p022: Primitive = Primitive(22), + val p023: Primitive = Primitive(23), + val p024: Primitive = Primitive(24), + val p025: Primitive = Primitive(25), + val p026: Primitive = Primitive(26), + val p027: Primitive = Primitive(27), + val p028: Primitive = Primitive(28), + val p029: Primitive = Primitive(29), + val p030: Primitive = Primitive(30), + val p031: Primitive = Primitive(31), + val p032: Primitive = Primitive(32), + val p033: Primitive = Primitive(33), + val p034: Primitive = Primitive(34), + val p035: Primitive = Primitive(35), + val p036: Primitive = Primitive(36), + val p037: Primitive = Primitive(37), + val p038: Primitive = Primitive(38), + val p039: Primitive = Primitive(39), + val p040: Primitive = Primitive(40), + val p041: Primitive = Primitive(41), + val p042: Primitive = Primitive(42), + val p043: Primitive = Primitive(43), + val p044: Primitive = Primitive(44), + val p045: Primitive = Primitive(45), + val p046: Primitive = Primitive(46), + val p047: Primitive = Primitive(47), + val p048: Primitive = Primitive(48), + val p049: Primitive = Primitive(49), + val p050: Primitive = Primitive(50), + val p051: Primitive = Primitive(51), + val p052: Primitive = Primitive(52), + val p053: Primitive = Primitive(53), + val p054: Primitive = Primitive(54), + val p055: Primitive = Primitive(55), + val p056: Primitive = Primitive(56), + val p057: Primitive = Primitive(57), + val p058: Primitive = Primitive(58), + val p059: Primitive = Primitive(59), + val p060: Primitive = Primitive(60), + val p061: Primitive = Primitive(61), + val p062: Primitive = Primitive(62), + val p063: Primitive = Primitive(63), + val p064: Primitive = Primitive(64), + val p065: Primitive = Primitive(65), + val p066: Primitive = Primitive(66), + val p067: Primitive = Primitive(67), + val p068: Primitive = Primitive(68), + val p069: Primitive = Primitive(69), + val p070: Primitive = Primitive(70), + val p071: Primitive = Primitive(71), + val p072: Primitive = Primitive(72), + val p073: Primitive = Primitive(73), + val p074: Primitive = Primitive(74), + val p075: Primitive = Primitive(75), + val p076: Primitive = Primitive(76), + val p077: Primitive = Primitive(77), + val p078: Primitive = Primitive(78), + val p079: Primitive = Primitive(79), + val p080: Primitive = Primitive(80), + val p081: Primitive = Primitive(81), + val p082: Primitive = Primitive(82), + val p083: Primitive = Primitive(83), + val p084: Primitive = Primitive(84), + val p085: Primitive = Primitive(85), + val p086: Primitive = Primitive(86), + val p087: Primitive = Primitive(87), + val p088: Primitive = Primitive(88), + val p089: Primitive = Primitive(89), + val p090: Primitive = Primitive(90), + val p091: Primitive = Primitive(91), + val p092: Primitive = Primitive(92), + val p093: Primitive = Primitive(93), + val p094: Primitive = Primitive(94), + val p095: Primitive = Primitive(95), + val p096: Primitive = Primitive(96), + val p097: Primitive = Primitive(97), + val p098: Primitive = Primitive(98), + val p099: Primitive = Primitive(99), + val p100: Primitive = Primitive(100), + val p101: Primitive = Primitive(101), + val p102: Primitive = Primitive(102), + val p103: Primitive = Primitive(103), + val p104: Primitive = Primitive(104), + val p105: Primitive = Primitive(105), + val p106: Primitive = Primitive(106), + val p107: Primitive = Primitive(107), + val p108: Primitive = Primitive(108), + val p109: Primitive = Primitive(109), + val p110: Primitive = Primitive(110), + val p111: Primitive = Primitive(111), + val p112: Primitive = Primitive(112), + val p113: Primitive = Primitive(113), + val p114: Primitive = Primitive(114), + val p115: Primitive = Primitive(115), + val p116: Primitive = Primitive(116), + val p117: Primitive = Primitive(117), + val p118: Primitive = Primitive(118), + val p119: Primitive = Primitive(119), + val p120: Primitive = Primitive(120), + val p121: Primitive = Primitive(121), + val p122: Primitive = Primitive(122), + val p123: Primitive = Primitive(123), + val p124: Primitive = Primitive(124), + val p125: Primitive = Primitive(125), + val p126: Primitive = Primitive(126), + val p127: Primitive = Primitive(127), + val p128: Primitive = Primitive(128), + val p129: Primitive = Primitive(129), + val p130: Primitive = Primitive(130), + val p131: Primitive = Primitive(131), + val p132: Primitive = Primitive(132), + val p133: Primitive = Primitive(133), + val p134: Primitive = Primitive(134), + val p135: Primitive = Primitive(135), + val p136: Primitive = Primitive(136), + val p137: Primitive = Primitive(137), + val p138: Primitive = Primitive(138), + val p139: Primitive = Primitive(139), + val p140: Primitive = Primitive(140), + val p141: Primitive = Primitive(141), + val p142: Primitive = Primitive(142), + val p143: Primitive = Primitive(143), + val p144: Primitive = Primitive(144), + val p145: Primitive = Primitive(145), + val p146: Primitive = Primitive(146), + val p147: Primitive = Primitive(147), + val p148: Primitive = Primitive(148), + val p149: Primitive = Primitive(149), + val p150: Primitive = Primitive(150), + val p151: Primitive = Primitive(151), + val p152: Primitive = Primitive(152), + val p153: Primitive = Primitive(153), + val p154: Primitive = Primitive(154), + val p155: Primitive = Primitive(155), + val p156: Primitive = Primitive(156), + val p157: Primitive = Primitive(157), + val p158: Primitive = Primitive(158), + val p159: Primitive = Primitive(159), + val p160: Primitive = Primitive(160), + val p161: Primitive = Primitive(161), + val p162: Primitive = Primitive(162), + val p163: Primitive = Primitive(163), + val p164: Primitive = Primitive(164), + val p165: Primitive = Primitive(165), + val p166: Primitive = Primitive(166), + val p167: Primitive = Primitive(167), + val p168: Primitive = Primitive(168), + val p169: Primitive = Primitive(169), + val p170: Primitive = Primitive(170), + val p171: Primitive = Primitive(171), + val p172: Primitive = Primitive(172), + val p173: Primitive = Primitive(173), + val p174: Primitive = Primitive(174), + val p175: Primitive = Primitive(175), + val p176: Primitive = Primitive(176), + val p177: Primitive = Primitive(177), + val p178: Primitive = Primitive(178), + val p179: Primitive = Primitive(179), + val p180: Primitive = Primitive(180), + val p181: Primitive = Primitive(181), + val p182: Primitive = Primitive(182), + val p183: Primitive = Primitive(183), + val p184: Primitive = Primitive(184), + val p185: Primitive = Primitive(185), + val p186: Primitive = Primitive(186), + val p187: Primitive = Primitive(187), + val p188: Primitive = Primitive(188), + val p189: Primitive = Primitive(189), + val p190: Primitive = Primitive(190), + val p191: Primitive = Primitive(191), + val p192: Primitive = Primitive(192), + val p193: Primitive = Primitive(193), + val p194: Primitive = Primitive(194), + val p195: Primitive = Primitive(195), + val p196: Primitive = Primitive(196), + val p197: Primitive = Primitive(197), + val p198: Primitive = Primitive(198), + val p199: Primitive = Primitive(199), + val p200: Primitive = Primitive(200), + val p201: Primitive = Primitive(201), + val p202: Primitive = Primitive(202), + val p203: Primitive = Primitive(203), + val p204: Primitive = Primitive(204), + val p205: Primitive = Primitive(205), + val p206: Primitive = Primitive(206), + val p207: Primitive = Primitive(207), + val p208: Primitive = Primitive(208), + val p209: Primitive = Primitive(209), + val p210: Primitive = Primitive(210), + val p211: Primitive = Primitive(211), + val p212: Primitive = Primitive(212), + val p213: Primitive = Primitive(213), + val p214: Primitive = Primitive(214), + val p215: Primitive = Primitive(215), + val p216: Primitive = Primitive(216), + val p217: Primitive = Primitive(217), + val p218: Primitive = Primitive(218), + val p219: Primitive = Primitive(219), + val p220: Primitive = Primitive(220), + val p221: Primitive = Primitive(221), + val p222: Primitive = Primitive(222), + val p223: Primitive = Primitive(223), + val p224: Primitive = Primitive(224), + val p225: Primitive = Primitive(225), + val p226: Primitive = Primitive(226), + val p227: Primitive = Primitive(227), + val p228: Primitive = Primitive(228), + val p229: Primitive = Primitive(229), + val p230: Primitive = Primitive(230), + val p231: Primitive = Primitive(231), + val p232: Primitive = Primitive(232), + val p233: Primitive = Primitive(233), + val p234: Primitive = Primitive(234), + val p235: Primitive = Primitive(235), + val p236: Primitive = Primitive(236), + val p237: Primitive = Primitive(237), + val p238: Primitive = Primitive(238), + val p239: Primitive = Primitive(239), + val p240: Primitive = Primitive(240), + val p241: Primitive = Primitive(241), + val p242: Primitive = Primitive(242), + val p243: Primitive = Primitive(243), + val p244: Primitive = Primitive(244) + ) + + @Test + fun testMax() { + assertReflectEquals(DstMax(), defaultMapper.readValue("{}")) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByConstructorWithoutDefaultArgumentsTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByConstructorWithoutDefaultArgumentsTest.kt new file mode 100644 index 00000000..9d45f852 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByConstructorWithoutDefaultArgumentsTest.kt @@ -0,0 +1,515 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.primitive + +import com.fasterxml.jackson.module.kotlin.assertReflectEquals +import com.fasterxml.jackson.module.kotlin.callPrimaryConstructor +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.Primitive +import org.junit.Assert.assertEquals +import kotlin.test.Test + +/** + * Up to argument size 32 there is one mask argument for the default argument, + * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested. + * Also, the maximum size of arguments that can be set by a constructor + * that includes a value class as an argument is 253 (one less by DefaultConstructorMarker), so test that case as well. + */ +class DeserializeByConstructorWithoutDefaultArgumentsTest { + data class Dst32( + val p00: Primitive, + val p01: Primitive, + val p02: Primitive, + val p03: Primitive, + val p04: Primitive, + val p05: Primitive, + val p06: Primitive, + val p07: Primitive, + val p08: Primitive, + val p09: Primitive, + val p10: Primitive, + val p11: Primitive, + val p12: Primitive, + val p13: Primitive, + val p14: Primitive, + val p15: Primitive, + val p16: Primitive, + val p17: Primitive, + val p18: Primitive, + val p19: Primitive, + val p20: Primitive, + val p21: Primitive, + val p22: Primitive, + val p23: Primitive, + val p24: Primitive, + val p25: Primitive, + val p26: Primitive, + val p27: Primitive, + val p28: Primitive, + val p29: Primitive, + val p30: Primitive, + val p31: Primitive + ) + + @Test + fun test32() { + val expected = callPrimaryConstructor { Primitive(it.index) } + val src = defaultMapper.writeValueAsString(expected) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst33( + val p00: Primitive, + val p01: Primitive, + val p02: Primitive, + val p03: Primitive, + val p04: Primitive, + val p05: Primitive, + val p06: Primitive, + val p07: Primitive, + val p08: Primitive, + val p09: Primitive, + val p10: Primitive, + val p11: Primitive, + val p12: Primitive, + val p13: Primitive, + val p14: Primitive, + val p15: Primitive, + val p16: Primitive, + val p17: Primitive, + val p18: Primitive, + val p19: Primitive, + val p20: Primitive, + val p21: Primitive, + val p22: Primitive, + val p23: Primitive, + val p24: Primitive, + val p25: Primitive, + val p26: Primitive, + val p27: Primitive, + val p28: Primitive, + val p29: Primitive, + val p30: Primitive, + val p31: Primitive, + val p32: Primitive + ) + + @Test + fun test33() { + val expected = callPrimaryConstructor { Primitive(it.index) } + val src = defaultMapper.writeValueAsString(expected) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst64( + val p00: Primitive, + val p01: Primitive, + val p02: Primitive, + val p03: Primitive, + val p04: Primitive, + val p05: Primitive, + val p06: Primitive, + val p07: Primitive, + val p08: Primitive, + val p09: Primitive, + val p10: Primitive, + val p11: Primitive, + val p12: Primitive, + val p13: Primitive, + val p14: Primitive, + val p15: Primitive, + val p16: Primitive, + val p17: Primitive, + val p18: Primitive, + val p19: Primitive, + val p20: Primitive, + val p21: Primitive, + val p22: Primitive, + val p23: Primitive, + val p24: Primitive, + val p25: Primitive, + val p26: Primitive, + val p27: Primitive, + val p28: Primitive, + val p29: Primitive, + val p30: Primitive, + val p31: Primitive, + val p32: Primitive, + val p33: Primitive, + val p34: Primitive, + val p35: Primitive, + val p36: Primitive, + val p37: Primitive, + val p38: Primitive, + val p39: Primitive, + val p40: Primitive, + val p41: Primitive, + val p42: Primitive, + val p43: Primitive, + val p44: Primitive, + val p45: Primitive, + val p46: Primitive, + val p47: Primitive, + val p48: Primitive, + val p49: Primitive, + val p50: Primitive, + val p51: Primitive, + val p52: Primitive, + val p53: Primitive, + val p54: Primitive, + val p55: Primitive, + val p56: Primitive, + val p57: Primitive, + val p58: Primitive, + val p59: Primitive, + val p60: Primitive, + val p61: Primitive, + val p62: Primitive, + val p63: Primitive + ) + + @Test + fun test64() { + val expected = callPrimaryConstructor { Primitive(it.index) } + val src = defaultMapper.writeValueAsString(expected) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst65( + val p00: Primitive, + val p01: Primitive, + val p02: Primitive, + val p03: Primitive, + val p04: Primitive, + val p05: Primitive, + val p06: Primitive, + val p07: Primitive, + val p08: Primitive, + val p09: Primitive, + val p10: Primitive, + val p11: Primitive, + val p12: Primitive, + val p13: Primitive, + val p14: Primitive, + val p15: Primitive, + val p16: Primitive, + val p17: Primitive, + val p18: Primitive, + val p19: Primitive, + val p20: Primitive, + val p21: Primitive, + val p22: Primitive, + val p23: Primitive, + val p24: Primitive, + val p25: Primitive, + val p26: Primitive, + val p27: Primitive, + val p28: Primitive, + val p29: Primitive, + val p30: Primitive, + val p31: Primitive, + val p32: Primitive, + val p33: Primitive, + val p34: Primitive, + val p35: Primitive, + val p36: Primitive, + val p37: Primitive, + val p38: Primitive, + val p39: Primitive, + val p40: Primitive, + val p41: Primitive, + val p42: Primitive, + val p43: Primitive, + val p44: Primitive, + val p45: Primitive, + val p46: Primitive, + val p47: Primitive, + val p48: Primitive, + val p49: Primitive, + val p50: Primitive, + val p51: Primitive, + val p52: Primitive, + val p53: Primitive, + val p54: Primitive, + val p55: Primitive, + val p56: Primitive, + val p57: Primitive, + val p58: Primitive, + val p59: Primitive, + val p60: Primitive, + val p61: Primitive, + val p62: Primitive, + val p63: Primitive, + val p64: Primitive + ) + + @Test + fun test65() { + val expected = callPrimaryConstructor { Primitive(it.index) } + val src = defaultMapper.writeValueAsString(expected) + assertEquals(expected, defaultMapper.readValue(src)) + } + + // It cannot be a data class because the generated method would exceed the argument size limit. + class DstMax( + val p000: Primitive, + val p001: Primitive, + val p002: Primitive, + val p003: Primitive, + val p004: Primitive, + val p005: Primitive, + val p006: Primitive, + val p007: Primitive, + val p008: Primitive, + val p009: Primitive, + val p010: Primitive, + val p011: Primitive, + val p012: Primitive, + val p013: Primitive, + val p014: Primitive, + val p015: Primitive, + val p016: Primitive, + val p017: Primitive, + val p018: Primitive, + val p019: Primitive, + val p020: Primitive, + val p021: Primitive, + val p022: Primitive, + val p023: Primitive, + val p024: Primitive, + val p025: Primitive, + val p026: Primitive, + val p027: Primitive, + val p028: Primitive, + val p029: Primitive, + val p030: Primitive, + val p031: Primitive, + val p032: Primitive, + val p033: Primitive, + val p034: Primitive, + val p035: Primitive, + val p036: Primitive, + val p037: Primitive, + val p038: Primitive, + val p039: Primitive, + val p040: Primitive, + val p041: Primitive, + val p042: Primitive, + val p043: Primitive, + val p044: Primitive, + val p045: Primitive, + val p046: Primitive, + val p047: Primitive, + val p048: Primitive, + val p049: Primitive, + val p050: Primitive, + val p051: Primitive, + val p052: Primitive, + val p053: Primitive, + val p054: Primitive, + val p055: Primitive, + val p056: Primitive, + val p057: Primitive, + val p058: Primitive, + val p059: Primitive, + val p060: Primitive, + val p061: Primitive, + val p062: Primitive, + val p063: Primitive, + val p064: Primitive, + val p065: Primitive, + val p066: Primitive, + val p067: Primitive, + val p068: Primitive, + val p069: Primitive, + val p070: Primitive, + val p071: Primitive, + val p072: Primitive, + val p073: Primitive, + val p074: Primitive, + val p075: Primitive, + val p076: Primitive, + val p077: Primitive, + val p078: Primitive, + val p079: Primitive, + val p080: Primitive, + val p081: Primitive, + val p082: Primitive, + val p083: Primitive, + val p084: Primitive, + val p085: Primitive, + val p086: Primitive, + val p087: Primitive, + val p088: Primitive, + val p089: Primitive, + val p090: Primitive, + val p091: Primitive, + val p092: Primitive, + val p093: Primitive, + val p094: Primitive, + val p095: Primitive, + val p096: Primitive, + val p097: Primitive, + val p098: Primitive, + val p099: Primitive, + val p100: Primitive, + val p101: Primitive, + val p102: Primitive, + val p103: Primitive, + val p104: Primitive, + val p105: Primitive, + val p106: Primitive, + val p107: Primitive, + val p108: Primitive, + val p109: Primitive, + val p110: Primitive, + val p111: Primitive, + val p112: Primitive, + val p113: Primitive, + val p114: Primitive, + val p115: Primitive, + val p116: Primitive, + val p117: Primitive, + val p118: Primitive, + val p119: Primitive, + val p120: Primitive, + val p121: Primitive, + val p122: Primitive, + val p123: Primitive, + val p124: Primitive, + val p125: Primitive, + val p126: Primitive, + val p127: Primitive, + val p128: Primitive, + val p129: Primitive, + val p130: Primitive, + val p131: Primitive, + val p132: Primitive, + val p133: Primitive, + val p134: Primitive, + val p135: Primitive, + val p136: Primitive, + val p137: Primitive, + val p138: Primitive, + val p139: Primitive, + val p140: Primitive, + val p141: Primitive, + val p142: Primitive, + val p143: Primitive, + val p144: Primitive, + val p145: Primitive, + val p146: Primitive, + val p147: Primitive, + val p148: Primitive, + val p149: Primitive, + val p150: Primitive, + val p151: Primitive, + val p152: Primitive, + val p153: Primitive, + val p154: Primitive, + val p155: Primitive, + val p156: Primitive, + val p157: Primitive, + val p158: Primitive, + val p159: Primitive, + val p160: Primitive, + val p161: Primitive, + val p162: Primitive, + val p163: Primitive, + val p164: Primitive, + val p165: Primitive, + val p166: Primitive, + val p167: Primitive, + val p168: Primitive, + val p169: Primitive, + val p170: Primitive, + val p171: Primitive, + val p172: Primitive, + val p173: Primitive, + val p174: Primitive, + val p175: Primitive, + val p176: Primitive, + val p177: Primitive, + val p178: Primitive, + val p179: Primitive, + val p180: Primitive, + val p181: Primitive, + val p182: Primitive, + val p183: Primitive, + val p184: Primitive, + val p185: Primitive, + val p186: Primitive, + val p187: Primitive, + val p188: Primitive, + val p189: Primitive, + val p190: Primitive, + val p191: Primitive, + val p192: Primitive, + val p193: Primitive, + val p194: Primitive, + val p195: Primitive, + val p196: Primitive, + val p197: Primitive, + val p198: Primitive, + val p199: Primitive, + val p200: Primitive, + val p201: Primitive, + val p202: Primitive, + val p203: Primitive, + val p204: Primitive, + val p205: Primitive, + val p206: Primitive, + val p207: Primitive, + val p208: Primitive, + val p209: Primitive, + val p210: Primitive, + val p211: Primitive, + val p212: Primitive, + val p213: Primitive, + val p214: Primitive, + val p215: Primitive, + val p216: Primitive, + val p217: Primitive, + val p218: Primitive, + val p219: Primitive, + val p220: Primitive, + val p221: Primitive, + val p222: Primitive, + val p223: Primitive, + val p224: Primitive, + val p225: Primitive, + val p226: Primitive, + val p227: Primitive, + val p228: Primitive, + val p229: Primitive, + val p230: Primitive, + val p231: Primitive, + val p232: Primitive, + val p233: Primitive, + val p234: Primitive, + val p235: Primitive, + val p236: Primitive, + val p237: Primitive, + val p238: Primitive, + val p239: Primitive, + val p240: Primitive, + val p241: Primitive, + val p242: Primitive, + val p243: Primitive, + val p244: Primitive, + val p245: Primitive, + val p246: Primitive, + val p247: Primitive, + val p248: Primitive, + val p249: Primitive, + val p250: Primitive, + val p251: Primitive, + val p252: Primitive + ) + + @Test + fun testMax() { + val expected = callPrimaryConstructor { Primitive(it.index) } + val src = defaultMapper.writeValueAsString(expected) + assertReflectEquals(expected, defaultMapper.readValue(src)) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByFactoryWithDefaultArgumentsTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByFactoryWithDefaultArgumentsTest.kt new file mode 100644 index 00000000..3963e844 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByFactoryWithDefaultArgumentsTest.kt @@ -0,0 +1,1411 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.primitive + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.module.kotlin.assertReflectEquals +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.Primitive +import org.junit.Assert.assertEquals +import kotlin.test.Test + +/** + * Up to argument size 32 there is one mask argument for the default argument, + * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested. + * Also, the maximum argument size that can be set in the constructor is 244, so that case is tested as well. + */ +class DeserializeByFactoryWithDefaultArgumentsTest { + data class Dst32( + val p00: Primitive, + val p01: Primitive, + val p02: Primitive, + val p03: Primitive, + val p04: Primitive, + val p05: Primitive, + val p06: Primitive, + val p07: Primitive, + val p08: Primitive, + val p09: Primitive, + val p10: Primitive, + val p11: Primitive, + val p12: Primitive, + val p13: Primitive, + val p14: Primitive, + val p15: Primitive, + val p16: Primitive, + val p17: Primitive, + val p18: Primitive, + val p19: Primitive, + val p20: Primitive, + val p21: Primitive, + val p22: Primitive, + val p23: Primitive, + val p24: Primitive, + val p25: Primitive, + val p26: Primitive, + val p27: Primitive, + val p28: Primitive, + val p29: Primitive, + val p30: Primitive, + val p31: Primitive + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: Primitive = Primitive(0), + q01: Primitive = Primitive(1), + q02: Primitive = Primitive(2), + q03: Primitive = Primitive(3), + q04: Primitive = Primitive(4), + q05: Primitive = Primitive(5), + q06: Primitive = Primitive(6), + q07: Primitive = Primitive(7), + q08: Primitive = Primitive(8), + q09: Primitive = Primitive(9), + q10: Primitive = Primitive(10), + q11: Primitive = Primitive(11), + q12: Primitive = Primitive(12), + q13: Primitive = Primitive(13), + q14: Primitive = Primitive(14), + q15: Primitive = Primitive(15), + q16: Primitive = Primitive(16), + q17: Primitive = Primitive(17), + q18: Primitive = Primitive(18), + q19: Primitive = Primitive(19), + q20: Primitive = Primitive(20), + q21: Primitive = Primitive(21), + q22: Primitive = Primitive(22), + q23: Primitive = Primitive(23), + q24: Primitive = Primitive(24), + q25: Primitive = Primitive(25), + q26: Primitive = Primitive(26), + q27: Primitive = Primitive(27), + q28: Primitive = Primitive(28), + q29: Primitive = Primitive(29), + q30: Primitive = Primitive(30), + q31: Primitive = Primitive(31) + ) = Dst32( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31 + ) + } + } + + @Test + fun test32() { + assertEquals(Dst32.creator(), defaultMapper.readValue("{}")) + } + + data class Dst33( + val p00: Primitive, + val p01: Primitive, + val p02: Primitive, + val p03: Primitive, + val p04: Primitive, + val p05: Primitive, + val p06: Primitive, + val p07: Primitive, + val p08: Primitive, + val p09: Primitive, + val p10: Primitive, + val p11: Primitive, + val p12: Primitive, + val p13: Primitive, + val p14: Primitive, + val p15: Primitive, + val p16: Primitive, + val p17: Primitive, + val p18: Primitive, + val p19: Primitive, + val p20: Primitive, + val p21: Primitive, + val p22: Primitive, + val p23: Primitive, + val p24: Primitive, + val p25: Primitive, + val p26: Primitive, + val p27: Primitive, + val p28: Primitive, + val p29: Primitive, + val p30: Primitive, + val p31: Primitive, + val p32: Primitive + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: Primitive = Primitive(0), + q01: Primitive = Primitive(1), + q02: Primitive = Primitive(2), + q03: Primitive = Primitive(3), + q04: Primitive = Primitive(4), + q05: Primitive = Primitive(5), + q06: Primitive = Primitive(6), + q07: Primitive = Primitive(7), + q08: Primitive = Primitive(8), + q09: Primitive = Primitive(9), + q10: Primitive = Primitive(10), + q11: Primitive = Primitive(11), + q12: Primitive = Primitive(12), + q13: Primitive = Primitive(13), + q14: Primitive = Primitive(14), + q15: Primitive = Primitive(15), + q16: Primitive = Primitive(16), + q17: Primitive = Primitive(17), + q18: Primitive = Primitive(18), + q19: Primitive = Primitive(19), + q20: Primitive = Primitive(20), + q21: Primitive = Primitive(21), + q22: Primitive = Primitive(22), + q23: Primitive = Primitive(23), + q24: Primitive = Primitive(24), + q25: Primitive = Primitive(25), + q26: Primitive = Primitive(26), + q27: Primitive = Primitive(27), + q28: Primitive = Primitive(28), + q29: Primitive = Primitive(29), + q30: Primitive = Primitive(30), + q31: Primitive = Primitive(31), + q32: Primitive = Primitive(32) + ) = Dst33( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32 + ) + } + } + + @Test + fun test33() { + assertEquals(Dst33.creator(), defaultMapper.readValue("{}")) + } + + data class Dst64( + val p00: Primitive, + val p01: Primitive, + val p02: Primitive, + val p03: Primitive, + val p04: Primitive, + val p05: Primitive, + val p06: Primitive, + val p07: Primitive, + val p08: Primitive, + val p09: Primitive, + val p10: Primitive, + val p11: Primitive, + val p12: Primitive, + val p13: Primitive, + val p14: Primitive, + val p15: Primitive, + val p16: Primitive, + val p17: Primitive, + val p18: Primitive, + val p19: Primitive, + val p20: Primitive, + val p21: Primitive, + val p22: Primitive, + val p23: Primitive, + val p24: Primitive, + val p25: Primitive, + val p26: Primitive, + val p27: Primitive, + val p28: Primitive, + val p29: Primitive, + val p30: Primitive, + val p31: Primitive, + val p32: Primitive, + val p33: Primitive, + val p34: Primitive, + val p35: Primitive, + val p36: Primitive, + val p37: Primitive, + val p38: Primitive, + val p39: Primitive, + val p40: Primitive, + val p41: Primitive, + val p42: Primitive, + val p43: Primitive, + val p44: Primitive, + val p45: Primitive, + val p46: Primitive, + val p47: Primitive, + val p48: Primitive, + val p49: Primitive, + val p50: Primitive, + val p51: Primitive, + val p52: Primitive, + val p53: Primitive, + val p54: Primitive, + val p55: Primitive, + val p56: Primitive, + val p57: Primitive, + val p58: Primitive, + val p59: Primitive, + val p60: Primitive, + val p61: Primitive, + val p62: Primitive, + val p63: Primitive + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: Primitive = Primitive(0), + q01: Primitive = Primitive(1), + q02: Primitive = Primitive(2), + q03: Primitive = Primitive(3), + q04: Primitive = Primitive(4), + q05: Primitive = Primitive(5), + q06: Primitive = Primitive(6), + q07: Primitive = Primitive(7), + q08: Primitive = Primitive(8), + q09: Primitive = Primitive(9), + q10: Primitive = Primitive(10), + q11: Primitive = Primitive(11), + q12: Primitive = Primitive(12), + q13: Primitive = Primitive(13), + q14: Primitive = Primitive(14), + q15: Primitive = Primitive(15), + q16: Primitive = Primitive(16), + q17: Primitive = Primitive(17), + q18: Primitive = Primitive(18), + q19: Primitive = Primitive(19), + q20: Primitive = Primitive(20), + q21: Primitive = Primitive(21), + q22: Primitive = Primitive(22), + q23: Primitive = Primitive(23), + q24: Primitive = Primitive(24), + q25: Primitive = Primitive(25), + q26: Primitive = Primitive(26), + q27: Primitive = Primitive(27), + q28: Primitive = Primitive(28), + q29: Primitive = Primitive(29), + q30: Primitive = Primitive(30), + q31: Primitive = Primitive(31), + q32: Primitive = Primitive(32), + q33: Primitive = Primitive(33), + q34: Primitive = Primitive(34), + q35: Primitive = Primitive(35), + q36: Primitive = Primitive(36), + q37: Primitive = Primitive(37), + q38: Primitive = Primitive(38), + q39: Primitive = Primitive(39), + q40: Primitive = Primitive(40), + q41: Primitive = Primitive(41), + q42: Primitive = Primitive(42), + q43: Primitive = Primitive(43), + q44: Primitive = Primitive(44), + q45: Primitive = Primitive(45), + q46: Primitive = Primitive(46), + q47: Primitive = Primitive(47), + q48: Primitive = Primitive(48), + q49: Primitive = Primitive(49), + q50: Primitive = Primitive(50), + q51: Primitive = Primitive(51), + q52: Primitive = Primitive(52), + q53: Primitive = Primitive(53), + q54: Primitive = Primitive(54), + q55: Primitive = Primitive(55), + q56: Primitive = Primitive(56), + q57: Primitive = Primitive(57), + q58: Primitive = Primitive(58), + q59: Primitive = Primitive(59), + q60: Primitive = Primitive(60), + q61: Primitive = Primitive(61), + q62: Primitive = Primitive(62), + q63: Primitive = Primitive(63) + ) = Dst64( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32, + q33, + q34, + q35, + q36, + q37, + q38, + q39, + q40, + q41, + q42, + q43, + q44, + q45, + q46, + q47, + q48, + q49, + q50, + q51, + q52, + q53, + q54, + q55, + q56, + q57, + q58, + q59, + q60, + q61, + q62, + q63 + ) + } + } + + @Test + fun test64() { + assertEquals(Dst64.creator(), defaultMapper.readValue("{}")) + } + + data class Dst65( + val p00: Primitive, + val p01: Primitive, + val p02: Primitive, + val p03: Primitive, + val p04: Primitive, + val p05: Primitive, + val p06: Primitive, + val p07: Primitive, + val p08: Primitive, + val p09: Primitive, + val p10: Primitive, + val p11: Primitive, + val p12: Primitive, + val p13: Primitive, + val p14: Primitive, + val p15: Primitive, + val p16: Primitive, + val p17: Primitive, + val p18: Primitive, + val p19: Primitive, + val p20: Primitive, + val p21: Primitive, + val p22: Primitive, + val p23: Primitive, + val p24: Primitive, + val p25: Primitive, + val p26: Primitive, + val p27: Primitive, + val p28: Primitive, + val p29: Primitive, + val p30: Primitive, + val p31: Primitive, + val p32: Primitive, + val p33: Primitive, + val p34: Primitive, + val p35: Primitive, + val p36: Primitive, + val p37: Primitive, + val p38: Primitive, + val p39: Primitive, + val p40: Primitive, + val p41: Primitive, + val p42: Primitive, + val p43: Primitive, + val p44: Primitive, + val p45: Primitive, + val p46: Primitive, + val p47: Primitive, + val p48: Primitive, + val p49: Primitive, + val p50: Primitive, + val p51: Primitive, + val p52: Primitive, + val p53: Primitive, + val p54: Primitive, + val p55: Primitive, + val p56: Primitive, + val p57: Primitive, + val p58: Primitive, + val p59: Primitive, + val p60: Primitive, + val p61: Primitive, + val p62: Primitive, + val p63: Primitive, + val p64: Primitive + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: Primitive = Primitive(0), + q01: Primitive = Primitive(1), + q02: Primitive = Primitive(2), + q03: Primitive = Primitive(3), + q04: Primitive = Primitive(4), + q05: Primitive = Primitive(5), + q06: Primitive = Primitive(6), + q07: Primitive = Primitive(7), + q08: Primitive = Primitive(8), + q09: Primitive = Primitive(9), + q10: Primitive = Primitive(10), + q11: Primitive = Primitive(11), + q12: Primitive = Primitive(12), + q13: Primitive = Primitive(13), + q14: Primitive = Primitive(14), + q15: Primitive = Primitive(15), + q16: Primitive = Primitive(16), + q17: Primitive = Primitive(17), + q18: Primitive = Primitive(18), + q19: Primitive = Primitive(19), + q20: Primitive = Primitive(20), + q21: Primitive = Primitive(21), + q22: Primitive = Primitive(22), + q23: Primitive = Primitive(23), + q24: Primitive = Primitive(24), + q25: Primitive = Primitive(25), + q26: Primitive = Primitive(26), + q27: Primitive = Primitive(27), + q28: Primitive = Primitive(28), + q29: Primitive = Primitive(29), + q30: Primitive = Primitive(30), + q31: Primitive = Primitive(31), + q32: Primitive = Primitive(32), + q33: Primitive = Primitive(33), + q34: Primitive = Primitive(34), + q35: Primitive = Primitive(35), + q36: Primitive = Primitive(36), + q37: Primitive = Primitive(37), + q38: Primitive = Primitive(38), + q39: Primitive = Primitive(39), + q40: Primitive = Primitive(40), + q41: Primitive = Primitive(41), + q42: Primitive = Primitive(42), + q43: Primitive = Primitive(43), + q44: Primitive = Primitive(44), + q45: Primitive = Primitive(45), + q46: Primitive = Primitive(46), + q47: Primitive = Primitive(47), + q48: Primitive = Primitive(48), + q49: Primitive = Primitive(49), + q50: Primitive = Primitive(50), + q51: Primitive = Primitive(51), + q52: Primitive = Primitive(52), + q53: Primitive = Primitive(53), + q54: Primitive = Primitive(54), + q55: Primitive = Primitive(55), + q56: Primitive = Primitive(56), + q57: Primitive = Primitive(57), + q58: Primitive = Primitive(58), + q59: Primitive = Primitive(59), + q60: Primitive = Primitive(60), + q61: Primitive = Primitive(61), + q62: Primitive = Primitive(62), + q63: Primitive = Primitive(63), + q64: Primitive = Primitive(64) + ) = Dst65( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32, + q33, + q34, + q35, + q36, + q37, + q38, + q39, + q40, + q41, + q42, + q43, + q44, + q45, + q46, + q47, + q48, + q49, + q50, + q51, + q52, + q53, + q54, + q55, + q56, + q57, + q58, + q59, + q60, + q61, + q62, + q63, + q64 + ) + } + } + + @Test + fun test65() { + assertEquals(Dst65.creator(), defaultMapper.readValue("{}")) + } + + // It cannot be a data class because the generated method would exceed the argument size limit. + class DstMax( + val p000: Primitive, + val p001: Primitive, + val p002: Primitive, + val p003: Primitive, + val p004: Primitive, + val p005: Primitive, + val p006: Primitive, + val p007: Primitive, + val p008: Primitive, + val p009: Primitive, + val p010: Primitive, + val p011: Primitive, + val p012: Primitive, + val p013: Primitive, + val p014: Primitive, + val p015: Primitive, + val p016: Primitive, + val p017: Primitive, + val p018: Primitive, + val p019: Primitive, + val p020: Primitive, + val p021: Primitive, + val p022: Primitive, + val p023: Primitive, + val p024: Primitive, + val p025: Primitive, + val p026: Primitive, + val p027: Primitive, + val p028: Primitive, + val p029: Primitive, + val p030: Primitive, + val p031: Primitive, + val p032: Primitive, + val p033: Primitive, + val p034: Primitive, + val p035: Primitive, + val p036: Primitive, + val p037: Primitive, + val p038: Primitive, + val p039: Primitive, + val p040: Primitive, + val p041: Primitive, + val p042: Primitive, + val p043: Primitive, + val p044: Primitive, + val p045: Primitive, + val p046: Primitive, + val p047: Primitive, + val p048: Primitive, + val p049: Primitive, + val p050: Primitive, + val p051: Primitive, + val p052: Primitive, + val p053: Primitive, + val p054: Primitive, + val p055: Primitive, + val p056: Primitive, + val p057: Primitive, + val p058: Primitive, + val p059: Primitive, + val p060: Primitive, + val p061: Primitive, + val p062: Primitive, + val p063: Primitive, + val p064: Primitive, + val p065: Primitive, + val p066: Primitive, + val p067: Primitive, + val p068: Primitive, + val p069: Primitive, + val p070: Primitive, + val p071: Primitive, + val p072: Primitive, + val p073: Primitive, + val p074: Primitive, + val p075: Primitive, + val p076: Primitive, + val p077: Primitive, + val p078: Primitive, + val p079: Primitive, + val p080: Primitive, + val p081: Primitive, + val p082: Primitive, + val p083: Primitive, + val p084: Primitive, + val p085: Primitive, + val p086: Primitive, + val p087: Primitive, + val p088: Primitive, + val p089: Primitive, + val p090: Primitive, + val p091: Primitive, + val p092: Primitive, + val p093: Primitive, + val p094: Primitive, + val p095: Primitive, + val p096: Primitive, + val p097: Primitive, + val p098: Primitive, + val p099: Primitive, + val p100: Primitive, + val p101: Primitive, + val p102: Primitive, + val p103: Primitive, + val p104: Primitive, + val p105: Primitive, + val p106: Primitive, + val p107: Primitive, + val p108: Primitive, + val p109: Primitive, + val p110: Primitive, + val p111: Primitive, + val p112: Primitive, + val p113: Primitive, + val p114: Primitive, + val p115: Primitive, + val p116: Primitive, + val p117: Primitive, + val p118: Primitive, + val p119: Primitive, + val p120: Primitive, + val p121: Primitive, + val p122: Primitive, + val p123: Primitive, + val p124: Primitive, + val p125: Primitive, + val p126: Primitive, + val p127: Primitive, + val p128: Primitive, + val p129: Primitive, + val p130: Primitive, + val p131: Primitive, + val p132: Primitive, + val p133: Primitive, + val p134: Primitive, + val p135: Primitive, + val p136: Primitive, + val p137: Primitive, + val p138: Primitive, + val p139: Primitive, + val p140: Primitive, + val p141: Primitive, + val p142: Primitive, + val p143: Primitive, + val p144: Primitive, + val p145: Primitive, + val p146: Primitive, + val p147: Primitive, + val p148: Primitive, + val p149: Primitive, + val p150: Primitive, + val p151: Primitive, + val p152: Primitive, + val p153: Primitive, + val p154: Primitive, + val p155: Primitive, + val p156: Primitive, + val p157: Primitive, + val p158: Primitive, + val p159: Primitive, + val p160: Primitive, + val p161: Primitive, + val p162: Primitive, + val p163: Primitive, + val p164: Primitive, + val p165: Primitive, + val p166: Primitive, + val p167: Primitive, + val p168: Primitive, + val p169: Primitive, + val p170: Primitive, + val p171: Primitive, + val p172: Primitive, + val p173: Primitive, + val p174: Primitive, + val p175: Primitive, + val p176: Primitive, + val p177: Primitive, + val p178: Primitive, + val p179: Primitive, + val p180: Primitive, + val p181: Primitive, + val p182: Primitive, + val p183: Primitive, + val p184: Primitive, + val p185: Primitive, + val p186: Primitive, + val p187: Primitive, + val p188: Primitive, + val p189: Primitive, + val p190: Primitive, + val p191: Primitive, + val p192: Primitive, + val p193: Primitive, + val p194: Primitive, + val p195: Primitive, + val p196: Primitive, + val p197: Primitive, + val p198: Primitive, + val p199: Primitive, + val p200: Primitive, + val p201: Primitive, + val p202: Primitive, + val p203: Primitive, + val p204: Primitive, + val p205: Primitive, + val p206: Primitive, + val p207: Primitive, + val p208: Primitive, + val p209: Primitive, + val p210: Primitive, + val p211: Primitive, + val p212: Primitive, + val p213: Primitive, + val p214: Primitive, + val p215: Primitive, + val p216: Primitive, + val p217: Primitive, + val p218: Primitive, + val p219: Primitive, + val p220: Primitive, + val p221: Primitive, + val p222: Primitive, + val p223: Primitive, + val p224: Primitive, + val p225: Primitive, + val p226: Primitive, + val p227: Primitive, + val p228: Primitive, + val p229: Primitive, + val p230: Primitive, + val p231: Primitive, + val p232: Primitive, + val p233: Primitive, + val p234: Primitive, + val p235: Primitive, + val p236: Primitive, + val p237: Primitive, + val p238: Primitive, + val p239: Primitive, + val p240: Primitive, + val p241: Primitive, + val p242: Primitive, + val p243: Primitive + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q000: Primitive = Primitive(0), + q001: Primitive = Primitive(1), + q002: Primitive = Primitive(2), + q003: Primitive = Primitive(3), + q004: Primitive = Primitive(4), + q005: Primitive = Primitive(5), + q006: Primitive = Primitive(6), + q007: Primitive = Primitive(7), + q008: Primitive = Primitive(8), + q009: Primitive = Primitive(9), + q010: Primitive = Primitive(10), + q011: Primitive = Primitive(11), + q012: Primitive = Primitive(12), + q013: Primitive = Primitive(13), + q014: Primitive = Primitive(14), + q015: Primitive = Primitive(15), + q016: Primitive = Primitive(16), + q017: Primitive = Primitive(17), + q018: Primitive = Primitive(18), + q019: Primitive = Primitive(19), + q020: Primitive = Primitive(20), + q021: Primitive = Primitive(21), + q022: Primitive = Primitive(22), + q023: Primitive = Primitive(23), + q024: Primitive = Primitive(24), + q025: Primitive = Primitive(25), + q026: Primitive = Primitive(26), + q027: Primitive = Primitive(27), + q028: Primitive = Primitive(28), + q029: Primitive = Primitive(29), + q030: Primitive = Primitive(30), + q031: Primitive = Primitive(31), + q032: Primitive = Primitive(32), + q033: Primitive = Primitive(33), + q034: Primitive = Primitive(34), + q035: Primitive = Primitive(35), + q036: Primitive = Primitive(36), + q037: Primitive = Primitive(37), + q038: Primitive = Primitive(38), + q039: Primitive = Primitive(39), + q040: Primitive = Primitive(40), + q041: Primitive = Primitive(41), + q042: Primitive = Primitive(42), + q043: Primitive = Primitive(43), + q044: Primitive = Primitive(44), + q045: Primitive = Primitive(45), + q046: Primitive = Primitive(46), + q047: Primitive = Primitive(47), + q048: Primitive = Primitive(48), + q049: Primitive = Primitive(49), + q050: Primitive = Primitive(50), + q051: Primitive = Primitive(51), + q052: Primitive = Primitive(52), + q053: Primitive = Primitive(53), + q054: Primitive = Primitive(54), + q055: Primitive = Primitive(55), + q056: Primitive = Primitive(56), + q057: Primitive = Primitive(57), + q058: Primitive = Primitive(58), + q059: Primitive = Primitive(59), + q060: Primitive = Primitive(60), + q061: Primitive = Primitive(61), + q062: Primitive = Primitive(62), + q063: Primitive = Primitive(63), + q064: Primitive = Primitive(64), + q065: Primitive = Primitive(65), + q066: Primitive = Primitive(66), + q067: Primitive = Primitive(67), + q068: Primitive = Primitive(68), + q069: Primitive = Primitive(69), + q070: Primitive = Primitive(70), + q071: Primitive = Primitive(71), + q072: Primitive = Primitive(72), + q073: Primitive = Primitive(73), + q074: Primitive = Primitive(74), + q075: Primitive = Primitive(75), + q076: Primitive = Primitive(76), + q077: Primitive = Primitive(77), + q078: Primitive = Primitive(78), + q079: Primitive = Primitive(79), + q080: Primitive = Primitive(80), + q081: Primitive = Primitive(81), + q082: Primitive = Primitive(82), + q083: Primitive = Primitive(83), + q084: Primitive = Primitive(84), + q085: Primitive = Primitive(85), + q086: Primitive = Primitive(86), + q087: Primitive = Primitive(87), + q088: Primitive = Primitive(88), + q089: Primitive = Primitive(89), + q090: Primitive = Primitive(90), + q091: Primitive = Primitive(91), + q092: Primitive = Primitive(92), + q093: Primitive = Primitive(93), + q094: Primitive = Primitive(94), + q095: Primitive = Primitive(95), + q096: Primitive = Primitive(96), + q097: Primitive = Primitive(97), + q098: Primitive = Primitive(98), + q099: Primitive = Primitive(99), + q100: Primitive = Primitive(100), + q101: Primitive = Primitive(101), + q102: Primitive = Primitive(102), + q103: Primitive = Primitive(103), + q104: Primitive = Primitive(104), + q105: Primitive = Primitive(105), + q106: Primitive = Primitive(106), + q107: Primitive = Primitive(107), + q108: Primitive = Primitive(108), + q109: Primitive = Primitive(109), + q110: Primitive = Primitive(110), + q111: Primitive = Primitive(111), + q112: Primitive = Primitive(112), + q113: Primitive = Primitive(113), + q114: Primitive = Primitive(114), + q115: Primitive = Primitive(115), + q116: Primitive = Primitive(116), + q117: Primitive = Primitive(117), + q118: Primitive = Primitive(118), + q119: Primitive = Primitive(119), + q120: Primitive = Primitive(120), + q121: Primitive = Primitive(121), + q122: Primitive = Primitive(122), + q123: Primitive = Primitive(123), + q124: Primitive = Primitive(124), + q125: Primitive = Primitive(125), + q126: Primitive = Primitive(126), + q127: Primitive = Primitive(127), + q128: Primitive = Primitive(128), + q129: Primitive = Primitive(129), + q130: Primitive = Primitive(130), + q131: Primitive = Primitive(131), + q132: Primitive = Primitive(132), + q133: Primitive = Primitive(133), + q134: Primitive = Primitive(134), + q135: Primitive = Primitive(135), + q136: Primitive = Primitive(136), + q137: Primitive = Primitive(137), + q138: Primitive = Primitive(138), + q139: Primitive = Primitive(139), + q140: Primitive = Primitive(140), + q141: Primitive = Primitive(141), + q142: Primitive = Primitive(142), + q143: Primitive = Primitive(143), + q144: Primitive = Primitive(144), + q145: Primitive = Primitive(145), + q146: Primitive = Primitive(146), + q147: Primitive = Primitive(147), + q148: Primitive = Primitive(148), + q149: Primitive = Primitive(149), + q150: Primitive = Primitive(150), + q151: Primitive = Primitive(151), + q152: Primitive = Primitive(152), + q153: Primitive = Primitive(153), + q154: Primitive = Primitive(154), + q155: Primitive = Primitive(155), + q156: Primitive = Primitive(156), + q157: Primitive = Primitive(157), + q158: Primitive = Primitive(158), + q159: Primitive = Primitive(159), + q160: Primitive = Primitive(160), + q161: Primitive = Primitive(161), + q162: Primitive = Primitive(162), + q163: Primitive = Primitive(163), + q164: Primitive = Primitive(164), + q165: Primitive = Primitive(165), + q166: Primitive = Primitive(166), + q167: Primitive = Primitive(167), + q168: Primitive = Primitive(168), + q169: Primitive = Primitive(169), + q170: Primitive = Primitive(170), + q171: Primitive = Primitive(171), + q172: Primitive = Primitive(172), + q173: Primitive = Primitive(173), + q174: Primitive = Primitive(174), + q175: Primitive = Primitive(175), + q176: Primitive = Primitive(176), + q177: Primitive = Primitive(177), + q178: Primitive = Primitive(178), + q179: Primitive = Primitive(179), + q180: Primitive = Primitive(180), + q181: Primitive = Primitive(181), + q182: Primitive = Primitive(182), + q183: Primitive = Primitive(183), + q184: Primitive = Primitive(184), + q185: Primitive = Primitive(185), + q186: Primitive = Primitive(186), + q187: Primitive = Primitive(187), + q188: Primitive = Primitive(188), + q189: Primitive = Primitive(189), + q190: Primitive = Primitive(190), + q191: Primitive = Primitive(191), + q192: Primitive = Primitive(192), + q193: Primitive = Primitive(193), + q194: Primitive = Primitive(194), + q195: Primitive = Primitive(195), + q196: Primitive = Primitive(196), + q197: Primitive = Primitive(197), + q198: Primitive = Primitive(198), + q199: Primitive = Primitive(199), + q200: Primitive = Primitive(200), + q201: Primitive = Primitive(201), + q202: Primitive = Primitive(202), + q203: Primitive = Primitive(203), + q204: Primitive = Primitive(204), + q205: Primitive = Primitive(205), + q206: Primitive = Primitive(206), + q207: Primitive = Primitive(207), + q208: Primitive = Primitive(208), + q209: Primitive = Primitive(209), + q210: Primitive = Primitive(210), + q211: Primitive = Primitive(211), + q212: Primitive = Primitive(212), + q213: Primitive = Primitive(213), + q214: Primitive = Primitive(214), + q215: Primitive = Primitive(215), + q216: Primitive = Primitive(216), + q217: Primitive = Primitive(217), + q218: Primitive = Primitive(218), + q219: Primitive = Primitive(219), + q220: Primitive = Primitive(220), + q221: Primitive = Primitive(221), + q222: Primitive = Primitive(222), + q223: Primitive = Primitive(223), + q224: Primitive = Primitive(224), + q225: Primitive = Primitive(225), + q226: Primitive = Primitive(226), + q227: Primitive = Primitive(227), + q228: Primitive = Primitive(228), + q229: Primitive = Primitive(229), + q230: Primitive = Primitive(230), + q231: Primitive = Primitive(231), + q232: Primitive = Primitive(232), + q233: Primitive = Primitive(233), + q234: Primitive = Primitive(234), + q235: Primitive = Primitive(235), + q236: Primitive = Primitive(236), + q237: Primitive = Primitive(237), + q238: Primitive = Primitive(238), + q239: Primitive = Primitive(239), + q240: Primitive = Primitive(240), + q241: Primitive = Primitive(241), + q242: Primitive = Primitive(242), + q243: Primitive = Primitive(243) + ) = DstMax( + q000, + q001, + q002, + q003, + q004, + q005, + q006, + q007, + q008, + q009, + q010, + q011, + q012, + q013, + q014, + q015, + q016, + q017, + q018, + q019, + q020, + q021, + q022, + q023, + q024, + q025, + q026, + q027, + q028, + q029, + q030, + q031, + q032, + q033, + q034, + q035, + q036, + q037, + q038, + q039, + q040, + q041, + q042, + q043, + q044, + q045, + q046, + q047, + q048, + q049, + q050, + q051, + q052, + q053, + q054, + q055, + q056, + q057, + q058, + q059, + q060, + q061, + q062, + q063, + q064, + q065, + q066, + q067, + q068, + q069, + q070, + q071, + q072, + q073, + q074, + q075, + q076, + q077, + q078, + q079, + q080, + q081, + q082, + q083, + q084, + q085, + q086, + q087, + q088, + q089, + q090, + q091, + q092, + q093, + q094, + q095, + q096, + q097, + q098, + q099, + q100, + q101, + q102, + q103, + q104, + q105, + q106, + q107, + q108, + q109, + q110, + q111, + q112, + q113, + q114, + q115, + q116, + q117, + q118, + q119, + q120, + q121, + q122, + q123, + q124, + q125, + q126, + q127, + q128, + q129, + q130, + q131, + q132, + q133, + q134, + q135, + q136, + q137, + q138, + q139, + q140, + q141, + q142, + q143, + q144, + q145, + q146, + q147, + q148, + q149, + q150, + q151, + q152, + q153, + q154, + q155, + q156, + q157, + q158, + q159, + q160, + q161, + q162, + q163, + q164, + q165, + q166, + q167, + q168, + q169, + q170, + q171, + q172, + q173, + q174, + q175, + q176, + q177, + q178, + q179, + q180, + q181, + q182, + q183, + q184, + q185, + q186, + q187, + q188, + q189, + q190, + q191, + q192, + q193, + q194, + q195, + q196, + q197, + q198, + q199, + q200, + q201, + q202, + q203, + q204, + q205, + q206, + q207, + q208, + q209, + q210, + q211, + q212, + q213, + q214, + q215, + q216, + q217, + q218, + q219, + q220, + q221, + q222, + q223, + q224, + q225, + q226, + q227, + q228, + q229, + q230, + q231, + q232, + q233, + q234, + q235, + q236, + q237, + q238, + q239, + q240, + q241, + q242, + q243 + ) + } + } + + @Test + fun testMax() { + assertReflectEquals(DstMax.creator(), defaultMapper.readValue("{}")) + } +} diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByFactoryWithoutDefaultArgumentsTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByFactoryWithoutDefaultArgumentsTest.kt new file mode 100644 index 00000000..bcd5d766 --- /dev/null +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/parameterSize/primitive/DeserializeByFactoryWithoutDefaultArgumentsTest.kt @@ -0,0 +1,1453 @@ +package com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.parameterSize.primitive + +import com.fasterxml.jackson.annotation.JsonCreator +import com.fasterxml.jackson.module.kotlin.assertReflectEquals +import com.fasterxml.jackson.module.kotlin.callPrimaryConstructor +import com.fasterxml.jackson.module.kotlin.defaultMapper +import com.fasterxml.jackson.module.kotlin.readValue +import com.fasterxml.jackson.module.kotlin.kogeraIntegration.deser.valueClass.Primitive +import org.junit.Assert.assertEquals +import kotlin.test.Test + +// Convert the property p to q (but not the value) to make it an input to the factory function. +private fun replacePQ(src: String) = src.replace(Regex("""p\d+":""")) { "q" + it.value.substring(1) } + +/** + * Up to argument size 32 there is one mask argument for the default argument, + * 33 ~ 64 there are two, and 65 there are three, so each boundary value is tested. + * Also, the maximum size of arguments that can be set by a constructor + * that includes a value class as an argument is 253 (one less by DefaultConstructorMarker), so test that case as well. + */ +class DeserializeByFactoryWithoutDefaultArgumentsTest { + data class Dst32( + val p00: Primitive, + val p01: Primitive, + val p02: Primitive, + val p03: Primitive, + val p04: Primitive, + val p05: Primitive, + val p06: Primitive, + val p07: Primitive, + val p08: Primitive, + val p09: Primitive, + val p10: Primitive, + val p11: Primitive, + val p12: Primitive, + val p13: Primitive, + val p14: Primitive, + val p15: Primitive, + val p16: Primitive, + val p17: Primitive, + val p18: Primitive, + val p19: Primitive, + val p20: Primitive, + val p21: Primitive, + val p22: Primitive, + val p23: Primitive, + val p24: Primitive, + val p25: Primitive, + val p26: Primitive, + val p27: Primitive, + val p28: Primitive, + val p29: Primitive, + val p30: Primitive, + val p31: Primitive + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: Primitive, + q01: Primitive, + q02: Primitive, + q03: Primitive, + q04: Primitive, + q05: Primitive, + q06: Primitive, + q07: Primitive, + q08: Primitive, + q09: Primitive, + q10: Primitive, + q11: Primitive, + q12: Primitive, + q13: Primitive, + q14: Primitive, + q15: Primitive, + q16: Primitive, + q17: Primitive, + q18: Primitive, + q19: Primitive, + q20: Primitive, + q21: Primitive, + q22: Primitive, + q23: Primitive, + q24: Primitive, + q25: Primitive, + q26: Primitive, + q27: Primitive, + q28: Primitive, + q29: Primitive, + q30: Primitive, + q31: Primitive + ) = Dst32( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31 + ) + } + } + + @Test + fun test32() { + val expected = callPrimaryConstructor { Primitive(it.index) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst33( + val p00: Primitive, + val p01: Primitive, + val p02: Primitive, + val p03: Primitive, + val p04: Primitive, + val p05: Primitive, + val p06: Primitive, + val p07: Primitive, + val p08: Primitive, + val p09: Primitive, + val p10: Primitive, + val p11: Primitive, + val p12: Primitive, + val p13: Primitive, + val p14: Primitive, + val p15: Primitive, + val p16: Primitive, + val p17: Primitive, + val p18: Primitive, + val p19: Primitive, + val p20: Primitive, + val p21: Primitive, + val p22: Primitive, + val p23: Primitive, + val p24: Primitive, + val p25: Primitive, + val p26: Primitive, + val p27: Primitive, + val p28: Primitive, + val p29: Primitive, + val p30: Primitive, + val p31: Primitive, + val p32: Primitive + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: Primitive, + q01: Primitive, + q02: Primitive, + q03: Primitive, + q04: Primitive, + q05: Primitive, + q06: Primitive, + q07: Primitive, + q08: Primitive, + q09: Primitive, + q10: Primitive, + q11: Primitive, + q12: Primitive, + q13: Primitive, + q14: Primitive, + q15: Primitive, + q16: Primitive, + q17: Primitive, + q18: Primitive, + q19: Primitive, + q20: Primitive, + q21: Primitive, + q22: Primitive, + q23: Primitive, + q24: Primitive, + q25: Primitive, + q26: Primitive, + q27: Primitive, + q28: Primitive, + q29: Primitive, + q30: Primitive, + q31: Primitive, + q32: Primitive + ) = Dst33( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32 + ) + } + } + + @Test + fun test33() { + val expected = callPrimaryConstructor { Primitive(it.index) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst64( + val p00: Primitive, + val p01: Primitive, + val p02: Primitive, + val p03: Primitive, + val p04: Primitive, + val p05: Primitive, + val p06: Primitive, + val p07: Primitive, + val p08: Primitive, + val p09: Primitive, + val p10: Primitive, + val p11: Primitive, + val p12: Primitive, + val p13: Primitive, + val p14: Primitive, + val p15: Primitive, + val p16: Primitive, + val p17: Primitive, + val p18: Primitive, + val p19: Primitive, + val p20: Primitive, + val p21: Primitive, + val p22: Primitive, + val p23: Primitive, + val p24: Primitive, + val p25: Primitive, + val p26: Primitive, + val p27: Primitive, + val p28: Primitive, + val p29: Primitive, + val p30: Primitive, + val p31: Primitive, + val p32: Primitive, + val p33: Primitive, + val p34: Primitive, + val p35: Primitive, + val p36: Primitive, + val p37: Primitive, + val p38: Primitive, + val p39: Primitive, + val p40: Primitive, + val p41: Primitive, + val p42: Primitive, + val p43: Primitive, + val p44: Primitive, + val p45: Primitive, + val p46: Primitive, + val p47: Primitive, + val p48: Primitive, + val p49: Primitive, + val p50: Primitive, + val p51: Primitive, + val p52: Primitive, + val p53: Primitive, + val p54: Primitive, + val p55: Primitive, + val p56: Primitive, + val p57: Primitive, + val p58: Primitive, + val p59: Primitive, + val p60: Primitive, + val p61: Primitive, + val p62: Primitive, + val p63: Primitive + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: Primitive, + q01: Primitive, + q02: Primitive, + q03: Primitive, + q04: Primitive, + q05: Primitive, + q06: Primitive, + q07: Primitive, + q08: Primitive, + q09: Primitive, + q10: Primitive, + q11: Primitive, + q12: Primitive, + q13: Primitive, + q14: Primitive, + q15: Primitive, + q16: Primitive, + q17: Primitive, + q18: Primitive, + q19: Primitive, + q20: Primitive, + q21: Primitive, + q22: Primitive, + q23: Primitive, + q24: Primitive, + q25: Primitive, + q26: Primitive, + q27: Primitive, + q28: Primitive, + q29: Primitive, + q30: Primitive, + q31: Primitive, + q32: Primitive, + q33: Primitive, + q34: Primitive, + q35: Primitive, + q36: Primitive, + q37: Primitive, + q38: Primitive, + q39: Primitive, + q40: Primitive, + q41: Primitive, + q42: Primitive, + q43: Primitive, + q44: Primitive, + q45: Primitive, + q46: Primitive, + q47: Primitive, + q48: Primitive, + q49: Primitive, + q50: Primitive, + q51: Primitive, + q52: Primitive, + q53: Primitive, + q54: Primitive, + q55: Primitive, + q56: Primitive, + q57: Primitive, + q58: Primitive, + q59: Primitive, + q60: Primitive, + q61: Primitive, + q62: Primitive, + q63: Primitive + ) = Dst64( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32, + q33, + q34, + q35, + q36, + q37, + q38, + q39, + q40, + q41, + q42, + q43, + q44, + q45, + q46, + q47, + q48, + q49, + q50, + q51, + q52, + q53, + q54, + q55, + q56, + q57, + q58, + q59, + q60, + q61, + q62, + q63 + ) + } + } + + @Test + fun test64() { + val expected = callPrimaryConstructor { Primitive(it.index) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertEquals(expected, defaultMapper.readValue(src)) + } + + data class Dst65( + val p00: Primitive, + val p01: Primitive, + val p02: Primitive, + val p03: Primitive, + val p04: Primitive, + val p05: Primitive, + val p06: Primitive, + val p07: Primitive, + val p08: Primitive, + val p09: Primitive, + val p10: Primitive, + val p11: Primitive, + val p12: Primitive, + val p13: Primitive, + val p14: Primitive, + val p15: Primitive, + val p16: Primitive, + val p17: Primitive, + val p18: Primitive, + val p19: Primitive, + val p20: Primitive, + val p21: Primitive, + val p22: Primitive, + val p23: Primitive, + val p24: Primitive, + val p25: Primitive, + val p26: Primitive, + val p27: Primitive, + val p28: Primitive, + val p29: Primitive, + val p30: Primitive, + val p31: Primitive, + val p32: Primitive, + val p33: Primitive, + val p34: Primitive, + val p35: Primitive, + val p36: Primitive, + val p37: Primitive, + val p38: Primitive, + val p39: Primitive, + val p40: Primitive, + val p41: Primitive, + val p42: Primitive, + val p43: Primitive, + val p44: Primitive, + val p45: Primitive, + val p46: Primitive, + val p47: Primitive, + val p48: Primitive, + val p49: Primitive, + val p50: Primitive, + val p51: Primitive, + val p52: Primitive, + val p53: Primitive, + val p54: Primitive, + val p55: Primitive, + val p56: Primitive, + val p57: Primitive, + val p58: Primitive, + val p59: Primitive, + val p60: Primitive, + val p61: Primitive, + val p62: Primitive, + val p63: Primitive, + val p64: Primitive + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q00: Primitive, + q01: Primitive, + q02: Primitive, + q03: Primitive, + q04: Primitive, + q05: Primitive, + q06: Primitive, + q07: Primitive, + q08: Primitive, + q09: Primitive, + q10: Primitive, + q11: Primitive, + q12: Primitive, + q13: Primitive, + q14: Primitive, + q15: Primitive, + q16: Primitive, + q17: Primitive, + q18: Primitive, + q19: Primitive, + q20: Primitive, + q21: Primitive, + q22: Primitive, + q23: Primitive, + q24: Primitive, + q25: Primitive, + q26: Primitive, + q27: Primitive, + q28: Primitive, + q29: Primitive, + q30: Primitive, + q31: Primitive, + q32: Primitive, + q33: Primitive, + q34: Primitive, + q35: Primitive, + q36: Primitive, + q37: Primitive, + q38: Primitive, + q39: Primitive, + q40: Primitive, + q41: Primitive, + q42: Primitive, + q43: Primitive, + q44: Primitive, + q45: Primitive, + q46: Primitive, + q47: Primitive, + q48: Primitive, + q49: Primitive, + q50: Primitive, + q51: Primitive, + q52: Primitive, + q53: Primitive, + q54: Primitive, + q55: Primitive, + q56: Primitive, + q57: Primitive, + q58: Primitive, + q59: Primitive, + q60: Primitive, + q61: Primitive, + q62: Primitive, + q63: Primitive, + q64: Primitive + ) = Dst65( + q00, + q01, + q02, + q03, + q04, + q05, + q06, + q07, + q08, + q09, + q10, + q11, + q12, + q13, + q14, + q15, + q16, + q17, + q18, + q19, + q20, + q21, + q22, + q23, + q24, + q25, + q26, + q27, + q28, + q29, + q30, + q31, + q32, + q33, + q34, + q35, + q36, + q37, + q38, + q39, + q40, + q41, + q42, + q43, + q44, + q45, + q46, + q47, + q48, + q49, + q50, + q51, + q52, + q53, + q54, + q55, + q56, + q57, + q58, + q59, + q60, + q61, + q62, + q63, + q64 + ) + } + } + + @Test + fun test65() { + val expected = callPrimaryConstructor { Primitive(it.index) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertEquals(expected, defaultMapper.readValue(src)) + } + + // It cannot be a data class because the generated method would exceed the argument size limit. + class DstMax( + val p000: Primitive, + val p001: Primitive, + val p002: Primitive, + val p003: Primitive, + val p004: Primitive, + val p005: Primitive, + val p006: Primitive, + val p007: Primitive, + val p008: Primitive, + val p009: Primitive, + val p010: Primitive, + val p011: Primitive, + val p012: Primitive, + val p013: Primitive, + val p014: Primitive, + val p015: Primitive, + val p016: Primitive, + val p017: Primitive, + val p018: Primitive, + val p019: Primitive, + val p020: Primitive, + val p021: Primitive, + val p022: Primitive, + val p023: Primitive, + val p024: Primitive, + val p025: Primitive, + val p026: Primitive, + val p027: Primitive, + val p028: Primitive, + val p029: Primitive, + val p030: Primitive, + val p031: Primitive, + val p032: Primitive, + val p033: Primitive, + val p034: Primitive, + val p035: Primitive, + val p036: Primitive, + val p037: Primitive, + val p038: Primitive, + val p039: Primitive, + val p040: Primitive, + val p041: Primitive, + val p042: Primitive, + val p043: Primitive, + val p044: Primitive, + val p045: Primitive, + val p046: Primitive, + val p047: Primitive, + val p048: Primitive, + val p049: Primitive, + val p050: Primitive, + val p051: Primitive, + val p052: Primitive, + val p053: Primitive, + val p054: Primitive, + val p055: Primitive, + val p056: Primitive, + val p057: Primitive, + val p058: Primitive, + val p059: Primitive, + val p060: Primitive, + val p061: Primitive, + val p062: Primitive, + val p063: Primitive, + val p064: Primitive, + val p065: Primitive, + val p066: Primitive, + val p067: Primitive, + val p068: Primitive, + val p069: Primitive, + val p070: Primitive, + val p071: Primitive, + val p072: Primitive, + val p073: Primitive, + val p074: Primitive, + val p075: Primitive, + val p076: Primitive, + val p077: Primitive, + val p078: Primitive, + val p079: Primitive, + val p080: Primitive, + val p081: Primitive, + val p082: Primitive, + val p083: Primitive, + val p084: Primitive, + val p085: Primitive, + val p086: Primitive, + val p087: Primitive, + val p088: Primitive, + val p089: Primitive, + val p090: Primitive, + val p091: Primitive, + val p092: Primitive, + val p093: Primitive, + val p094: Primitive, + val p095: Primitive, + val p096: Primitive, + val p097: Primitive, + val p098: Primitive, + val p099: Primitive, + val p100: Primitive, + val p101: Primitive, + val p102: Primitive, + val p103: Primitive, + val p104: Primitive, + val p105: Primitive, + val p106: Primitive, + val p107: Primitive, + val p108: Primitive, + val p109: Primitive, + val p110: Primitive, + val p111: Primitive, + val p112: Primitive, + val p113: Primitive, + val p114: Primitive, + val p115: Primitive, + val p116: Primitive, + val p117: Primitive, + val p118: Primitive, + val p119: Primitive, + val p120: Primitive, + val p121: Primitive, + val p122: Primitive, + val p123: Primitive, + val p124: Primitive, + val p125: Primitive, + val p126: Primitive, + val p127: Primitive, + val p128: Primitive, + val p129: Primitive, + val p130: Primitive, + val p131: Primitive, + val p132: Primitive, + val p133: Primitive, + val p134: Primitive, + val p135: Primitive, + val p136: Primitive, + val p137: Primitive, + val p138: Primitive, + val p139: Primitive, + val p140: Primitive, + val p141: Primitive, + val p142: Primitive, + val p143: Primitive, + val p144: Primitive, + val p145: Primitive, + val p146: Primitive, + val p147: Primitive, + val p148: Primitive, + val p149: Primitive, + val p150: Primitive, + val p151: Primitive, + val p152: Primitive, + val p153: Primitive, + val p154: Primitive, + val p155: Primitive, + val p156: Primitive, + val p157: Primitive, + val p158: Primitive, + val p159: Primitive, + val p160: Primitive, + val p161: Primitive, + val p162: Primitive, + val p163: Primitive, + val p164: Primitive, + val p165: Primitive, + val p166: Primitive, + val p167: Primitive, + val p168: Primitive, + val p169: Primitive, + val p170: Primitive, + val p171: Primitive, + val p172: Primitive, + val p173: Primitive, + val p174: Primitive, + val p175: Primitive, + val p176: Primitive, + val p177: Primitive, + val p178: Primitive, + val p179: Primitive, + val p180: Primitive, + val p181: Primitive, + val p182: Primitive, + val p183: Primitive, + val p184: Primitive, + val p185: Primitive, + val p186: Primitive, + val p187: Primitive, + val p188: Primitive, + val p189: Primitive, + val p190: Primitive, + val p191: Primitive, + val p192: Primitive, + val p193: Primitive, + val p194: Primitive, + val p195: Primitive, + val p196: Primitive, + val p197: Primitive, + val p198: Primitive, + val p199: Primitive, + val p200: Primitive, + val p201: Primitive, + val p202: Primitive, + val p203: Primitive, + val p204: Primitive, + val p205: Primitive, + val p206: Primitive, + val p207: Primitive, + val p208: Primitive, + val p209: Primitive, + val p210: Primitive, + val p211: Primitive, + val p212: Primitive, + val p213: Primitive, + val p214: Primitive, + val p215: Primitive, + val p216: Primitive, + val p217: Primitive, + val p218: Primitive, + val p219: Primitive, + val p220: Primitive, + val p221: Primitive, + val p222: Primitive, + val p223: Primitive, + val p224: Primitive, + val p225: Primitive, + val p226: Primitive, + val p227: Primitive, + val p228: Primitive, + val p229: Primitive, + val p230: Primitive, + val p231: Primitive, + val p232: Primitive, + val p233: Primitive, + val p234: Primitive, + val p235: Primitive, + val p236: Primitive, + val p237: Primitive, + val p238: Primitive, + val p239: Primitive, + val p240: Primitive, + val p241: Primitive, + val p242: Primitive, + val p243: Primitive, + val p244: Primitive, + val p245: Primitive, + val p246: Primitive, + val p247: Primitive, + val p248: Primitive, + val p249: Primitive, + val p250: Primitive, + val p251: Primitive, + val p252: Primitive + ) { + companion object { + @JvmStatic + @JsonCreator + fun creator( + q000: Primitive, + q001: Primitive, + q002: Primitive, + q003: Primitive, + q004: Primitive, + q005: Primitive, + q006: Primitive, + q007: Primitive, + q008: Primitive, + q009: Primitive, + q010: Primitive, + q011: Primitive, + q012: Primitive, + q013: Primitive, + q014: Primitive, + q015: Primitive, + q016: Primitive, + q017: Primitive, + q018: Primitive, + q019: Primitive, + q020: Primitive, + q021: Primitive, + q022: Primitive, + q023: Primitive, + q024: Primitive, + q025: Primitive, + q026: Primitive, + q027: Primitive, + q028: Primitive, + q029: Primitive, + q030: Primitive, + q031: Primitive, + q032: Primitive, + q033: Primitive, + q034: Primitive, + q035: Primitive, + q036: Primitive, + q037: Primitive, + q038: Primitive, + q039: Primitive, + q040: Primitive, + q041: Primitive, + q042: Primitive, + q043: Primitive, + q044: Primitive, + q045: Primitive, + q046: Primitive, + q047: Primitive, + q048: Primitive, + q049: Primitive, + q050: Primitive, + q051: Primitive, + q052: Primitive, + q053: Primitive, + q054: Primitive, + q055: Primitive, + q056: Primitive, + q057: Primitive, + q058: Primitive, + q059: Primitive, + q060: Primitive, + q061: Primitive, + q062: Primitive, + q063: Primitive, + q064: Primitive, + q065: Primitive, + q066: Primitive, + q067: Primitive, + q068: Primitive, + q069: Primitive, + q070: Primitive, + q071: Primitive, + q072: Primitive, + q073: Primitive, + q074: Primitive, + q075: Primitive, + q076: Primitive, + q077: Primitive, + q078: Primitive, + q079: Primitive, + q080: Primitive, + q081: Primitive, + q082: Primitive, + q083: Primitive, + q084: Primitive, + q085: Primitive, + q086: Primitive, + q087: Primitive, + q088: Primitive, + q089: Primitive, + q090: Primitive, + q091: Primitive, + q092: Primitive, + q093: Primitive, + q094: Primitive, + q095: Primitive, + q096: Primitive, + q097: Primitive, + q098: Primitive, + q099: Primitive, + q100: Primitive, + q101: Primitive, + q102: Primitive, + q103: Primitive, + q104: Primitive, + q105: Primitive, + q106: Primitive, + q107: Primitive, + q108: Primitive, + q109: Primitive, + q110: Primitive, + q111: Primitive, + q112: Primitive, + q113: Primitive, + q114: Primitive, + q115: Primitive, + q116: Primitive, + q117: Primitive, + q118: Primitive, + q119: Primitive, + q120: Primitive, + q121: Primitive, + q122: Primitive, + q123: Primitive, + q124: Primitive, + q125: Primitive, + q126: Primitive, + q127: Primitive, + q128: Primitive, + q129: Primitive, + q130: Primitive, + q131: Primitive, + q132: Primitive, + q133: Primitive, + q134: Primitive, + q135: Primitive, + q136: Primitive, + q137: Primitive, + q138: Primitive, + q139: Primitive, + q140: Primitive, + q141: Primitive, + q142: Primitive, + q143: Primitive, + q144: Primitive, + q145: Primitive, + q146: Primitive, + q147: Primitive, + q148: Primitive, + q149: Primitive, + q150: Primitive, + q151: Primitive, + q152: Primitive, + q153: Primitive, + q154: Primitive, + q155: Primitive, + q156: Primitive, + q157: Primitive, + q158: Primitive, + q159: Primitive, + q160: Primitive, + q161: Primitive, + q162: Primitive, + q163: Primitive, + q164: Primitive, + q165: Primitive, + q166: Primitive, + q167: Primitive, + q168: Primitive, + q169: Primitive, + q170: Primitive, + q171: Primitive, + q172: Primitive, + q173: Primitive, + q174: Primitive, + q175: Primitive, + q176: Primitive, + q177: Primitive, + q178: Primitive, + q179: Primitive, + q180: Primitive, + q181: Primitive, + q182: Primitive, + q183: Primitive, + q184: Primitive, + q185: Primitive, + q186: Primitive, + q187: Primitive, + q188: Primitive, + q189: Primitive, + q190: Primitive, + q191: Primitive, + q192: Primitive, + q193: Primitive, + q194: Primitive, + q195: Primitive, + q196: Primitive, + q197: Primitive, + q198: Primitive, + q199: Primitive, + q200: Primitive, + q201: Primitive, + q202: Primitive, + q203: Primitive, + q204: Primitive, + q205: Primitive, + q206: Primitive, + q207: Primitive, + q208: Primitive, + q209: Primitive, + q210: Primitive, + q211: Primitive, + q212: Primitive, + q213: Primitive, + q214: Primitive, + q215: Primitive, + q216: Primitive, + q217: Primitive, + q218: Primitive, + q219: Primitive, + q220: Primitive, + q221: Primitive, + q222: Primitive, + q223: Primitive, + q224: Primitive, + q225: Primitive, + q226: Primitive, + q227: Primitive, + q228: Primitive, + q229: Primitive, + q230: Primitive, + q231: Primitive, + q232: Primitive, + q233: Primitive, + q234: Primitive, + q235: Primitive, + q236: Primitive, + q237: Primitive, + q238: Primitive, + q239: Primitive, + q240: Primitive, + q241: Primitive, + q242: Primitive, + q243: Primitive, + q244: Primitive, + q245: Primitive, + q246: Primitive, + q247: Primitive, + q248: Primitive, + q249: Primitive, + q250: Primitive, + q251: Primitive, + q252: Primitive + ) = DstMax( + q000, + q001, + q002, + q003, + q004, + q005, + q006, + q007, + q008, + q009, + q010, + q011, + q012, + q013, + q014, + q015, + q016, + q017, + q018, + q019, + q020, + q021, + q022, + q023, + q024, + q025, + q026, + q027, + q028, + q029, + q030, + q031, + q032, + q033, + q034, + q035, + q036, + q037, + q038, + q039, + q040, + q041, + q042, + q043, + q044, + q045, + q046, + q047, + q048, + q049, + q050, + q051, + q052, + q053, + q054, + q055, + q056, + q057, + q058, + q059, + q060, + q061, + q062, + q063, + q064, + q065, + q066, + q067, + q068, + q069, + q070, + q071, + q072, + q073, + q074, + q075, + q076, + q077, + q078, + q079, + q080, + q081, + q082, + q083, + q084, + q085, + q086, + q087, + q088, + q089, + q090, + q091, + q092, + q093, + q094, + q095, + q096, + q097, + q098, + q099, + q100, + q101, + q102, + q103, + q104, + q105, + q106, + q107, + q108, + q109, + q110, + q111, + q112, + q113, + q114, + q115, + q116, + q117, + q118, + q119, + q120, + q121, + q122, + q123, + q124, + q125, + q126, + q127, + q128, + q129, + q130, + q131, + q132, + q133, + q134, + q135, + q136, + q137, + q138, + q139, + q140, + q141, + q142, + q143, + q144, + q145, + q146, + q147, + q148, + q149, + q150, + q151, + q152, + q153, + q154, + q155, + q156, + q157, + q158, + q159, + q160, + q161, + q162, + q163, + q164, + q165, + q166, + q167, + q168, + q169, + q170, + q171, + q172, + q173, + q174, + q175, + q176, + q177, + q178, + q179, + q180, + q181, + q182, + q183, + q184, + q185, + q186, + q187, + q188, + q189, + q190, + q191, + q192, + q193, + q194, + q195, + q196, + q197, + q198, + q199, + q200, + q201, + q202, + q203, + q204, + q205, + q206, + q207, + q208, + q209, + q210, + q211, + q212, + q213, + q214, + q215, + q216, + q217, + q218, + q219, + q220, + q221, + q222, + q223, + q224, + q225, + q226, + q227, + q228, + q229, + q230, + q231, + q232, + q233, + q234, + q235, + q236, + q237, + q238, + q239, + q240, + q241, + q242, + q243, + q244, + q245, + q246, + q247, + q248, + q249, + q250, + q251, + q252 + ) + } + } + + @Test + fun testMax() { + val expected = callPrimaryConstructor { Primitive(it.index) } + val src = replacePQ(defaultMapper.writeValueAsString(expected)) + assertReflectEquals(expected, defaultMapper.readValue(src)) + } +} From e5a1ee8b7dab74956f88b49a2983eee45de01032 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Mon, 12 Feb 2024 14:10:46 +0900 Subject: [PATCH 15/20] Update release notes wrt #768 --- release-notes/CREDITS-2.x | 1 + release-notes/VERSION-2.x | 1 + 2 files changed, 2 insertions(+) diff --git a/release-notes/CREDITS-2.x b/release-notes/CREDITS-2.x index 87c27a6f..e6e11ff8 100644 --- a/release-notes/CREDITS-2.x +++ b/release-notes/CREDITS-2.x @@ -18,6 +18,7 @@ Contributors: # 2.17.0 (not yet released) WrongWrong (@k163377) +* #768: Added value class deserialization support. * #763: Minor refactoring to support value class in deserialization. * #760: Improved processing related to parameter parsing on Kotlin. * #759: Organize internal commons. diff --git a/release-notes/VERSION-2.x b/release-notes/VERSION-2.x index 8fa4a95b..00ac4d05 100644 --- a/release-notes/VERSION-2.x +++ b/release-notes/VERSION-2.x @@ -18,6 +18,7 @@ Co-maintainers: 2.17.0 (not yet released) +#768: Added value class deserialization support. #760: Caching is now applied to the entire parameter parsing process on Kotlin. #758: Deprecated SingletonSupport and related properties to be consistent with KotlinFeature.SingletonSupport. #755: Changes in constructor invocation and argument management. From 7137309c8736fad95b3b6e4bdb4ded8e00bfc03e Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sat, 17 Feb 2024 23:09:59 +0900 Subject: [PATCH 16/20] Added edge case support in deserialization Content I forgot to port. At the same time, commonization with existing was done. --- .../jackson/module/kotlin/InternalCommons.kt | 7 +++++++ .../module/kotlin/KotlinAnnotationIntrospector.kt | 11 +---------- .../module/kotlin/KotlinValueInstantiator.kt | 15 +++++++++++++++ 3 files changed, 23 insertions(+), 10 deletions(-) diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/InternalCommons.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/InternalCommons.kt index 04c22abd..485ae263 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/InternalCommons.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/InternalCommons.kt @@ -4,7 +4,10 @@ import com.fasterxml.jackson.annotation.JsonCreator import com.fasterxml.jackson.databind.JsonMappingException import java.lang.reflect.AnnotatedElement import java.util.* +import kotlin.reflect.KClass import kotlin.reflect.KType +import kotlin.reflect.full.memberProperties +import kotlin.reflect.jvm.javaField import kotlin.reflect.jvm.jvmErasure internal val defaultConstructorMarker: Class<*> by lazy { @@ -39,3 +42,7 @@ internal fun KType.erasedType(): Class = this.jvmErasure.java internal fun AnnotatedElement.hasCreatorAnnotation(): Boolean = getAnnotation(JsonCreator::class.java) ?.let { it.mode != JsonCreator.Mode.DISABLED } ?: false + +// Determine if the unbox result of value class is nullable +internal fun KClass<*>.wrapsNullable(): Boolean = + this.memberProperties.first { it.javaField != null }.returnType.isMarkedNullable diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinAnnotationIntrospector.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinAnnotationIntrospector.kt index 0fa688d9..4897517a 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinAnnotationIntrospector.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinAnnotationIntrospector.kt @@ -8,10 +8,8 @@ import com.fasterxml.jackson.databind.introspect.* import com.fasterxml.jackson.databind.jsontype.NamedType import com.fasterxml.jackson.databind.util.Converter import java.lang.reflect.AccessibleObject -import java.lang.reflect.Constructor import java.lang.reflect.Field import java.lang.reflect.Method -import kotlin.reflect.KClass import kotlin.reflect.KFunction import kotlin.reflect.KMutableProperty1 import kotlin.reflect.KParameter @@ -19,9 +17,7 @@ import kotlin.reflect.KProperty1 import kotlin.reflect.KType import kotlin.reflect.full.createType import kotlin.reflect.full.declaredMemberProperties -import kotlin.reflect.full.memberProperties import kotlin.reflect.full.valueParameters -import kotlin.reflect.jvm.javaField import kotlin.reflect.jvm.javaGetter import kotlin.reflect.jvm.javaSetter import kotlin.reflect.jvm.javaType @@ -83,16 +79,11 @@ internal class KotlinAnnotationIntrospector( else -> null } - // Determine if the unbox result of value class is nullAable - // @see findNullSerializer - private fun KClass<*>.requireRebox(): Boolean = - this.memberProperties.first { it.javaField != null }.returnType.isMarkedNullable - // Perform proper serialization even if the value wrapped by the value class is null. // If value is a non-null object type, it must not be reboxing. override fun findNullSerializer(am: Annotated): JsonSerializer<*>? = (am as? AnnotatedMethod) ?.findValueClassReturnType() - ?.takeIf { it.requireRebox() } + ?.takeIf { it.wrapsNullable() } ?.let { cache.getValueClassBoxConverter(am.rawReturnType, it).delegatingSerializer } override fun findDeserializationConverter(a: Annotated): Any? { diff --git a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinValueInstantiator.kt b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinValueInstantiator.kt index 899d2484..54e4cce3 100644 --- a/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinValueInstantiator.kt +++ b/src/main/kotlin/com/fasterxml/jackson/module/kotlin/KotlinValueInstantiator.kt @@ -32,6 +32,15 @@ internal class KotlinValueInstantiator( private fun List.markedNonNullAt(index: Int) = getOrNull(index)?.type?.isMarkedNullable == false + // If the argument is a value class that wraps nullable and non-null, + // and the input is explicit null, the value class is instantiated with null as input. + private fun requireValueClassSpecialNullValue( + isNullableParam: Boolean, + valueDeserializer: JsonDeserializer<*>? + ): Boolean = !isNullableParam && + valueDeserializer is WrapsNullableValueClassDeserializer<*> && + valueDeserializer.handledType().kotlin.wrapsNullable() + private fun SettableBeanProperty.skipNulls(): Boolean = nullIsSameAsDefault || (metadata.valueNulls == Nulls.SKIP) @@ -53,6 +62,12 @@ internal class KotlinValueInstantiator( val paramType = paramDef.type var paramVal = if (!isMissing || jsonProp.hasInjectableValueId()) { buffer.getParameter(jsonProp) ?: run { + // Deserializer.getNullValue could not be used because there is no way to get and parse parameters + // from the BeanDescription and using AnnotationIntrospector would override user customization. + if (requireValueClassSpecialNullValue(paramDef.type.isMarkedNullable, valueDeserializer)) { + (valueDeserializer as WrapsNullableValueClassDeserializer<*>).boxedNullValue?.let { return@run it } + } + if (jsonProp.skipNulls() && paramDef.isOptional) return@forEachIndexed null From 45c7f48c09ff2bcc12d68a5b5714b9d2393b21e8 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sat, 17 Feb 2024 23:19:25 +0900 Subject: [PATCH 17/20] Fixed an issue where tests were not running properly When Enclosed was specified, tests directly under the class were not executed --- .../WithoutCustomDeserializeMethodTest.kt | 84 +++++++++-------- .../SpecifiedForObjectMapperTest.kt | 91 ++++++++++--------- .../specifiedForProperty/NonNullObjectTest.kt | 14 +-- .../NullableObjectTest.kt | 14 +-- .../specifiedForProperty/PrimitiveTest.kt | 14 +-- 5 files changed, 115 insertions(+), 102 deletions(-) diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/WithoutCustomDeserializeMethodTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/WithoutCustomDeserializeMethodTest.kt index 05998a44..79c6a339 100644 --- a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/WithoutCustomDeserializeMethodTest.kt +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/WithoutCustomDeserializeMethodTest.kt @@ -51,6 +51,22 @@ class WithoutCustomDeserializeMethodTest { } } } + + @Ignore + @JvmInline + value class HasCheckConstructor(val value: Int) { + init { + if (value < 0) throw throwable + } + } + + @Test + fun callConstructorCheckTest() { + val e = assertThrows(InvocationTargetException::class.java) { + defaultMapper.readValue("-1") + } + assertTrue(e.cause === throwable) + } } @Ignore @@ -63,51 +79,39 @@ class WithoutCustomDeserializeMethodTest { val noN: NullableObject? ) - @Test - fun withoutNull() { - val expected = Dst( - Primitive(1), - Primitive(2), - NonNullObject("foo"), - NonNullObject("bar"), - NullableObject("baz"), - NullableObject("qux") - ) - val src = mapper.writeValueAsString(expected) - val result = mapper.readValue(src) - - assertEquals(expected, result) - } + class InParameterDeserialize { + @Test + fun withoutNull() { + val expected = Dst( + Primitive(1), + Primitive(2), + NonNullObject("foo"), + NonNullObject("bar"), + NullableObject("baz"), + NullableObject("qux") + ) + val src = mapper.writeValueAsString(expected) + val result = mapper.readValue(src) - @Test - fun withNull() { - val expected = Dst( - Primitive(1), - null, - NonNullObject("foo"), - null, - NullableObject(null), - null - ) - val src = mapper.writeValueAsString(expected) - val result = mapper.readValue(src) + assertEquals(expected, result) + } - assertEquals(expected, result) - } + @Test + fun withNull() { + val expected = Dst( + Primitive(1), + null, + NonNullObject("foo"), + null, + NullableObject(null), + null + ) + val src = mapper.writeValueAsString(expected) + val result = mapper.readValue(src) - @Ignore - @JvmInline - value class HasCheckConstructor(val value: Int) { - init { - if (value < 0) throw throwable + assertEquals(expected, result) } } - @Test - fun callConstructorCheckTest() { - val e = assertThrows(InvocationTargetException::class.java) { defaultMapper.readValue("-1") } - assertTrue(e.cause === throwable) - } - // If all JsonCreator tests are OK, no need to check throws from factory functions. } diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/SpecifiedForObjectMapperTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/SpecifiedForObjectMapperTest.kt index a71373d3..c56c75c2 100644 --- a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/SpecifiedForObjectMapperTest.kt +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/SpecifiedForObjectMapperTest.kt @@ -40,7 +40,8 @@ class SpecifiedForObjectMapperTest { assertEquals(NonNullObject("foo-deser"), result) } - @Suppress("ClassName")class NullableObject_ { + @Suppress("ClassName") + class NullableObject_ { @Test fun value() { val result = mapper.readValue(""""foo"""") @@ -69,51 +70,53 @@ class SpecifiedForObjectMapperTest { val noN: NullableObject? ) - @Test - fun nonNull() { - val base = Dst( - Primitive(1), - Primitive(2), - NonNullObject("foo"), - NonNullObject("bar"), - NullableObject("baz"), - NullableObject("qux") - ) - val src = mapper.writeValueAsString(base) - val result = mapper.readValue(src) + class InParameterDeserialize { + @Test + fun nonNull() { + val base = Dst( + Primitive(1), + Primitive(2), + NonNullObject("foo"), + NonNullObject("bar"), + NullableObject("baz"), + NullableObject("qux") + ) + val src = mapper.writeValueAsString(base) + val result = mapper.readValue(src) - val expected = Dst( - Primitive(101), - Primitive(102), - NonNullObject("foo-deser"), - NonNullObject("bar-deser"), - NullableObject("baz-deser"), - NullableObject("qux-deser") - ) - assertEquals(expected, result) - } + val expected = Dst( + Primitive(101), + Primitive(102), + NonNullObject("foo-deser"), + NonNullObject("bar-deser"), + NullableObject("baz-deser"), + NullableObject("qux-deser") + ) + assertEquals(expected, result) + } - @Test - fun withNull() { - val base = Dst( - Primitive(1), - null, - NonNullObject("foo"), - null, - NullableObject(null), - null - ) - val src = mapper.writeValueAsString(base) - val result = mapper.readValue(src) + @Test + fun withNull() { + val base = Dst( + Primitive(1), + null, + NonNullObject("foo"), + null, + NullableObject(null), + null + ) + val src = mapper.writeValueAsString(base) + val result = mapper.readValue(src) - val expected = Dst( - Primitive(101), - null, - NonNullObject("foo-deser"), - null, - NullableObject("null-value-deser"), - null - ) - assertEquals(expected, result) + val expected = Dst( + Primitive(101), + null, + NonNullObject("foo-deser"), + null, + NullableObject("null-value-deser"), + null + ) + assertEquals(expected, result) + } } } diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NonNullObjectTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NonNullObjectTest.kt index 15b3c22e..5cc39541 100644 --- a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NonNullObjectTest.kt +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NonNullObjectTest.kt @@ -25,17 +25,19 @@ class NonNullObjectTest { val fieldAnn: NonNullObject ) - @Test - fun nonNull() { - val result = mapper.readValue( - """ + class NonNullTest { + @Test + fun nonNull() { + val result = mapper.readValue( + """ { "getterAnn" : "foo", "fieldAnn" : "bar" } """.trimIndent() - ) - assertEquals(NonNull(NonNullObject("foo-deser"), NonNullObject("bar-deser")), result) + ) + assertEquals(NonNull(NonNullObject("foo-deser"), NonNullObject("bar-deser")), result) + } } @Ignore diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NullableObjectTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NullableObjectTest.kt index 68d90c65..b9319f93 100644 --- a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NullableObjectTest.kt +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/NullableObjectTest.kt @@ -25,17 +25,19 @@ class NullableObjectTest { val fieldAnn: NullableObject ) - @Test - fun nonNull() { - val result = mapper.readValue( - """ + class NonNullTest { + @Test + fun nonNull() { + val result = mapper.readValue( + """ { "getterAnn" : "foo", "fieldAnn" : "bar" } """.trimIndent() - ) - assertEquals(NonNull(NullableObject("foo-deser"), NullableObject("bar-deser")), result) + ) + assertEquals(NonNull(NullableObject("foo-deser"), NullableObject("bar-deser")), result) + } } @Ignore diff --git a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/PrimitiveTest.kt b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/PrimitiveTest.kt index ff72abec..7cdc31b8 100644 --- a/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/PrimitiveTest.kt +++ b/src/test/kotlin/com/fasterxml/jackson/module/kotlin/kogeraIntegration/deser/valueClass/deserializer/byAnnotation/specifiedForProperty/PrimitiveTest.kt @@ -25,17 +25,19 @@ class PrimitiveTest { val fieldAnn: Primitive ) - @Test - fun nonNull() { - val result = mapper.readValue( - """ + class NonNullTest { + @Test + fun nonNull() { + val result = mapper.readValue( + """ { "getterAnn" : 1, "fieldAnn" : 2 } """.trimIndent() - ) - assertEquals(NonNull(Primitive(101), Primitive(102)), result) + ) + assertEquals(NonNull(Primitive(101), Primitive(102)), result) + } } @Ignore From 74934269f385fcf7c1f182e345ccb11b6d91c4e7 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sat, 17 Feb 2024 23:50:54 +0900 Subject: [PATCH 18/20] Added technical documentation on value class handling --- docs/value-class-handling.md | 134 +++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 docs/value-class-handling.md diff --git a/docs/value-class-handling.md b/docs/value-class-handling.md new file mode 100644 index 00000000..13218ed8 --- /dev/null +++ b/docs/value-class-handling.md @@ -0,0 +1,134 @@ +This is a document that summarizes how `value class` is handled in `kotlin-module`. + +# Annotation assigned to a property (parameter) +In `Kotlin`, annotations on properties will be assigned to the parameters of the primary constructor. +On the other hand, if the parameter contains a `value class`, this annotation will not work. +See #651 for details. + +# Serialize +Serialization is performed as follows + +1. If the value is unboxed in the getter of a property, re-box it +2. Serialization is performed by the serializer specified for the class or by the default serializer of `kotlin-module` + +## Re-boxing of value +Re-boxing is handled by `KotlinAnnotationIntrospector#findSerializationConverter`. + +The properties re-boxed here are handled as if the type of the getter was `value class`. +This allows the `JsonSerializer` specified for the mapper, class and property to work. + +### Edge case on `value class` that wraps `null` +If the property is non-null and the `value class` that is the value wraps `null`, +then the value is re-boxed by `KotlinAnnotationIntrospector#findNullSerializer`. +This is the case for serializing `Dto` as follows. + +```kotlin +@JvmInline +value class WrapsNullable(val v: String?) + +data class Dto(val value: WrapsNullable = WrapsNullable(null)) +``` + +In this case, features like the `JsonSerialize` annotation will not work as expected due to the difference in processing paths. + +## Default serializers with `kotlin-module` +Default serializers for boxed values are implemented in `KotlinSerializers`. +There are two types: `ValueClassUnboxSerializer` and `ValueClassSerializer.StaticJsonValue`. + +The former gets the value by unboxing and the latter by executing the method with the `JsonValue` annotation. +The serializer for the retrieved value is then obtained and serialization is performed. + +# Deserialize +Deserialization is performed as follows + +1. Get `KFunction` from a non-synthetic constructor (if the constructor is a creator) +2. If it is unboxed on a parameter, refine it to a boxed type +3. `value class` is deserialized by `Jackson` default handling or by `kotlin-module` deserializer +4. Instantiation is done by calling `KFunction` + +The special `JsonDeserializer`, `WrapsNullableValueClassDeserializer`, is described in the [section on instantiation](#Instantiation). + +## Get `KFunction` from non-synthetic constructor +Constructor with `value class` parameters compiles into a `private` non-synthesized constructor and a synthesized constructor. + +A `KFunction` is inherently interconvertible with any constructor or method in a `Java` reflection. +In the case of a constructor with a `value class` parameter, it is the synthetic constructor that is interconvertible. + +On the other hand, `Jackson` does not handle synthetic constructors. +Therefore, `kotlin-module` needs to get `KFunction` from a `private` non-synthetic constructor. + +This acquisition process is implemented as a `valueClassAwareKotlinFunction` in `ReflectionCache.kt`. + +## Refinement to boxed type +Refinement to a boxed type is handled by `KotlineNamesAnnotationIntrospector#refineDeserializationType`. +Like serialization, the parameters refined here are handled as if the type of the parameter was `value class`. + +This will cause the result of reading from the `PropertyValueBuffer` with `ValueInstantiator#createFromObjectWith` to be the boxed value. + +## Deserialization of `value class` +Deserialization of `value class` may be handled by default by `Jackson` or by `kotlin-module`. + +### by `Jackson` +If a custom `JsonDeserializer` is set or a special `JsonCreator` is defined, +deserialization of the `value class` is handled by `Jackson` just like a normal class. +The special `JsonCreator` is a factory function that is configured to return the `value class` in bytecode. + +The special `JsonCreator` is handled in exactly the same way as a regular class. +That is, it does not have the restrictions that the mode is fixed to `DELEGATING` +or that it cannot have multiple arguments. +This can be defined by setting the return value to `nullable`, for example + +```kotlin +@JvmInline +value class PrimitiveMultiParamCreator(val value: Int) { + companion object { + @JvmStatic + @JsonCreator + fun creator(first: Int, second: Int): PrimitiveMultiParamCreator? = + PrimitiveMultiParamCreator(first + second) + } +} +``` + +### by `kotlin-module` +Deserialization using constructors or factory functions that return unboxed value in bytecode +is handled by the `WrapsNullableValueClassBoxDeserializer` that defined in `KotlinDeserializer.kt`. + +They must always have a parameter size of 1, like `JsonCreator` with `DELEGATING` mode specified. +Note that the `kotlin-module` proprietary implementation raises an `InvalidDefinitionException` +if the parameter size is greater than 2. + +## Instantiation +Instantiation by calling `KFunction` obtained from a constructor or factory function is done with `KotlinValueInstantiator#createFromObjectWith`. + +Boxed values are required as `KFunction` arguments, but since the `value class` is read as a boxed value as described above, +basic processing is performed as in a normal class. +However, there is special processing for the edge case described below. + +### Edge case on `value class` that wraps nullable +If the parameter type is `value class` and non-null, which wraps nullable, and the value on the JSON is null, +the wrapped null is expected to be read as the value. + +```kotlin +@JvmInline +value class WrapsNullable(val value: String?) + +data class Dto(val wrapsNullable: WrapsNullable) + +val mapper = jacksonObjectMapper() + +// serialized: {"wrapsNullable":null} +val json = mapper.writeValueAsString(Dto(WrapsNullable(null))) +// expected: Dto(wrapsNullable=WrapsNullable(value=null)) +val deserialized = mapper.readValue(json) +``` + +In `kotlin-module`, a special `JsonDeserializer` named `WrapsNullableValueClassDeserializer` was introduced to support this. +This deserializer has a `boxedNullValue` property, +which is referenced in `KotlinValueInstantiator#createFromObjectWith` as appropriate. + +I considered implementing it with the traditional `JsonDeserializer#getNullValue`, +but I chose to implement it as a special property because of inconsistencies that could not be resolved +if all cases were covered in detail in the prototype. +Note that this property is referenced by `KotlinValueInstantiator#createFromObjectWith`, +so it will not work when deserializing directly. From 71cc9f6ee158d09424d101356e7bfd37dc6d01bc Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 18 Feb 2024 20:04:40 +0900 Subject: [PATCH 19/20] Added user documentation on use of value class --- docs/value-class-support.md | 160 ++++++++++++++++++++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 docs/value-class-support.md diff --git a/docs/value-class-support.md b/docs/value-class-support.md new file mode 100644 index 00000000..a42786c6 --- /dev/null +++ b/docs/value-class-support.md @@ -0,0 +1,160 @@ +`jackson-module-kotlin` supports many use cases of `value class` (`inline class`). +This page summarizes the basic policy and points to note regarding the use of the `value class`. + +For technical details on `value class` handling, please see [here](./value-class-handling.md). + +# Note on the use of `value class` +`jackson-module-kotlin` supports the `value class` for many common use cases, both serialization and deserialization. +However, full compatibility with normal classes (e.g. `data class`) is not achieved. +In particular, there are many edge cases for the `value class` that wraps nullable. + +The cause of this difference is that the `value class` itself and the functions that use the `value class` are +compiled into bytecodes that differ significantly from the normal classes. +Due to this difference, some cases cannot be handled by basic `Jackson` parsing, which assumes `Java`. +Known issues related to `value class` can be found [here](https://github.com/FasterXML/jackson-module-kotlin/issues?q=is%3Aissue+is%3Aopen+label%3A%22value+class%22). + +In addition, one of the features of the `value class` is improved performance, +but when using `Jackson` (not only `Jackson`, but also other libraries that use reflection), +the performance is rather reduced. +This can be confirmed from [kogera-benchmark](https://github.com/ProjectMapK/kogera-benchmark?tab=readme-ov-file#comparison-of-normal-class-and-value-class). + +For these reasons, we recommend careful consideration when using `value class`. + +# Basic handling of `value class` +A `value class` is basically treated like a value. + +For example, the serialization of `value class` is as follows + +```kotlin +@JvmInline +value class Value(val value: Int) + +val mapper = jacksonObjectMapper() +mapper.writeValueAsString(Value(1)) // -> 1 +``` + +This is different from the `data class` serialization result. + +```kotlin +data class Data(val value: Int) + +mapper.writeValueAsString(Data(1)) // -> {"value":1} +``` + +The same policy applies to deserialization. + +This policy was decided with reference to the behavior as of `jackson-module-kotlin 2.14.1` and [kotlinx-serialization](https://github.com/Kotlin/kotlinx.serialization/blob/master/docs/value-classes.md#serializable-value-classes). +However, these are just basic policies, and the behavior can be overridden with `JsonSerializer` or `JsonDeserializer`. + +# Notes on customization +As noted above, the content associated with the `value class` is not fully compatible with the normal class. +Here is a summary of the customization considerations for such contents. + +## Annotation +Annotations assigned to parameters in a primary constructor that contains `value class` as a parameter will not work. +It must be assigned to a field or getter. + +```kotlin +data class Dto( + @JsonProperty("vc") // does not work + val p1: ValueClass, + @field:JsonProperty("vc") // does work + val p2: ValueClass +) +``` + +See #651 for details. + +## On serialize +### JsonValue +The `JsonValue` annotation is supported. + +```kotlin +@JvmInline +value class ValueClass(val value: UUID) { + @get:JsonValue + val jsonValue get() = value.toString().filter { it != '-' } +} + +// -> "e5541a61ac934eff93516eec0f42221e" +mapper.writeValueAsString(ValueClass(UUID.randomUUID())) +``` + +### JsonSerializer +The `JsonSerializer` basically supports the following methods: +registering to `ObjectMapper`, giving the `JsonSerialize` annotation. +Also, although `value class` is basically serialized as a value, +but it is possible to serialize `value class` like an object by using `JsonSerializer`. + +```kotlin +@JvmInline +value class ValueClass(val value: UUID) + +class Serializer : StdSerializer(ValueClass::class.java) { + override fun serialize(value: ValueClass, gen: JsonGenerator, provider: SerializerProvider) { + val uuid = value.value + val obj = mapOf( + "mostSignificantBits" to uuid.mostSignificantBits, + "leastSignificantBits" to uuid.leastSignificantBits + ) + + gen.writeObject(obj) + } +} + +data class Dto( + @field:JsonSerialize(using = Serializer::class) + val value: ValueClass +) + +// -> {"value":{"mostSignificantBits":-6594847211741032479,"leastSignificantBits":-5053830536872902344}} +mapper.writeValueAsString(Dto(ValueClass(UUID.randomUUID()))) +``` + +Note that specification with the `JsonSerialize` annotation will not work +if the `value class` wraps null and the property definition is non-null. + +## On deserialize +### JsonDeserializer +Like `JsonSerializer`, `JsonDeserializer` is basically supported. +However, it is recommended that `WrapsNullableValueClassDeserializer` be inherited and implemented as a +deserializer for `value class` that wraps nullable. + +This deserializer is intended to make the deserialization result be a wrapped null if the parameter definition +is a `value class` that wraps nullable and non-null, and the value on the `JSON` is null. +An example implementation is shown below. + +```kotlin +@JvmInline +value class ValueClass(val value: String?) + +class Deserializer : WrapsNullableValueClassDeserializer(ValueClass::class) { + override fun deserialize(p: JsonParser, ctxt: DeserializationContext): ValueClass { + TODO("Not yet implemented") + } + + override fun getBoxedNullValue(): ValueClass = WRAPPED_NULL + + companion object { + private val WRAPPED_NULL = ValueClass(null) + } +} +``` + +### JsonCreator +`JsonCreator` basically behaves like a `DELEGATING` mode. +Note that defining a creator with multiple arguments will result in a runtime error. + +As a workaround, a factory function defined in bytecode with a return value of `value class` can be deserialized in the same way as a normal creator. + +```kotlin +@JvmInline +value class PrimitiveMultiParamCreator(val value: Int) { + companion object { + @JvmStatic + @JsonCreator + fun creator(first: Int, second: Int): PrimitiveMultiParamCreator? = + PrimitiveMultiParamCreator(first + second) + } +} +``` From 71560e653740f10146b17f82a45d05cd8800c183 Mon Sep 17 00:00:00 2001 From: wrongwrong Date: Sun, 18 Feb 2024 20:08:27 +0900 Subject: [PATCH 20/20] Update README --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 67c531e4..f8149d79 100644 --- a/README.md +++ b/README.md @@ -159,6 +159,9 @@ These Kotlin classes are supported with the following fields for serialization/d * CharRange _(start, end)_ * LongRange _(start, end)_ +Deserialization for `value class` is also supported since 2.17. +Please refer to [this page](./docs/value-class-support.md) for more information on using `value class`, including serialization. + (others are likely to work, but may not be tuned for Jackson) # Sealed classes without @JsonSubTypes