jackson-databind icon indicating copy to clipboard operation
jackson-databind copied to clipboard

Make using Object IDs compatible with builders

Open gary-sedgwick opened this issue 8 years ago • 4 comments

We would very much like to use builders in combination with JsonIdentityInfo, however the following condition in BuilderBasedDeserializer.java prevents this:

        // 05-Mar-2012, tatu: Can not really make Object Ids work with builders, not yet anyway
        if (_objectIdReader != null) {
            throw new IllegalArgumentException("Can not use Object Id with Builder-based deserialization (type "
                    +beanDesc.getType()+")");
        }

What is the reasoning behind the above? I built a custom jar removing the above code, and for our use case everything appears to work fine - however, I'm wary that something else may break in future and that there is no doubt a good reason for the check being there. However, it seems a shame that two of the major features of Jackson cannot work together, especially when this restriction doesn't seem to be highlighted anywhere - for our use case we really need both.

gary-sedgwick avatar Jan 12 '17 09:01 gary-sedgwick