diff --git a/datatypes/src/main/java/com/fasterxml/jackson/datatype/jdk8/Jdk8Deserializers.java b/datatypes/src/main/java/com/fasterxml/jackson/datatype/jdk8/Jdk8Deserializers.java index dd2a4f25..cdddc32f 100644 --- a/datatypes/src/main/java/com/fasterxml/jackson/datatype/jdk8/Jdk8Deserializers.java +++ b/datatypes/src/main/java/com/fasterxml/jackson/datatype/jdk8/Jdk8Deserializers.java @@ -7,7 +7,7 @@ import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.type.ReferenceType; -class Jdk8Deserializers extends Deserializers.Base +public class Jdk8Deserializers extends Deserializers.Base { // 21-Oct-2015, tatu: Code much simplified with 2.7 where we should be getting much // of boilerplate handling automatically diff --git a/datatypes/src/main/java/com/fasterxml/jackson/datatype/jdk8/Jdk8Serializers.java b/datatypes/src/main/java/com/fasterxml/jackson/datatype/jdk8/Jdk8Serializers.java index 555e1608..a9a64d9b 100644 --- a/datatypes/src/main/java/com/fasterxml/jackson/datatype/jdk8/Jdk8Serializers.java +++ b/datatypes/src/main/java/com/fasterxml/jackson/datatype/jdk8/Jdk8Serializers.java @@ -18,7 +18,7 @@ import java.util.stream.LongStream; import java.util.stream.Stream; -class Jdk8Serializers extends Serializers.Base +public class Jdk8Serializers extends Serializers.Base { @Override public JsonSerializer findReferenceSerializer(SerializationConfig config, @@ -38,7 +38,7 @@ public JsonSerializer findReferenceSerializer(SerializationConfig config, if (OptionalDouble.class.isAssignableFrom(raw)) { return OptionalDoubleSerializer.INSTANCE; } - return findReferenceSerializer(config, refType, beanDesc, contentTypeSerializer, contentValueSerializer); + return null; } @Override @@ -59,6 +59,6 @@ public JsonSerializer findSerializer(SerializationConfig config, JavaType typ JavaType vt = (params == null || params.length != 1) ? TypeFactory.unknownType() : params[0]; return new StreamSerializer(config.getTypeFactory().constructParametrizedType(Stream.class, Stream.class, vt), vt); } - return super.findSerializer(config, type, beanDesc); + return null; } } diff --git a/datatypes/src/test/java/com/fasterxml/jackson/datatype/jdk8/OptionalBasicTest.java b/datatypes/src/test/java/com/fasterxml/jackson/datatype/jdk8/OptionalBasicTest.java index 95b40d8b..057be532 100644 --- a/datatypes/src/test/java/com/fasterxml/jackson/datatype/jdk8/OptionalBasicTest.java +++ b/datatypes/src/test/java/com/fasterxml/jackson/datatype/jdk8/OptionalBasicTest.java @@ -1,6 +1,7 @@ package com.fasterxml.jackson.datatype.jdk8; import java.util.*; +import java.util.concurrent.atomic.AtomicReference; import com.fasterxml.jackson.annotation.*; import com.fasterxml.jackson.annotation.JsonAutoDetect.Visibility; diff --git a/datatypes/src/test/java/com/fasterxml/jackson/datatype/jdk8/OptionalTest.java b/datatypes/src/test/java/com/fasterxml/jackson/datatype/jdk8/OptionalTest.java index 0b421884..0309c095 100644 --- a/datatypes/src/test/java/com/fasterxml/jackson/datatype/jdk8/OptionalTest.java +++ b/datatypes/src/test/java/com/fasterxml/jackson/datatype/jdk8/OptionalTest.java @@ -2,6 +2,7 @@ import java.io.IOException; import java.util.*; +import java.util.concurrent.atomic.AtomicReference; import com.fasterxml.jackson.annotation.*; @@ -11,6 +12,7 @@ import com.fasterxml.jackson.core.type.TypeReference; import com.fasterxml.jackson.databind.DeserializationContext; +import com.fasterxml.jackson.databind.JavaType; import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; @@ -250,6 +252,13 @@ public void testCustomSerializer() throws Exception assertEquals(json, aposToQuotes("{'value':'FOOBAR'}")); } + // [modules-java8#33]: Verify against regression... + public void testOtherRefSerializers() throws Exception + { + String json = MAPPER.writeValueAsString(new AtomicReference("foo")); + assertEquals(quote("foo"), json); + } + /* /********************************************************** /* Helper methods diff --git a/release-notes/CREDITS b/release-notes/CREDITS index ca0b80b3..b0f64207 100644 --- a/release-notes/CREDITS +++ b/release-notes/CREDITS @@ -7,3 +7,8 @@ Louis-RĂ©mi Paquet (lrpg@github) * Reported #15: Optional and OptionalLong deserialization not consistent when deserializing from String (2.8.8) + +Mikko Tiihonen (gmokki@github) +* Reported #33: `Jdk8Serializer.findReferenceSerializer()` leads to `StackOverflowError` + in 2.8.9 + (2.8.10) diff --git a/release-notes/VERSION b/release-notes/VERSION index 69806784..2de38a6f 100644 --- a/release-notes/VERSION +++ b/release-notes/VERSION @@ -8,6 +8,11 @@ Modules: === Releases === ------------------------------------------------------------------------ +2.8.10 (not yet released) + +#33: `Jdk8Serializer.findReferenceSerializer()` leads to `StackOverflowError` in 2.8.9 + (reported by Mikko T) + 2.8.9 (12-Jun-2017) No changes since 2.8.8