New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression in support for JsonProperty #239

tjwilson90 opened this Issue Jan 15, 2016 · 3 comments


None yet
3 participants

tjwilson90 commented Jan 15, 2016


import org.immutables.value.Value;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;

@JsonSerialize(as = ImmutableFoo.class)
@JsonDeserialize(as = ImmutableFoo.class)
public abstract class Foo {

    public abstract boolean isBar();

    public static void main(String[] args) throws Exception {
        ObjectMapper mapper = new ObjectMapper();
        Foo foo = mapper.readValue("{\"bar\": true}", Foo.class);

With immutables version 2.1.0 this works as expected (prints {"bar": true}).
With immutables version 2.1.7 this fails with an exception

Exception in thread "main" com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException: Unrecognized field "bar" (class ImmutableFoo$Json), not marked as ignorable (one known property: "isBar"])
 at [Source: {"bar": true}; line: 1, column: 13] (through reference chain: Json["bar"])
    at com.fasterxml.jackson.databind.exc.UnrecognizedPropertyException.from(
    at com.fasterxml.jackson.databind.DeserializationContext.reportUnknownProperty(
    at com.fasterxml.jackson.databind.deser.std.StdDeserializer.handleUnknownProperty(
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownProperty(
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.handleUnknownVanilla(
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.vanillaDeserialize(
    at com.fasterxml.jackson.databind.deser.BeanDeserializer._deserializeOther(
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(
    at com.fasterxml.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserializeFromObject(
    at com.fasterxml.jackson.databind.deser.BeanDeserializer.deserialize(
    at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(
    at com.fasterxml.jackson.databind.ObjectMapper.readValue(
    at Foo.main(

This comment has been minimized.


elucash commented Jan 15, 2016

Thank you for reporting this! v2.1.8 containing the fix will be released shortly.
@ldriscoll can you, please, look at some point for see if this fix could have broken something.

@elucash elucash added this to the 2.1.8 milestone Jan 15, 2016


This comment has been minimized.


elucash commented Jan 16, 2016

Released in 2.1.8

@elucash elucash closed this Jan 26, 2016


This comment has been minimized.


ldriscoll commented Jan 27, 2016

I'm not seeing any issues so far.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment