Skip to content

Type parameters are checked for equality while isAssignableFrom expected #2155

Closed
@frankfiedler

Description

@frankfiedler

I have a problem with the serialization of a class of mine with an acutal version of the jackson serialization. The last version working with my code is the 2.8.10 as far as I know.
The problem I see is that the serialization checks in file jackson-databind-2.9.5-sources.jar!/com/fasterxml/jackson/databind/type/TypeFactory.java:474 while I would expect the check to make sure that the field-type is only assignable-from the concrete instance of a field.

I prepared a testcase which I attach to this report.

testcase-plugin-serialization.zip

The entry point for my testcase is the class called MyTest. There you find a function

  • problem() : producing the problem
  • workaround() : working around the problem by doing the serialization in the problematic class manually

In the example the ProblematicPlugin has a value type named ValueAndState which implements Serializable. As the serializer checks for Serializable == ValueAndState the check fails while I think the check should do field.isAssignableFrom(valueAndStateInstance).

The class WorkaroundPlugin contains my current work around, doing the serialization of the members myself and just bypassing the check in the class itself.

I would like to ask for a change in the serializer checking for isAssignableFrom(..).

Any feedback and questions welcome.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions