From e5422d243ea6e9db3cb592d6d0f739440ed5df44 Mon Sep 17 00:00:00 2001 From: Petr Kokorev Date: Tue, 19 Aug 2014 13:09:52 +0200 Subject: [PATCH] [Issue #524] Used constructor with ObjectIdResolver in ObjectIdInfo.withAlwaysAsId(...) + Unit test --- .../fasterxml/jackson/databind/introspect/ObjectIdInfo.java | 4 ++-- .../jackson/databind/struct/TestObjectIdDeserialization.java | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/fasterxml/jackson/databind/introspect/ObjectIdInfo.java b/src/main/java/com/fasterxml/jackson/databind/introspect/ObjectIdInfo.java index 54307f106e..0457ec038a 100644 --- a/src/main/java/com/fasterxml/jackson/databind/introspect/ObjectIdInfo.java +++ b/src/main/java/com/fasterxml/jackson/databind/introspect/ObjectIdInfo.java @@ -15,7 +15,7 @@ public class ObjectIdInfo { protected final PropertyName _propertyName; protected final Class> _generator; - private final Class _resolver; + protected final Class _resolver; protected final Class _scope; protected final boolean _alwaysAsId; @@ -60,7 +60,7 @@ public ObjectIdInfo withAlwaysAsId(boolean state) { if (_alwaysAsId == state) { return this; } - return new ObjectIdInfo(_propertyName, _scope, _generator, state); + return new ObjectIdInfo(_propertyName, _scope, _generator, state, _resolver); } public PropertyName getPropertyName() { return _propertyName; } diff --git a/src/test/java/com/fasterxml/jackson/databind/struct/TestObjectIdDeserialization.java b/src/test/java/com/fasterxml/jackson/databind/struct/TestObjectIdDeserialization.java index ce6c047ec4..047a80ba15 100644 --- a/src/test/java/com/fasterxml/jackson/databind/struct/TestObjectIdDeserialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/struct/TestObjectIdDeserialization.java @@ -8,6 +8,7 @@ import com.fasterxml.jackson.annotation.JsonAnySetter; import com.fasterxml.jackson.annotation.JsonIdentityInfo; +import com.fasterxml.jackson.annotation.JsonIdentityReference; import com.fasterxml.jackson.annotation.ObjectIdGenerator.IdKey; import com.fasterxml.jackson.annotation.ObjectIdGenerators; import com.fasterxml.jackson.annotation.ObjectIdResolver; @@ -140,6 +141,7 @@ static class CustomResolutionWrapper { } @JsonIdentityInfo(generator = ObjectIdGenerators.PropertyGenerator.class, property = "id", resolver = PoolResolver.class) + @JsonIdentityReference(alwaysAsId = true) // #524 static class WithCustomResolution { public int id; public int data;