From 8d3d3b7d04e0c7b079bb0927e1f04b345691bba7 Mon Sep 17 00:00:00 2001 From: Tatu Saloranta Date: Sat, 13 Jan 2018 15:56:06 -0800 Subject: [PATCH] Fix #1889 --- release-notes/VERSION | 2 + .../jackson/databind/BeanProperty.java | 7 +- .../databind/DeserializationContext.java | 29 +++----- .../jackson/databind/JsonDeserializer.java | 37 ++++++++-- .../jackson/databind/JsonSerializer.java | 73 ++++++++++++++----- .../jackson/databind/SerializerProvider.java | 30 +++----- .../databind/deser/AbstractDeserializer.java | 3 +- .../databind/deser/BeanDeserializerBase.java | 3 +- .../deser/ContextualDeserializer.java | 32 +------- .../databind/deser/DeserializerCache.java | 2 +- .../deser/std/CollectionDeserializer.java | 1 - .../databind/deser/std/DateDeserializers.java | 2 - .../deser/std/DelegatingDeserializer.java | 1 - .../databind/deser/std/EnumDeserializer.java | 11 +-- .../deser/std/EnumMapDeserializer.java | 1 - .../deser/std/EnumSetDeserializer.java | 2 - .../std/FactoryBasedEnumDeserializer.java | 4 - .../databind/deser/std/MapDeserializer.java | 1 - .../deser/std/MapEntryDeserializer.java | 1 - .../deser/std/ObjectArrayDeserializer.java | 2 - .../std/PrimitiveArrayDeserializers.java | 5 +- .../deser/std/ReferenceTypeDeserializer.java | 4 +- .../deser/std/StdDelegatingDeserializer.java | 2 - .../databind/deser/std/StdDeserializer.java | 2 +- .../deser/std/StdNodeBasedDeserializer.java | 2 +- .../deser/std/StringArrayDeserializer.java | 2 - .../std/StringCollectionDeserializer.java | 2 - .../deser/std/UntypedObjectDeserializer.java | 2 - .../ext/XMLGregorianCalendarSerializer.java | 2 - .../ext/jdk8/Jdk8StreamSerializer.java | 3 +- .../jackson/databind/ser/AnyGetterWriter.java | 10 +-- .../databind/ser/ContextualSerializer.java | 30 +------- .../databind/ser/impl/MapEntrySerializer.java | 5 -- .../ser/impl/StringArraySerializer.java | 2 - .../ser/impl/TypeWrappedSerializer.java | 4 +- .../databind/ser/std/ArraySerializerBase.java | 22 ------ .../ser/std/AsArraySerializerBase.java | 2 - .../databind/ser/std/BeanSerializerBase.java | 3 - .../databind/ser/std/BooleanSerializer.java | 5 -- .../ser/std/DateTimeSerializerBase.java | 2 - .../databind/ser/std/EnumSerializer.java | 2 - .../ser/std/InetAddressSerializer.java | 2 - .../databind/ser/std/JsonValueSerializer.java | 6 -- .../databind/ser/std/MapSerializer.java | 2 - .../databind/ser/std/NumberSerializers.java | 3 +- .../ser/std/ObjectArraySerializer.java | 2 - .../ser/std/ReferenceTypeSerializer.java | 5 -- .../ser/std/StaticListSerializerBase.java | 10 --- .../ser/std/StdDelegatingSerializer.java | 6 +- .../TestContextualDeserialization.java | 4 - .../contextual/TestContextualKeyTypes.java | 2 - .../TestContextualSerialization.java | 3 - .../TestContextualWithAnnDeserializer.java | 2 - .../databind/deser/TestBeanDeserializer.java | 1 - .../deser/TestCustomDeserializers.java | 2 - .../deser/jdk/UntypedDeserializationTest.java | 2 - 56 files changed, 132 insertions(+), 277 deletions(-) diff --git a/release-notes/VERSION b/release-notes/VERSION index e3321369e0..12a556e3e2 100644 --- a/release-notes/VERSION +++ b/release-notes/VERSION @@ -20,4 +20,6 @@ Versions: 3.x (for earlier see VERSION-2.x) #1790: Add `createParser` methods in `ObjectMapper`, `ObjectReader` #1888: Merge `ResolvableSerializer` into `JsonSerializer`, `ResolvableDeserializer` into `JsonDeserializer` +#1889: Merge `ContextualSerializer` into `JsonSerializer`, `ContextualDeserializer` + into `JsonDeserializer` - Remove `MappingJsonFactory` diff --git a/src/main/java/com/fasterxml/jackson/databind/BeanProperty.java b/src/main/java/com/fasterxml/jackson/databind/BeanProperty.java index 742948974a..31dbdcd487 100644 --- a/src/main/java/com/fasterxml/jackson/databind/BeanProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/BeanProperty.java @@ -25,10 +25,9 @@ *

* Instances are not typically passed when constructing serializers * and deserializers, but rather only passed when context - * is known when - * {@link com.fasterxml.jackson.databind.ser.ContextualSerializer} and - * {@link com.fasterxml.jackson.databind.deser.ContextualDeserializer} - * resolution occurs (createContextual(...) method is called). + * is known and + * {@link JsonSerializer#createContextual} and + * {@link JsonDeserializer#createContextual} are called. * References may (need to) be retained by serializers and deserializers, * especially when further resolving dependent handlers like value * serializers/deserializers or structured types. diff --git a/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java b/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java index d28ba60cac..df4857dc0b 100644 --- a/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java +++ b/src/main/java/com/fasterxml/jackson/databind/DeserializationContext.java @@ -151,12 +151,11 @@ public abstract class DeserializationContext protected transient ContextAttributes _attributes; /** - * Type of {@link JsonDeserializer} (or, more specifically, - * {@link ContextualDeserializer}) that is being - * contextualized currently. + * Type of {@link JsonDeserializer} on which {@link JsonDeserializer#createContextual} + * is being called currently. */ protected LinkedNode _currentType; - + /* /********************************************************** /* Life-cycle @@ -316,13 +315,13 @@ public DeserializationContext setAttribute(Object key, Object value) /** * Accessor to {@link JavaType} of currently contextualized - * {@link ContextualDeserializer}, if any. + * {@link JsonDeserializer}, if any. * This is sometimes useful for generic {@link JsonDeserializer}s that * do not get passed (or do not retain) type information when being * constructed: happens for example for deserializers constructed * from annotations. * - * @return Type of {@link ContextualDeserializer} being contextualized, + * @return Type of {@link JsonDeserializer} being contextualized, * if process is on-going; null if not. */ public JavaType getContextualType() { @@ -755,21 +754,19 @@ public abstract KeyDeserializer keyDeserializerInstance(Annotated annotated, /** * Method called for primary property deserializers (ones * directly created to deserialize values of a POJO property), - * to handle details of resolving - * {@link ContextualDeserializer} with given property context. + * to handle details of calling + * {@link JsonDeserializer#createContextual} with given property context. * * @param prop Property for which the given primary deserializer is used; never null. - * - * @since 2.5 */ public JsonDeserializer handlePrimaryContextualization(JsonDeserializer deser, BeanProperty prop, JavaType type) throws JsonMappingException { - if (deser instanceof ContextualDeserializer) { + if (deser != null) { _currentType = new LinkedNode(type, _currentType); try { - deser = ((ContextualDeserializer) deser).createContextual(this, prop); + deser = deser.createContextual(this, prop); } finally { _currentType = _currentType.next(); } @@ -783,24 +780,22 @@ public JsonDeserializer handlePrimaryContextualization(JsonDeserializer de * but instead created as a component -- such as value deserializers * for structured types, or deserializers for root values) * to handle details of resolving - * {@link ContextualDeserializer} with given property context. + * {@link JsonDeserializer#createContextual} with given property context. * Given that these deserializers are not directly related to given property * (or, in case of root value property, to any property), annotations * accessible may or may not be relevant. * * @param prop Property for which deserializer is used, if any; null * when deserializing root values - * - * @since 2.5 */ public JsonDeserializer handleSecondaryContextualization(JsonDeserializer deser, BeanProperty prop, JavaType type) throws JsonMappingException { - if (deser instanceof ContextualDeserializer) { + if (deser != null) { _currentType = new LinkedNode(type, _currentType); try { - deser = ((ContextualDeserializer) deser).createContextual(this, prop); + deser =deser.createContextual(this, prop); } finally { _currentType = _currentType.next(); } diff --git a/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java index a99121887b..e9df07eda3 100644 --- a/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java @@ -30,11 +30,9 @@ *

* In addition, to support per-property annotations (to configure aspects * of deserialization on per-property basis), deserializers may want - * to implement - * {@link com.fasterxml.jackson.databind.deser.ContextualDeserializer}, - * which allows specialization of deserializers: call to - * {@link com.fasterxml.jackson.databind.deser.ContextualDeserializer#createContextual} - * is passed information on property, and can create a newly configured + * to override + * {@link #createContextual} which allows specialization of deserializers: + * it is passed information on property, and can create a newly configured * deserializer for handling that particular property. *
* Resolution of deserializers occurs before contextualization. @@ -44,7 +42,8 @@ public abstract class JsonDeserializer { /* /********************************************************** - /* Initialization, with former `ResolvableDeserializer` + /* Initialization, with former `ResolvableDeserializer`, + /* `ContextualDeserializer` /********************************************************** */ @@ -62,6 +61,32 @@ public void resolve(DeserializationContext ctxt) throws JsonMappingException { // Default implementation does nothing } + /** + * Method called to see if a different (or differently configured) deserializer + * is needed to deserialize values of specified property. + * Note that instance that this method is called on is typically shared one and + * as a result method should NOT modify this instance but rather construct + * and return a new instance. This instance should only be returned as-is, in case + * it is already suitable for use. + * + * @param ctxt Deserialization context to access configuration, additional + * deserializers that may be needed by this deserializer + * @param property Method, field or constructor parameter that represents the property + * (and is used to assign deserialized value). + * Should be available; but there may be cases where caller cannot provide it and + * null is passed instead (in which case impls usually pass 'this' deserializer as is) + * + * @return Deserializer to use for deserializing values of specified property; + * may be this instance or a new instance. + * + * @throws JsonMappingException + */ + public JsonDeserializer createContextual(DeserializationContext ctxt, + BeanProperty property) throws JsonMappingException { + // default implementation returns instance unmodified + return this; + } + /* /********************************************************** /* Main deserialization methods diff --git a/src/main/java/com/fasterxml/jackson/databind/JsonSerializer.java b/src/main/java/com/fasterxml/jackson/databind/JsonSerializer.java index 488d21a5bf..91f6045ed6 100644 --- a/src/main/java/com/fasterxml/jackson/databind/JsonSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/JsonSerializer.java @@ -16,16 +16,9 @@ * Abstract class that defines API used by {@link ObjectMapper} (and * other chained {@link JsonSerializer}s too) to serialize Objects of * arbitrary types into JSON, using provided {@link JsonGenerator}. - * {@link com.fasterxml.jackson.databind.ser.std.StdSerializer} instead - * of this class, since it will implement many of optional - * methods of this class. - *

- * NOTE: various serialize methods are never (to be) called - * with null values -- caller must handle null values, usually - * by calling {@link SerializerProvider#findNullValueSerializer} to obtain - * serializer to use. - * This also means that custom serializers cannot be directly used to change - * the output to produce when serializing null values. + * Note that although API is defined here, custom serializer implementations + * should almost always be based on {@link com.fasterxml.jackson.databind.ser.std.StdSerializer} + * since it will implement many of optional methods of this class. *

* If serializer is an aggregate one -- meaning it delegates handling of some * of its contents by using other serializer(s) -- it typically also needs @@ -35,23 +28,34 @@ * resolution of secondary serializers (which may have cyclic link back * to serializer itself, directly or indirectly). *

- * In addition, to support per-property annotations (to configure aspects - * of serialization on per-property basis), serializers may want - * to implement - * {@link com.fasterxml.jackson.databind.ser.ContextualSerializer}, - * which allows specialization of serializers: call to - * {@link com.fasterxml.jackson.databind.ser.ContextualSerializer#createContextual} - * is passed information on property, and can create a newly configured - * serializer for handling that particular property. + * Initialization of serializers is handled by two main methods: + *

    + *
  1. {@link #resolve}: called after instance is configured to be used for specific type, + * but without yet knowing property it will be used for (or, in case of root values, without property). + * Method needs to be implemented for serializers that may work on cyclic types, and specifically + * is implemented by standard POJO serializer ({@code BeanSerializer}). It is usually not needed for + * container types as their type definitions are not cyclic, unlike some POJO types. + *
  2. {@link #createContextual}: called on resolved instance (whether newly created, or found via cache), + * when serializer is to be used for specific property, or as root value serializer (no referring property). + * It is used to apply annotations from property accessors (getter, field), and may also be used for resolving + * nested types for container serializers (such as ones for {@link java.util.Collection}s). + *
+ * Caching of serializers occurs after {@link #resolve} is called: cached instances are not contextual. *

- * Resolution of serializers occurs before contextualization. + * NOTE: various serialize methods are never (to be) called + * with null values -- caller must handle null values, usually + * by calling {@link SerializerProvider#findNullValueSerializer} to obtain + * serializer to use. + * This also means that custom serializers cannot be directly used to change + * the output to produce when serializing null values. */ public abstract class JsonSerializer implements JsonFormatVisitable { /* /********************************************************** - /* Initialization, with former `ResolvableSerializer` + /* Initialization, with former `ResolvableSerializer`, + /* `ContextualSerializer`. /********************************************************** */ @@ -71,6 +75,35 @@ public void resolve(SerializerProvider provider) throws JsonMappingException { // Default implementation does nothing } + /** + * Method called to see if a different (or differently configured) serializer + * is needed to serialize values of specified property (or, for root values, in which + * case `null` is passed). + * Note that instance that this method is called on is typically shared one and + * as a result method should NOT modify this instance but rather construct + * and return a new instance. This instance should only be returned as-is, in case + * it is already suitable for use. + *

+ * Note that method is only called once per POJO property, and for the first usage as root + * value serializer; it is not called for every serialization, as doing that would have + * significant performance impact; most serializers cache contextual instances for future + * use. + * + * @param prov Serializer provider to use for accessing config, other serializers + * @param property Property (defined by one or more accessors - field or method - used + * for accessing logical property value) for which serializer is used to be used; + * or, `null` for root value (or in cases where caller does not have this information, + * which is handled as root value case). + * + * @return Serializer to use for serializing values of specified property; + * may be this instance or a new instance. + */ + public JsonSerializer createContextual(SerializerProvider prov, + BeanProperty property) throws JsonMappingException { + // default implementation returns instance unmodified + return this; + } + /* /********************************************************** /* Fluent factory methods for constructing decorated versions diff --git a/src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java b/src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java index 56122777e8..3cf493abf0 100644 --- a/src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java +++ b/src/main/java/com/fasterxml/jackson/databind/SerializerProvider.java @@ -23,7 +23,6 @@ import com.fasterxml.jackson.databind.cfg.ContextAttributes; import com.fasterxml.jackson.databind.cfg.GeneratorSettings; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.exc.InvalidDefinitionException; import com.fasterxml.jackson.databind.exc.InvalidTypeIdException; import com.fasterxml.jackson.databind.introspect.Annotated; @@ -1021,9 +1020,8 @@ public boolean isUnknownTypeSerializer(JsonSerializer ser) { * Method that can be called to construct and configure serializer instance, * either given a {@link Class} to instantiate (with default constructor), * or an uninitialized serializer instance. - * Either way, serialize will be properly resolved - * (via {@link com.fasterxml.jackson.databind.JsonSerializer#resolve}) and/or contextualized - * (via {@link com.fasterxml.jackson.databind.ser.ContextualSerializer}) as necessary. + * Either way, serializer will be properly resolved + * (via {@link com.fasterxml.jackson.databind.JsonSerializer#resolve}). * * @param annotated Annotated entity that contained definition * @param serDef Serializer definition: either an instance or class @@ -1039,8 +1037,6 @@ public abstract JsonSerializer serializerInstance(Annotated annotated, * * @param forProperty (optional) If filter is created for a property, that property; * `null` if filter created via defaulting, global or per-type. - * - * @since 2.9 */ public abstract Object includeFilterInstance(BeanPropertyDefinition forProperty, Class filterClass) @@ -1049,8 +1045,6 @@ public abstract Object includeFilterInstance(BeanPropertyDefinition forProperty, /** * Follow-up method that may be called after calling {@link #includeFilterInstance}, * to check handling of `null` values by the filter. - * - * @since 2.9 */ public abstract boolean includeFilterSuppressNulls(Object filter) throws JsonMappingException; @@ -1064,8 +1058,8 @@ public abstract boolean includeFilterSuppressNulls(Object filter) /** * Method called for primary property serializers (ones * directly created to serialize values of a POJO property), - * to handle details of resolving - * {@link ContextualSerializer} with given property context. + * to handle details of contextualization, calling + * {@link JsonSerializer#createContextual(SerializerProvider, BeanProperty)} with given property context. * * @param property Property for which the given primary serializer is used; never null. */ @@ -1074,9 +1068,7 @@ public JsonSerializer handlePrimaryContextualization(JsonSerializer ser, throws JsonMappingException { if (ser != null) { - if (ser instanceof ContextualSerializer) { - ser = ((ContextualSerializer) ser).createContextual(this, property); - } + ser = ser.createContextual(this, property); } return ser; } @@ -1086,29 +1078,25 @@ public JsonSerializer handlePrimaryContextualization(JsonSerializer ser, * NOT directly created to serialize values of a POJO property * but instead created as a dependant serializer -- such as value serializers * for structured types, or serializers for root values) - * to handle details of resolving - * {@link ContextualDeserializer} with given property context. + * to handle details of contextualization, calling + * {@link JsonSerializer#createContextual(SerializerProvider, BeanProperty)} with given property context. * Given that these serializers are not directly related to given property * (or, in case of root value property, to any property), annotations * accessible may or may not be relevant. * * @param property Property for which serializer is used, if any; null * when deserializing root values - * - * @since 2.3 */ public JsonSerializer handleSecondaryContextualization(JsonSerializer ser, BeanProperty property) throws JsonMappingException { if (ser != null) { - if (ser instanceof ContextualSerializer) { - ser = ((ContextualSerializer) ser).createContextual(this, property); - } + ser = ser.createContextual(this, property); } return ser; } - + /* /******************************************************** /* Convenience methods for serializing using default methods diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/AbstractDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/AbstractDeserializer.java index 4937cdfdc3..00287f61d7 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/AbstractDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/AbstractDeserializer.java @@ -25,8 +25,7 @@ */ public class AbstractDeserializer extends JsonDeserializer - implements ContextualDeserializer, // since 2.9 - java.io.Serializable + implements java.io.Serializable { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBase.java b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBase.java index aa34f0d90f..0d62e1e664 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBase.java @@ -25,8 +25,7 @@ */ public abstract class BeanDeserializerBase extends StdDeserializer - implements ContextualDeserializer, - ValueInstantiator.Gettable, + implements ValueInstantiator.Gettable, java.io.Serializable { private static final long serialVersionUID = 1; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/ContextualDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/ContextualDeserializer.java index 39d0aef2e3..f002c231a0 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/ContextualDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/ContextualDeserializer.java @@ -3,39 +3,11 @@ import com.fasterxml.jackson.databind.*; /** - * Add-on interface that {@link JsonDeserializer}s can implement to get a callback - * that can be used to create contextual (context-dependent) instances of - * deserializer to use for handling properties of supported type. - * This can be useful - * for deserializers that can be configured by annotations, or should otherwise - * have differing behavior depending on what kind of property is being deserialized. - *

- * Note that in cases where deserializer needs both contextualization and - * resolution -- resolution occurs first, and contextual - * resolution (via this interface) later on. + * @deprecated Since 3.0: method demoted to JsonDeserializer */ +@Deprecated public interface ContextualDeserializer { - /** - * Method called to see if a different (or differently configured) deserializer - * is needed to deserialize values of specified property. - * Note that instance that this method is called on is typically shared one and - * as a result method should NOT modify this instance but rather construct - * and return a new instance. This instance should only be returned as-is, in case - * it is already suitable for use. - * - * @param ctxt Deserialization context to access configuration, additional - * deserializers that may be needed by this deserializer - * @param property Method, field or constructor parameter that represents the property - * (and is used to assign deserialized value). - * Should be available; but there may be cases where caller cannot provide it and - * null is passed instead (in which case impls usually pass 'this' deserializer as is) - * - * @return Deserializer to use for deserializing values of specified property; - * may be this instance or a new instance. - * - * @throws JsonMappingException - */ public JsonDeserializer createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java b/src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java index be1569c89a..217a85a370 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/DeserializerCache.java @@ -121,7 +121,7 @@ public void flushCachedDeserializers() { *

* Note also that deserializer returned is guaranteed to be resolved * (see {@link JsonDeserializer#resolve}), but - * not contextualized (wrt {@link ContextualDeserializer}): caller + * not contextualized (wrt {@link JsonDeserializer#createContextual}): caller * has to handle latter if necessary. * * @param ctxt Deserialization context diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/CollectionDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/CollectionDeserializer.java index a3e23ac4d0..bd72a243e6 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/CollectionDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/CollectionDeserializer.java @@ -27,7 +27,6 @@ @JacksonStdImpl public class CollectionDeserializer extends ContainerDeserializerBase> - implements ContextualDeserializer { private static final long serialVersionUID = -1L; // since 2.5 diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/DateDeserializers.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/DateDeserializers.java index 14bddb3ba6..33580df17c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/DateDeserializers.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/DateDeserializers.java @@ -13,7 +13,6 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.util.ClassUtil; import com.fasterxml.jackson.databind.util.StdDateFormat; @@ -68,7 +67,6 @@ public static JsonDeserializer find(Class rawType, String clsName) protected abstract static class DateBasedDeserializer extends StdScalarDeserializer - implements ContextualDeserializer { /** * Specific format to use, if non-null; if null will diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/DelegatingDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/DelegatingDeserializer.java index 92798e271e..5367d455fd 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/DelegatingDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/DelegatingDeserializer.java @@ -18,7 +18,6 @@ */ public abstract class DelegatingDeserializer extends StdDeserializer - implements ContextualDeserializer { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java index 9d5ed53f41..c854156533 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumDeserializer.java @@ -8,7 +8,6 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; import com.fasterxml.jackson.databind.deser.ValueInstantiator; import com.fasterxml.jackson.databind.introspect.AnnotatedMethod; @@ -20,10 +19,9 @@ * Deserializer class that can deserialize instances of * specified Enum class from Strings and Integers. */ -@JacksonStdImpl // was missing until 2.6 +@JacksonStdImpl public class EnumDeserializer extends StdScalarDeserializer - implements ContextualDeserializer { private static final long serialVersionUID = 1L; @@ -83,8 +81,6 @@ public static JsonDeserializer deserializerForCreator(DeserializationConfig c * using a zero-/no-args factory method * * @return Deserializer based on given no-args factory method - * - * @since 2.8 */ public static JsonDeserializer deserializerForNoArgsCreator(DeserializationConfig config, Class enumClass, AnnotatedMethod factory) @@ -96,9 +92,6 @@ public static JsonDeserializer deserializerForNoArgsCreator(DeserializationCo return new FactoryBasedEnumDeserializer(enumClass, factory); } - /** - * @since 2.9 - */ public EnumDeserializer withResolved(Boolean caseInsensitive) { if (_caseInsensitive == caseInsensitive) { return this; @@ -106,7 +99,7 @@ public EnumDeserializer withResolved(Boolean caseInsensitive) { return new EnumDeserializer(this, caseInsensitive); } - @Override // since 2.9 + @Override public JsonDeserializer createContextual(DeserializationContext ctxt, BeanProperty property) throws JsonMappingException { diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumMapDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumMapDeserializer.java index a1732b156d..66b0c78ced 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumMapDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumMapDeserializer.java @@ -20,7 +20,6 @@ @SuppressWarnings({ "unchecked", "rawtypes" }) public class EnumMapDeserializer extends ContainerDeserializerBase> - implements ContextualDeserializer { private static final long serialVersionUID = 1; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumSetDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumSetDeserializer.java index 08ceee8c1a..c5799de859 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumSetDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/EnumSetDeserializer.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; /** @@ -18,7 +17,6 @@ @SuppressWarnings("rawtypes") public class EnumSetDeserializer extends StdDeserializer> - implements ContextualDeserializer { private static final long serialVersionUID = 1L; // since 2.5 diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/FactoryBasedEnumDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/FactoryBasedEnumDeserializer.java index 96c6c8d6e8..8b4f1ecfa0 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/FactoryBasedEnumDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/FactoryBasedEnumDeserializer.java @@ -7,7 +7,6 @@ import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; import com.fasterxml.jackson.databind.deser.ValueInstantiator; import com.fasterxml.jackson.databind.deser.impl.PropertyBasedCreator; @@ -19,12 +18,9 @@ /** * Deserializer that uses a single-String static factory method * for locating Enum values by String id. - * - * @since 2.8 (as stand-alone class; was static inner class of {@link EnumDeserializer} */ class FactoryBasedEnumDeserializer extends StdDeserializer - implements ContextualDeserializer { private static final long serialVersionUID = 1; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/MapDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/MapDeserializer.java index fb5f5175b1..62993b36ba 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/MapDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/MapDeserializer.java @@ -29,7 +29,6 @@ @JacksonStdImpl public class MapDeserializer extends ContainerDeserializerBase> - implements ContextualDeserializer { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/MapEntryDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/MapEntryDeserializer.java index 6480416f04..4d4168b328 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/MapEntryDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/MapEntryDeserializer.java @@ -21,7 +21,6 @@ @JacksonStdImpl public class MapEntryDeserializer extends ContainerDeserializerBase> - implements ContextualDeserializer { private static final long serialVersionUID = 1; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/ObjectArrayDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/ObjectArrayDeserializer.java index dbfcf05792..797bab6e6c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/ObjectArrayDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/ObjectArrayDeserializer.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.deser.NullValueProvider; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.util.AccessPattern; @@ -21,7 +20,6 @@ @JacksonStdImpl public class ObjectArrayDeserializer extends ContainerDeserializerBase - implements ContextualDeserializer { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/PrimitiveArrayDeserializers.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/PrimitiveArrayDeserializers.java index 13454ad8db..8e6795f57c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/PrimitiveArrayDeserializers.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/PrimitiveArrayDeserializers.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.deser.NullValueProvider; import com.fasterxml.jackson.databind.deser.impl.NullsConstantProvider; import com.fasterxml.jackson.databind.deser.impl.NullsFailProvider; @@ -23,8 +22,8 @@ * arrays that contain non-object java primitive types. */ @SuppressWarnings("serial") -public abstract class PrimitiveArrayDeserializers extends StdDeserializer - implements ContextualDeserializer // since 2.7 +public abstract class PrimitiveArrayDeserializers + extends StdDeserializer { /** * Specific override for this instance (from proper, or global per-type overrides) diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/ReferenceTypeDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/ReferenceTypeDeserializer.java index 9819ee31d6..bec3101bce 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/ReferenceTypeDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/ReferenceTypeDeserializer.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.core.JsonToken; import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.deser.ValueInstantiator; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.type.ReferenceType; @@ -19,9 +18,8 @@ */ public abstract class ReferenceTypeDeserializer extends StdDeserializer - implements ContextualDeserializer { - private static final long serialVersionUID = 2L; // 2.9 + private static final long serialVersionUID = 2L; /** * Full type of property (or root value) for which this deserializer diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDelegatingDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDelegatingDeserializer.java index 089311905e..6727a4ed42 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDelegatingDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDelegatingDeserializer.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.util.ClassUtil; import com.fasterxml.jackson.databind.util.Converter; @@ -31,7 +30,6 @@ */ public class StdDelegatingDeserializer extends StdDeserializer - implements ContextualDeserializer { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java index 509a943b27..6122ce2268 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdDeserializer.java @@ -67,7 +67,7 @@ protected StdDeserializer(JavaType valueType) { /** * Copy-constructor for sub-classes to use, most often when creating - * new instances for {@link com.fasterxml.jackson.databind.deser.ContextualDeserializer}. + * new instances via {@link com.fasterxml.jackson.databind.JsonDeserializer#createContextual}. */ protected StdDeserializer(StdDeserializer src) { _valueClass = src._valueClass; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdNodeBasedDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdNodeBasedDeserializer.java index 2bd9d1f02a..735820ddc1 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/StdNodeBasedDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/StdNodeBasedDeserializer.java @@ -37,7 +37,7 @@ protected StdNodeBasedDeserializer(Class targetType) { /** * "Copy-constructor" used when creating a modified copies, most often - * if sub-class implements {@link com.fasterxml.jackson.databind.deser.ContextualDeserializer}. + * if sub-class overrides {@link com.fasterxml.jackson.databind.JsonDeserializer#createContextual}. */ protected StdNodeBasedDeserializer(StdNodeBasedDeserializer src) { super(src); diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/StringArrayDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/StringArrayDeserializer.java index df8fba83c2..dcefad1e42 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/StringArrayDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/StringArrayDeserializer.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.deser.NullValueProvider; import com.fasterxml.jackson.databind.deser.impl.NullsConstantProvider; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; @@ -24,7 +23,6 @@ public final class StringArrayDeserializer // extends ContainerDeserializerBase // but for now won't: extends StdDeserializer - implements ContextualDeserializer { private static final long serialVersionUID = 2L; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/StringCollectionDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/StringCollectionDeserializer.java index 7e5095c9bb..2c82ef8b6f 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/StringCollectionDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/StringCollectionDeserializer.java @@ -7,7 +7,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.deser.NullValueProvider; import com.fasterxml.jackson.databind.deser.ValueInstantiator; import com.fasterxml.jackson.databind.introspect.AnnotatedWithParams; @@ -21,7 +20,6 @@ @JacksonStdImpl public final class StringCollectionDeserializer extends ContainerDeserializerBase> - implements ContextualDeserializer { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/UntypedObjectDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/UntypedObjectDeserializer.java index 0c7709d930..8b17c0f2c7 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/UntypedObjectDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/UntypedObjectDeserializer.java @@ -6,7 +6,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.jsontype.TypeDeserializer; import com.fasterxml.jackson.databind.type.TypeFactory; import com.fasterxml.jackson.databind.util.ClassUtil; @@ -25,7 +24,6 @@ @JacksonStdImpl public class UntypedObjectDeserializer extends StdDeserializer - implements ContextualDeserializer { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/fasterxml/jackson/databind/ext/XMLGregorianCalendarSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ext/XMLGregorianCalendarSerializer.java index 1454593407..9483d98724 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ext/XMLGregorianCalendarSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ext/XMLGregorianCalendarSerializer.java @@ -13,14 +13,12 @@ import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.ser.std.CalendarSerializer; import com.fasterxml.jackson.databind.ser.std.StdSerializer; @SuppressWarnings("serial") public class XMLGregorianCalendarSerializer extends StdSerializer - implements ContextualSerializer { final static XMLGregorianCalendarSerializer instance = new XMLGregorianCalendarSerializer(); diff --git a/src/main/java/com/fasterxml/jackson/databind/ext/jdk8/Jdk8StreamSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ext/jdk8/Jdk8StreamSerializer.java index 7a06c3290f..9646876cf0 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ext/jdk8/Jdk8StreamSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ext/jdk8/Jdk8StreamSerializer.java @@ -2,7 +2,6 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.ser.std.StdSerializer; import java.io.IOException; @@ -13,7 +12,7 @@ * Common typed stream serializer * */ -public class Jdk8StreamSerializer extends StdSerializer> implements ContextualSerializer +public class Jdk8StreamSerializer extends StdSerializer> { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/AnyGetterWriter.java b/src/main/java/com/fasterxml/jackson/databind/ser/AnyGetterWriter.java index 045adeaea7..a586a5d92e 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/AnyGetterWriter.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/AnyGetterWriter.java @@ -96,12 +96,10 @@ public void getAndFilter(Object bean, JsonGenerator gen, SerializerProvider prov public void resolve(SerializerProvider provider) throws JsonMappingException { // 05-Sep-2013, tatu: I _think_ this can be considered a primary property... - if (_serializer instanceof ContextualSerializer) { - JsonSerializer ser = provider.handlePrimaryContextualization(_serializer, _property); - _serializer = (JsonSerializer) ser; - if (ser instanceof MapSerializer) { - _mapSerializer = (MapSerializer) ser; - } + JsonSerializer ser = provider.handlePrimaryContextualization(_serializer, _property); + _serializer = (JsonSerializer) ser; + if (ser instanceof MapSerializer) { + _mapSerializer = (MapSerializer) ser; } } } diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/ContextualSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/ContextualSerializer.java index 2ace93b9e2..0cd974f36d 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/ContextualSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/ContextualSerializer.java @@ -3,37 +3,11 @@ import com.fasterxml.jackson.databind.*; /** - * Add-on interface that {@link JsonSerializer}s can implement to get a callback - * that can be used to create contextual instances of serializer to use for - * handling properties of supported type. This can be useful - * for serializers that can be configured by annotations, or should otherwise - * have differing behavior depending on what kind of property is being serialized. - *

- * Note that in cases where serializer needs both contextualization and - * resolution, resolution occurs first, and contextual - * resolution (via this interface) later on. + * @deprecated Since 3.0: method demoted to JsonSerializer */ +@Deprecated public interface ContextualSerializer { - /** - * Method called to see if a different (or differently configured) serializer - * is needed to serialize values of specified property. - * Note that instance that this method is called on is typically shared one and - * as a result method should NOT modify this instance but rather construct - * and return a new instance. This instance should only be returned as-is, in case - * it is already suitable for use. - * - * @param prov Serializer provider to use for accessing config, other serializers - * @param property Method or field that represents the property - * (and is used to access value to serialize). - * Should be available; but there may be cases where caller cannot provide it and - * null is passed instead (in which case impls usually pass 'this' serializer as is) - * - * @return Serializer to use for serializing values of specified property; - * may be this instance or a new instance. - * - * @throws JsonMappingException - */ public JsonSerializer createContextual(SerializerProvider prov, BeanProperty property) throws JsonMappingException; } diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/impl/MapEntrySerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/impl/MapEntrySerializer.java index 93b93812e2..84270031d4 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/impl/MapEntrySerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/impl/MapEntrySerializer.java @@ -14,18 +14,13 @@ import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.ContainerSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.util.ArrayBuilders; import com.fasterxml.jackson.databind.util.BeanUtil; -/** - * @since 2.5 - */ @SuppressWarnings("serial") @JacksonStdImpl public class MapEntrySerializer extends ContainerSerializer> - implements ContextualSerializer { public final static Object MARKER_FOR_EMPTY = JsonInclude.Include.NON_EMPTY; diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.java index e528a55817..4901ab2ce1 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/impl/StringArraySerializer.java @@ -11,7 +11,6 @@ import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatTypes; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.ContainerSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.ser.std.ArraySerializerBase; import com.fasterxml.jackson.databind.type.TypeFactory; @@ -22,7 +21,6 @@ @SuppressWarnings("serial") public class StringArraySerializer extends ArraySerializerBase - implements ContextualSerializer { /* Note: not clean in general, but we are betting against * anyone re-defining properties of String.class here... diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/impl/TypeWrappedSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/impl/TypeWrappedSerializer.java index 62ad61d6c4..1a0ae87415 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/impl/TypeWrappedSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/impl/TypeWrappedSerializer.java @@ -5,7 +5,6 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; /** * Simple serializer that will call configured type serializer, passing @@ -14,7 +13,6 @@ */ public final class TypeWrappedSerializer extends JsonSerializer - implements ContextualSerializer // since 2.9 { final protected TypeSerializer _typeSerializer; final protected JsonSerializer _serializer; @@ -56,7 +54,7 @@ public JsonSerializer createContextual(SerializerProvider provider, BeanPrope { // 13-Mar-2017, tatu: Should we call `TypeSerializer.forProperty()`? JsonSerializer ser = _serializer; - if (ser instanceof ContextualSerializer) { + if (ser != null) { ser = provider.handleSecondaryContextualization(ser, property); } if (ser == _serializer) { diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ArraySerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ArraySerializerBase.java index 5ddada7d1b..49d92900e1 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ArraySerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ArraySerializerBase.java @@ -18,7 +18,6 @@ @SuppressWarnings("serial") public abstract class ArraySerializerBase extends ContainerSerializer - implements ContextualSerializer // for 'unwrapSingleElemArray' { protected final BeanProperty _property; @@ -72,27 +71,6 @@ public JsonSerializer createContextual(SerializerProvider serializers, } return this; } - - /* - // NOTE: as of 2.5, sub-classes SHOULD override (in 2.4 and before, was final), - // at least if they can provide access to actual size of value and use `writeStartArray()` - // variant that passes size of array to output, which is helpful with some data formats - @Override - public void serialize(T value, JsonGenerator gen, SerializerProvider provider) throws IOException - { - if (_shouldUnwrapSingle(provider)) { - if (hasSingleElement(value)) { - serializeContents(value, gen, provider); - return; - } - } - gen.setCurrentValue(value); - gen.writeStartArray(); - // [databind#631]: Assign current value, to be accessible by custom serializers - serializeContents(value, gen, provider); - gen.writeEndArray(); - } - */ @Override public final void serializeWithType(T value, JsonGenerator g, SerializerProvider provider, diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java index 3f1021a00b..ce48681643 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/AsArraySerializerBase.java @@ -11,7 +11,6 @@ import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.ContainerSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap; /** @@ -22,7 +21,6 @@ @SuppressWarnings("serial") public abstract class AsArraySerializerBase extends ContainerSerializer - implements ContextualSerializer { protected final JavaType _elementType; diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java index 3d6ac38b67..9151a08f38 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/BeanSerializerBase.java @@ -11,7 +11,6 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.introspect.ObjectIdInfo; -import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; @@ -32,8 +31,6 @@ @SuppressWarnings("serial") public abstract class BeanSerializerBase extends StdSerializer - implements ContextualSerializer, - JsonFormatVisitable { protected final static PropertyName NAME_FOR_OBJECT_REF = new PropertyName("#object-ref"); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/BooleanSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/BooleanSerializer.java index 281ed93e24..2e1bfbd7c9 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/BooleanSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/BooleanSerializer.java @@ -13,7 +13,6 @@ import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; /** * Serializer used for primitive boolean, as well as java.util.Boolean @@ -25,7 +24,6 @@ @JacksonStdImpl public final class BooleanSerializer extends StdScalarSerializer - implements ContextualSerializer { private static final long serialVersionUID = 1L; @@ -75,12 +73,9 @@ public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType t /** * Alternate implementation that is used when values are to be serialized * as numbers 0 (false) or 1 (true). - * - * @since 2.9 */ final static class AsNumber extends StdScalarSerializer - implements ContextualSerializer { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java index 6402f1a395..463ad341f1 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/DateTimeSerializerBase.java @@ -15,13 +15,11 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.jsonFormatVisitors.*; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.util.StdDateFormat; @SuppressWarnings("serial") public abstract class DateTimeSerializerBase extends StdScalarSerializer - implements ContextualSerializer { /** * Flag that indicates that serialization must be done as the diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java index 2f3ee73c52..4813edfeff 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/EnumSerializer.java @@ -12,7 +12,6 @@ import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonStringFormatVisitor; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.util.EnumValues; /** @@ -24,7 +23,6 @@ @JacksonStdImpl public class EnumSerializer extends StdScalarSerializer> - implements ContextualSerializer { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/InetAddressSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/InetAddressSerializer.java index 2bc0e14c10..a7c39ca25d 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/InetAddressSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/InetAddressSerializer.java @@ -11,7 +11,6 @@ import com.fasterxml.jackson.databind.JsonSerializer; import com.fasterxml.jackson.databind.SerializerProvider; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; /** * Simple serializer for {@link java.net.InetAddress}. Main complexity is @@ -25,7 +24,6 @@ @SuppressWarnings("serial") public class InetAddressSerializer extends StdScalarSerializer - implements ContextualSerializer { /** * @since 2.9 diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.java index f0808591a2..40e21ef977 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/JsonValueSerializer.java @@ -11,13 +11,11 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; -import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonStringFormatVisitor; import com.fasterxml.jackson.databind.jsontype.TypeIdResolver; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.BeanSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.util.ClassUtil; /** @@ -36,11 +34,7 @@ @JacksonStdImpl public class JsonValueSerializer extends StdSerializer - implements ContextualSerializer, JsonFormatVisitable { - /** - * @since 2.9 - */ protected final AnnotatedMember _accessor; protected final JsonSerializer _valueSerializer; diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java index 8521a5fc73..015fb0d44c 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/MapSerializer.java @@ -17,7 +17,6 @@ import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonMapFormatVisitor; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.ContainerSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.ser.PropertyFilter; import com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap; import com.fasterxml.jackson.databind.type.TypeFactory; @@ -34,7 +33,6 @@ @JacksonStdImpl public class MapSerializer extends ContainerSerializer> - implements ContextualSerializer { private static final long serialVersionUID = 1L; diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java index 3cca59b101..e05e17ede1 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/NumberSerializers.java @@ -11,7 +11,6 @@ import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; /** * Container class for serializers used for handling standard JDK-provided @@ -46,7 +45,7 @@ public static void addAll(Map> allDeserializers) { */ protected abstract static class Base extends StdScalarSerializer - implements ContextualSerializer { + { protected final JsonParser.NumberType _numberType; protected final String _schemaType; protected final boolean _isInt; diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ObjectArraySerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ObjectArraySerializer.java index 1d0c2c47bc..c4f6289156 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ObjectArraySerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ObjectArraySerializer.java @@ -13,7 +13,6 @@ import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; import com.fasterxml.jackson.databind.ser.ContainerSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap; /** @@ -23,7 +22,6 @@ @SuppressWarnings("serial") public class ObjectArraySerializer extends ArraySerializerBase - implements ContextualSerializer { /** * Whether we are using static typing (using declared types, ignoring diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/ReferenceTypeSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/ReferenceTypeSerializer.java index 6fd17451b8..eabf8fe73b 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/ReferenceTypeSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/ReferenceTypeSerializer.java @@ -9,7 +9,6 @@ import com.fasterxml.jackson.databind.introspect.Annotated; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.ser.impl.PropertySerializerMap; import com.fasterxml.jackson.databind.type.ReferenceType; import com.fasterxml.jackson.databind.util.ArrayBuilders; @@ -23,13 +22,9 @@ */ public abstract class ReferenceTypeSerializer extends StdSerializer - implements ContextualSerializer { private static final long serialVersionUID = 1L; - /** - * @since 2.9 - */ public final static Object MARKER_FOR_EMPTY = JsonInclude.Include.NON_EMPTY; /** diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.java index eb9b3e8b29..db48211d25 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StaticListSerializerBase.java @@ -10,7 +10,6 @@ import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonArrayFormatVisitor; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; /** * Intermediate base class for Lists, Collections and Arrays @@ -19,14 +18,11 @@ @SuppressWarnings("serial") public abstract class StaticListSerializerBase> extends StdSerializer - implements ContextualSerializer { /** * Setting for specific local override for "unwrap single element arrays": * true for enable unwrapping, false for preventing it, `null` for using * global configuration. - * - * @since 2.6 */ protected final Boolean _unwrapSingle; @@ -35,18 +31,12 @@ protected StaticListSerializerBase(Class cls) { _unwrapSingle = null; } - /** - * @since 2.9 - */ protected StaticListSerializerBase(StaticListSerializerBase src, Boolean unwrapSingle) { super(src); _unwrapSingle = unwrapSingle; } - /** - * @since 2.9 - */ public abstract JsonSerializer _withResolved(BeanProperty prop, Boolean unwrapSingle); diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java index 53b76ec394..cc5a2fef51 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/std/StdDelegatingSerializer.java @@ -5,10 +5,8 @@ import com.fasterxml.jackson.core.JsonGenerator; import com.fasterxml.jackson.databind.*; -import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitable; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonFormatVisitorWrapper; import com.fasterxml.jackson.databind.jsontype.TypeSerializer; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.util.ClassUtil; import com.fasterxml.jackson.databind.util.Converter; @@ -23,8 +21,6 @@ @SuppressWarnings("serial") public class StdDelegatingSerializer extends StdSerializer - implements ContextualSerializer, - JsonFormatVisitable { protected final Converter _converter; @@ -115,7 +111,7 @@ public JsonSerializer createContextual(SerializerProvider provider, BeanPrope delSer = provider.findValueSerializer(delegateType); } } - if (delSer instanceof ContextualSerializer) { + if (delSer != null) { delSer = provider.handleSecondaryContextualization(delSer, property); } if (delSer == _delegateSerializer && delegateType == _delegateType) { diff --git a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualDeserialization.java b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualDeserialization.java index 19ab6df333..0a0fd43c12 100644 --- a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualDeserialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualDeserialization.java @@ -12,7 +12,6 @@ import com.fasterxml.jackson.core.Version; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer; import com.fasterxml.jackson.databind.module.SimpleModule; @@ -88,7 +87,6 @@ static class ContextualMapBean static class MyContextualDeserializer extends JsonDeserializer - implements ContextualDeserializer { protected final String _fieldName; @@ -118,7 +116,6 @@ public JsonDeserializer createContextual(DeserializationContext ctxt, */ static class AnnotatedContextualDeserializer extends JsonDeserializer - implements ContextualDeserializer { protected final String _fieldName; @@ -149,7 +146,6 @@ public JsonDeserializer createContextual(DeserializationContext ctxt, static class GenericStringDeserializer extends StdScalarDeserializer - implements ContextualDeserializer { final String _value; diff --git a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualKeyTypes.java b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualKeyTypes.java index 6705e2cc33..b2aa43b90b 100644 --- a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualKeyTypes.java +++ b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualKeyTypes.java @@ -10,7 +10,6 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.ContextualKeyDeserializer; import com.fasterxml.jackson.databind.module.SimpleModule; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; import com.fasterxml.jackson.databind.type.TypeFactory; /** @@ -27,7 +26,6 @@ public class TestContextualKeyTypes extends BaseMapTest static class ContextualKeySerializer extends JsonSerializer - implements ContextualSerializer { protected final String _prefix; diff --git a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualSerialization.java b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualSerialization.java index c16472e30d..480c7dd7e5 100644 --- a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualSerialization.java +++ b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualSerialization.java @@ -10,7 +10,6 @@ import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.module.SimpleModule; -import com.fasterxml.jackson.databind.ser.ContextualSerializer; /** * Test cases to verify that it is possible to define serializers @@ -123,7 +122,6 @@ static class BeanWithClassConfig */ static class AnnotatedContextualSerializer extends JsonSerializer - implements ContextualSerializer { protected final String _prefix; @@ -159,7 +157,6 @@ public JsonSerializer createContextual(SerializerProvider prov, BeanProperty static class ContextualAndResolvable extends JsonSerializer - implements ContextualSerializer { protected int isContextual; protected int isResolved; diff --git a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualWithAnnDeserializer.java b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualWithAnnDeserializer.java index e019014b95..4682f5fd49 100644 --- a/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualWithAnnDeserializer.java +++ b/src/test/java/com/fasterxml/jackson/databind/contextual/TestContextualWithAnnDeserializer.java @@ -10,7 +10,6 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JsonDeserialize; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; public class TestContextualWithAnnDeserializer extends BaseMapTest { @@ -36,7 +35,6 @@ static class AnnotatedContextualClassBean static class AnnotatedContextualDeserializer extends JsonDeserializer - implements ContextualDeserializer { protected final String _fieldName; diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestBeanDeserializer.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestBeanDeserializer.java index cf7fb59bc5..f2121425c2 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestBeanDeserializer.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestBeanDeserializer.java @@ -103,7 +103,6 @@ static class Issue476Type { public String name, value; } static class Issue476Deserializer extends BeanDeserializer - implements ContextualDeserializer { protected static int propCount; diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/TestCustomDeserializers.java b/src/test/java/com/fasterxml/jackson/databind/deser/TestCustomDeserializers.java index f947adda80..cc1ff212d4 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/TestCustomDeserializers.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/TestCustomDeserializers.java @@ -167,7 +167,6 @@ static class Bean375Inner { } static class Bean375OuterDeserializer extends StdDeserializer - implements ContextualDeserializer { protected BeanProperty prop; @@ -191,7 +190,6 @@ public JsonDeserializer createContextual(DeserializationContext ctxt, BeanPro } static class Bean375InnerDeserializer extends StdDeserializer - implements ContextualDeserializer { protected boolean negative; diff --git a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java index 90eca04b84..d50a1f07ba 100644 --- a/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java +++ b/src/test/java/com/fasterxml/jackson/databind/deser/jdk/UntypedDeserializationTest.java @@ -11,7 +11,6 @@ import com.fasterxml.jackson.core.*; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.ObjectMapper.DefaultTyping; -import com.fasterxml.jackson.databind.deser.ContextualDeserializer; import com.fasterxml.jackson.databind.deser.std.StdDeserializer; import com.fasterxml.jackson.databind.deser.std.StdScalarDeserializer; import com.fasterxml.jackson.databind.module.SimpleModule; @@ -53,7 +52,6 @@ public Number deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx // Let's make this Contextual, to tease out cyclic resolution issues, if any static class ListDeserializer extends StdDeserializer> - implements ContextualDeserializer { public ListDeserializer() { super(List.class); }