diff --git a/src/main/java/com/fasterxml/jackson/databind/BeanProperty.java b/src/main/java/com/fasterxml/jackson/databind/BeanProperty.java index ddad8232d7..ac357934db 100644 --- a/src/main/java/com/fasterxml/jackson/databind/BeanProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/BeanProperty.java @@ -5,6 +5,7 @@ import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat.Value; import com.fasterxml.jackson.annotation.JsonInclude; + import com.fasterxml.jackson.databind.cfg.MapperConfig; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; import com.fasterxml.jackson.databind.jsonFormatVisitors.JsonObjectFormatVisitor; @@ -216,29 +217,32 @@ public static class Std implements BeanProperty, */ protected final AnnotatedMember _member; - /** - * Annotations defined in the context class (if any); may be null - * if no annotations were found - */ - protected final transient Annotations _contextAnnotations; - public Std(PropertyName name, JavaType type, PropertyName wrapperName, - Annotations contextAnnotations, AnnotatedMember member, - PropertyMetadata metadata) + AnnotatedMember member, PropertyMetadata metadata) { _name = name; _type = type; _wrapperName = wrapperName; _metadata = metadata; _member = member; - _contextAnnotations = contextAnnotations; + } + + /** + * @deprecated Since 2.9 + */ + @Deprecated + public Std(PropertyName name, JavaType type, PropertyName wrapperName, + Annotations contextAnnotations, + AnnotatedMember member, PropertyMetadata metadata) + { + this(name, type, wrapperName, member, metadata); } /** * @since 2.6 */ public Std(Std base, JavaType newType) { - this(base._name, newType, base._wrapperName, base._contextAnnotations, base._member, base._metadata); + this(base._name, newType, base._wrapperName, base._member, base._metadata); } public Std withType(JavaType type) { @@ -252,7 +256,7 @@ public A getAnnotation(Class acls) { @Override public A getContextAnnotation(Class acls) { - return (_contextAnnotations == null) ? null : _contextAnnotations.get(acls); + return null; } @Override diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java b/src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java index 4e66907520..dadfcd3762 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/BasicDeserializerFactory.java @@ -841,8 +841,7 @@ protected SettableBeanProperty constructCreatorProperty(DeserializationContext c } JavaType type = resolveMemberAndTypeAnnotations(ctxt, param, param.getType()); BeanProperty.Std property = new BeanProperty.Std(name, type, - intr.findWrapperName(param), - beanDesc.getClassAnnotations(), param, metadata); + intr.findWrapperName(param), param, metadata); // Type deserializer: either comes from property (and already resolved) TypeDeserializer typeDeser = (TypeDeserializer) type.getTypeHandler(); // or if not, based on type being referenced: diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java index f06fd143ef..245d7baf14 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializer.java @@ -88,9 +88,8 @@ public BeanDeserializer(BeanDeserializerBase src, BeanPropertyMap props) { @Override public JsonDeserializer unwrappingDeserializer(NameTransformer unwrapper) { - /* bit kludgy but we don't want to accidentally change type; sub-classes - * MUST override this method to support unwrapped properties... - */ + // bit kludgy but we don't want to accidentally change type; sub-classes + // MUST override this method to support unwrapped properties... if (getClass() != BeanDeserializer.class) { return this; } 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 000db4b60b..9e277a9ff3 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBase.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBase.java @@ -39,16 +39,6 @@ public abstract class BeanDeserializerBase /********************************************************** */ - /** - * Annotations from the bean class: used for accessing - * annotations during resolution - * (see {@link #resolve}) and - * contextualization (see {@link #createContextual}) - *

- * Transient since annotations only used during construction. - */ - final private transient Annotations _classAnnotations; - /** * Declared type of the bean this deserializer handles. */ @@ -209,9 +199,6 @@ protected BeanDeserializerBase(BeanDeserializerBuilder builder, boolean hasViews) { super(beanDesc.getType()); - - AnnotatedClass ac = beanDesc.getClassInfo(); - _classAnnotations = ac.getAnnotations(); _beanType = beanDesc.getType(); _valueInstantiator = builder.getValueInstantiator(); @@ -253,7 +240,6 @@ protected BeanDeserializerBase(BeanDeserializerBase src, boolean ignoreAllUnknow { super(src._beanType); - _classAnnotations = src._classAnnotations; _beanType = src._beanType; _valueInstantiator = src._valueInstantiator; @@ -280,7 +266,6 @@ protected BeanDeserializerBase(BeanDeserializerBase src, NameTransformer unwrapp { super(src._beanType); - _classAnnotations = src._classAnnotations; _beanType = src._beanType; _valueInstantiator = src._valueInstantiator; @@ -318,8 +303,6 @@ protected BeanDeserializerBase(BeanDeserializerBase src, NameTransformer unwrapp public BeanDeserializerBase(BeanDeserializerBase src, ObjectIdReader oir) { super(src._beanType); - - _classAnnotations = src._classAnnotations; _beanType = src._beanType; _valueInstantiator = src._valueInstantiator; @@ -357,20 +340,18 @@ public BeanDeserializerBase(BeanDeserializerBase src, ObjectIdReader oir) public BeanDeserializerBase(BeanDeserializerBase src, Set ignorableProps) { super(src._beanType); - - _classAnnotations = src._classAnnotations; _beanType = src._beanType; _valueInstantiator = src._valueInstantiator; _delegateDeserializer = src._delegateDeserializer; _propertyBasedCreator = src._propertyBasedCreator; - + _backRefs = src._backRefs; _ignorableProps = ignorableProps; _ignoreAllUnknown = src._ignoreAllUnknown; _anySetter = src._anySetter; _injectables = src._injectables; - + _nonStandardCreation = src._nonStandardCreation; _unwrappedPropertyHandler = src._unwrappedPropertyHandler; _needViewProcesing = src._needViewProcesing; @@ -390,14 +371,12 @@ public BeanDeserializerBase(BeanDeserializerBase src, Set ignorableProps protected BeanDeserializerBase(BeanDeserializerBase src, BeanPropertyMap beanProps) { super(src._beanType); - - _classAnnotations = src._classAnnotations; _beanType = src._beanType; - + _valueInstantiator = src._valueInstantiator; _delegateDeserializer = src._delegateDeserializer; _propertyBasedCreator = src._propertyBasedCreator; - + _beanProperties = beanProps; _backRefs = src._backRefs; _ignorableProps = src._ignorableProps; @@ -631,7 +610,7 @@ private JsonDeserializer _findDelegateDeserializer(DeserializationContex AnnotatedWithParams delegateCreator) throws JsonMappingException { // Need to create a temporary property to allow contextual deserializers: BeanProperty.Std property = new BeanProperty.Std(TEMP_PROPERTY_NAME, - delegateType, null, _classAnnotations, delegateCreator, + delegateType, null, delegateCreator, PropertyMetadata.STD_OPTIONAL); TypeDeserializer td = delegateType.getTypeHandler(); @@ -798,8 +777,7 @@ protected SettableBeanProperty _resolveManagedReferenceProperty(DeserializationC refName, backRefType.getRawClass().getName(), referredType.getRawClass().getName())); } - return new ManagedReferenceProperty(prop, refName, backProp, - _classAnnotations, isContainer); + return new ManagedReferenceProperty(prop, refName, backProp, isContainer); } /** diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBuilder.java b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBuilder.java index eaaaad34e9..e374fb2114 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBuilder.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerBuilder.java @@ -215,8 +215,7 @@ public void addInjectable(PropertyName propName, JavaType propType, if (fixAccess) { member.fixAccess(forceAccess); } - _injectables.add(new ValueInjector(propName, propType, - contextAnnotations, member, valueId)); + _injectables.add(new ValueInjector(propName, propType, member, valueId)); } /** diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java index 3ee5e2a74e..efb657784f 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/BeanDeserializerFactory.java @@ -680,7 +680,7 @@ protected SettableAnyProperty constructAnySetter(DeserializationContext ctxt, valueType = am.getParameterType(1); valueType = resolveMemberAndTypeAnnotations(ctxt, mutator, valueType); prop = new BeanProperty.Std(PropertyName.construct(mutator.getName()), - valueType, null, beanDesc.getClassAnnotations(), mutator, + valueType, null, mutator, PropertyMetadata.STD_OPTIONAL); } else if (mutator instanceof AnnotatedField) { @@ -691,8 +691,7 @@ protected SettableAnyProperty constructAnySetter(DeserializationContext ctxt, keyType = mapType.getKeyType(); valueType = mapType.getContentType(); prop = new BeanProperty.Std(PropertyName.construct(mutator.getName()), - mapType, null, beanDesc.getClassAnnotations(), mutator, - PropertyMetadata.STD_OPTIONAL); + mapType, null, mutator, PropertyMetadata.STD_OPTIONAL); } else { return ctxt.reportBadDefinition(beanDesc.getType(), String.format( "Unrecognized mutator type for any setter: %s", mutator.getClass())); diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/ManagedReferenceProperty.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/ManagedReferenceProperty.java index 757b616286..f0cbfda06d 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/ManagedReferenceProperty.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/ManagedReferenceProperty.java @@ -7,7 +7,6 @@ import com.fasterxml.jackson.core.JsonParser; import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.deser.SettableBeanProperty; -import com.fasterxml.jackson.databind.util.Annotations; /** * Wrapper property that is used to handle managed (forward) properties @@ -31,7 +30,7 @@ public final class ManagedReferenceProperty protected final SettableBeanProperty _backProperty; public ManagedReferenceProperty(SettableBeanProperty forward, String refName, - SettableBeanProperty backward, Annotations contextAnnotations, boolean isContainer) + SettableBeanProperty backward, boolean isContainer) { super(forward); _referenceName = refName; diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/impl/ValueInjector.java b/src/main/java/com/fasterxml/jackson/databind/deser/impl/ValueInjector.java index 59763016d3..815d51cb84 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/impl/ValueInjector.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/impl/ValueInjector.java @@ -2,14 +2,8 @@ import java.io.IOException; -import com.fasterxml.jackson.databind.BeanProperty; -import com.fasterxml.jackson.databind.DeserializationContext; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.PropertyMetadata; -import com.fasterxml.jackson.databind.PropertyName; +import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.introspect.AnnotatedMember; -import com.fasterxml.jackson.databind.util.Annotations; /** * Class that encapsulates details of value injection that occurs before @@ -28,11 +22,9 @@ public class ValueInjector protected final Object _valueId; public ValueInjector(PropertyName propName, JavaType type, - Annotations contextAnnotations, AnnotatedMember mutator, - Object valueId) + AnnotatedMember mutator, Object valueId) { - super(propName, type, null, contextAnnotations, mutator, - PropertyMetadata.STD_OPTIONAL); + super(propName, type, null, mutator, PropertyMetadata.STD_OPTIONAL); _valueId = valueId; } diff --git a/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java b/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java index 1a4a120b72..b324d1abe0 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java +++ b/src/main/java/com/fasterxml/jackson/databind/ser/BeanSerializerFactory.java @@ -560,7 +560,7 @@ protected JsonSerializer constructBeanSerializer(SerializerProvider prov // TODO: can we find full PropertyName? PropertyName name = PropertyName.construct(anyGetter.getName()); BeanProperty.Std anyProp = new BeanProperty.Std(name, valueType, null, - beanDesc.getClassAnnotations(), anyGetter, PropertyMetadata.STD_OPTIONAL); + anyGetter, PropertyMetadata.STD_OPTIONAL); builder.setAnyGetter(new AnyGetterWriter(anyProp, anyGetter, anySer)); } // Next: need to gather view information, if any: @@ -905,7 +905,7 @@ protected BeanPropertyWriter _constructWriter(SerializerProvider prov, final PropertyName name = propDef.getFullName(); JavaType type = accessor.getType(); BeanProperty.Std property = new BeanProperty.Std(name, type, propDef.getWrapperName(), - pb.getClassAnnotations(), accessor, propDef.getMetadata()); + accessor, propDef.getMetadata()); // Does member specify a serializer? If so, let's use it. JsonSerializer annotatedSerializer = findSerializerFromAnnotation(prov,