Skip to content

[BUG] Typealiases prevent (de)serialization with an unhelpful error message #82

@marcoeggersmann

Description

@marcoeggersmann

To Reproduce

typealias MyTypealias = (String) -> Int

data class MyClassWithTypeAliases(
        val myAliases: List<MyTypealias>
)

fun main() {
    val mapper = MapMaid.aMapMaid()
            .serializingAndDeserializing(MyClassWithTypeAliases::class.java)
            .build()
}

Error message:

Exception in thread "main" de.quantummaid.mapmaid.debug.MapMaidException: The following classes could not be detected properly:

xy.test.MyClassWithTypeAliases: unable to detect duplex:
no duplex detected:
[Failed to detect xy.test.MyClassWithTypeAliases:
[no symmetric result]]

xy.test.MyClassWithTypeAliases:
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 'int hashCode()' [public int xy.test.MyClassWithTypeAliases.hashCode()]
	  Ignored because:
		- method 'hashCode' is not considered
	- as custom primitive using 'String toString()' [public java.lang.String xy.test.MyClassWithTypeAliases.toString()]
	  Ignored because:
		- method 'toString' is not considered
	- myAliases [List<Function1<String, Integer>>] via getter method 'getMyAliases'
	  Ignored because:
		- not known
	- myAliases [List<Function1<String, Integer>>] via field 'private final List<Function1<String, Integer>> myAliases'
	  Ignored because:
		- only public fields are serialized
How it is deserialized:
	No deserializer available
Why it needs to be deserializable:
	- manually added
Ignored features for deserialization:
	- as serialized object using public xy.test.MyClassWithTypeAliases(java.util.List<? extends kotlin.jvm.functions.Function1<? super java.lang.String, java.lang.Integer>>)
	  Ignored because:
		- not known



Please visit our documentation at 'https://github.com/quantummaid/mapmaid/tree/master/documentation' for additional help.

	at de.quantummaid.mapmaid.debug.MapMaidException.mapMaidException(MapMaidException.java:69)
	at de.quantummaid.mapmaid.debug.MapMaidException.mapMaidException(MapMaidException.java:46)
	at de.quantummaid.mapmaid.builder.resolving.processing.Processor.collect(Processor.java:102)
	at de.quantummaid.mapmaid.builder.MapMaidBuilder.build(MapMaidBuilder.java:333)
	at xy.test.MainKt.main(Main.kt:14)
	at xy.test.MainKt.main(Main.kt)

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions