-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Description
When I run main() in this code with @JvmStatic, everything is fine, ie the type is recognized as duplex type,
and serialization and deserialization detection works.
package de.builderrahmen.iac.aws.cloudformation
import de.quantummaid.mapmaid.MapMaid
interface StringGetter {
fun sanitizedStringValue(): String
}
class StringSanitizer(val s: String): StringGetter {
override fun sanitizedStringValue(): String = s.trim()
}
class MyPrimitive private constructor(unsafeInput: String) : StringGetter by StringSanitizer(unsafeInput) {
companion object {
@JvmStatic
fun fromString(unsafeInput: String) = MyPrimitive(unsafeInput)
}
}
fun main() {
MapMaid.aMapMaid().serializingAndDeserializing(MyPrimitive::class.java).build()
}
But when I comment out @JvmStatic, I get this error:
no duplex detected:
[Failed to detect de.builderrahmen.iac.aws.cloudformation.MyPrimitive:
[no symmetric result]]
de.builderrahmen.iac.aws.cloudformation.MyPrimitive:
Mode: duplex
How it is serialized:
No serializer available
Why it needs to be serializable:
- manually added
Ignored features for serialization:
- as custom primitive using 'String sanitizedStringValue()' [public java.lang.String de.builderrahmen.iac.aws.cloudformation.MyPrimitive.sanitizedStringValue()]
Ignored because:
- not known
- Companion [Companion] via field 'public static final Companion Companion'
Ignored because:
- static fields are not serialized
How it is deserialized:
No deserializer available
Why it needs to be deserializable:
- manually added
Ignored features for deserialization:
- as serialized object using private de.builderrahmen.iac.aws.cloudformation.MyPrimitive(java.lang.String)
Ignored because:
- only public constructors are considered for deserialization
- as custom primitive based on type 'String' using private de.builderrahmen.iac.aws.cloudformation.MyPrimitive(java.lang.String)
Ignored because:
- only public constructors are considered for deserialization
Expected behaviour:
The fragment about the serialization not being possible should not be there, in particular
- as custom primitive using 'String sanitizedStringValue()' [public java.lang.String de.builderrahmen.iac.aws.cloudformation.MyPrimitive.sanitizedStringValue()]
Ignored because:
- not known
Sent me down the wrong investigation path.
Instead, only the error message concerning the deserialization should be shown.
Metadata
Metadata
Assignees
Labels
No labels