Skip to content

There is a regression in JsonTypeInfo processing in 3.0 #4947

@k163377

Description

@k163377

Search before asking

  • I searched in the issues and found nothing similar.

Describe the bug

The following test succeeds on the 2.19, but fails on master (= 3.0).
https://github.com/FasterXML/jackson-module-kotlin/blob/2.19/src/test/kotlin/com/fasterxml/jackson/module/kotlin/test/github/GitHub844.kt

The stack trace is as follows

tools.jackson.databind.exc.InvalidTypeIdException: Could not resolve type id 'ChildClass' as a subtype of `tools.jackson.module.kotlin.test.github.BaseClass`: known type ids = []
 at [Source: REDACTED (`StreamReadFeature.INCLUDE_SOURCE_IN_LOCATION` disabled); byte offset: #UNKNOWN]

	at tools.jackson.databind.exc.InvalidTypeIdException.from(InvalidTypeIdException.java:41)
	at tools.jackson.databind.DeserializationContext.invalidTypeIdException(DeserializationContext.java:2037)
	at tools.jackson.databind.DeserializationContext.handleUnknownTypeId(DeserializationContext.java:1614)
	at tools.jackson.databind.jsontype.impl.TypeDeserializerBase._handleUnknownTypeId(TypeDeserializerBase.java:279)
	at tools.jackson.databind.jsontype.impl.TypeDeserializerBase._findDeserializer(TypeDeserializerBase.java:160)
	at tools.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer._deserializeTypedForId(AsPropertyTypeDeserializer.java:119)
	at tools.jackson.databind.jsontype.impl.AsPropertyTypeDeserializer.deserializeTypedFromObject(AsPropertyTypeDeserializer.java:103)
	at tools.jackson.databind.deser.AbstractDeserializer.deserializeWithType(AbstractDeserializer.java:243)
	at tools.jackson.databind.deser.impl.TypeWrappedDeserializer.deserialize(TypeWrappedDeserializer.java:72)
	at tools.jackson.databind.deser.DeserializationContextExt.readRootValue(DeserializationContextExt.java:265)
	at tools.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:2576)
	at tools.jackson.databind.ObjectMapper.readValue(ObjectMapper.java:1591)
	at tools.jackson.module.kotlin.test.github.GitHub844.test(GitHub844.kt:31)
	at java.base/java.lang.reflect.Method.invoke(Method.java:569)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)
	at java.base/java.util.ArrayList.forEach(ArrayList.java:1511)

Version Information

3.0

Reproduction

https://github.com/FasterXML/jackson-module-kotlin/blob/master/src/test/kotlin/tools/jackson/module/kotlin/test/github/GitHub844.kt

Expected behavior

It succeeds as well as the 2.19.

Additional context

Sorry, I am concentrating on other work and have not been able to analyze the error.

Also, the reason why this was not detected by CI was because some tests of kotlin-module were not executed by the verify command.
This problem existed for a long time (before I became the maintainer), but I was unaware of it because I was testing locally using Intellij.
This problem has already been resolved.
FasterXML/jackson-module-kotlin#900

Metadata

Metadata

Assignees

No one assigned

    Labels

    to-evaluateIssue that has been received but not yet evaluated

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions