简体   繁体   中英

Jackson-Databind: Compilation issue for the version greater than 2.9.10

I am using the jackson-databind 2.9.10. I tried to upgrade the version.

I tried many versions. But, trying with the latest now which is 2.12.2

With all the versions greater than 2.9.10, I am getting compilation issue on the below code.

    Map<String, List<Map<String, Object>>> result =
    objectMapper.readValue(inputResponse, new TypeReference<Map<String, Object>>() {
    });

Issue: incompatible types: inference variable T has incompatible bounds

Input response is on the string format of below json:

{
"config": [{
    "key1": "value1",
    "key2": "value2",
    "key3": [{
        "key3.1": "value3.1",
        "key3.2": "value3.2",
        "key3.3": [{
            "key3.3.1": "value3.3.1",
            "key3.3.2": "value3.3.2"
        }]
    }]
}]}

From jackson mapper 2.10.0 onwards, bounds of the TypeReference have to match the type of the response variable.

For more info: https://github.com/FasterXML/jackson-databind/pull/2196

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM