Skip to content

Serialization problem with type specialization of nested generic types #2034

@dnno

Description

@dnno

We're facing a problem in our project when updating to the latest Spring Boot version (1.5.12) which upgrades from Jackson 1.8.10 to 1.8.11: Serialization of some of our classes now doesn't work anymore. Going up to 1.9.5 the same problem still persists for us.

I was able to track this back to a change in issue #1604 where I've commented earlier. I'm opening a new issue as suggested there, but this problem could be connected to #1964.

I've isolated our problem into a simple maven based project, you can find it here:

https://github.com/dnno/jackson-serialization-problem/

The classes we try to serialize make use of generics and Jackson now isn't able to handle them anymore. Type resolution stops here:

TypeFactory._verifyAndResolvePlaceholders():476

if (exp.getRawClass() != act.getRawClass()) {
return false;
}

I don't really understand a lot of what's happening here, but what I do see is, that if I manually set the resulting error String to , the serialization will work fine.

Could it be, that it's wrong to just compare for the same raw classes, but instead traverse the type hierarchy? In my case it's comparing a List (actual) to an Object (expected). A successful comparison would make sense for me.

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