Skip to content

Commit

Permalink
Yet more deprecation removal for 3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Aug 9, 2017
1 parent df76c4d commit e433f59
Show file tree
Hide file tree
Showing 106 changed files with 100 additions and 3,907 deletions.
Expand Up @@ -30,18 +30,6 @@ public JavaType findTypeMapping(DeserializationConfig config, JavaType type) {
return null; return null;
} }


/**
* Older variant of {@link #resolveAbstractType(DeserializationConfig, BeanDescription)};
* obsoleted in 2.7
*
* @deprecated since 2.8 (may be removed from 2.9 or later)
*/
@Deprecated
public JavaType resolveAbstractType(DeserializationConfig config,
JavaType type) {
return null;
}

/** /**
* Method called to try to resolve an abstract type into * Method called to try to resolve an abstract type into
* concrete type (usually for purposes of deserializing), * concrete type (usually for purposes of deserializing),
Expand All @@ -56,8 +44,6 @@ public JavaType resolveAbstractType(DeserializationConfig config,
* @return Resolved concrete type (which should retain generic * @return Resolved concrete type (which should retain generic
* type parameters of input type, if any), if resolution succeeds; * type parameters of input type, if any), if resolution succeeds;
* null if resolver does not know how to resolve given type * null if resolver does not know how to resolve given type
*
* @since 2.7
*/ */
public JavaType resolveAbstractType(DeserializationConfig config, public JavaType resolveAbstractType(DeserializationConfig config,
BeanDescription typeDesc) { BeanDescription typeDesc) {
Expand Down
Expand Up @@ -51,7 +51,7 @@ public abstract class DeserializationContext
extends DatabindContext extends DatabindContext
implements java.io.Serializable implements java.io.Serializable
{ {
private static final long serialVersionUID = 1L; // 2.6 private static final long serialVersionUID = 3L;


/* /*
/********************************************************** /**********************************************************
Expand Down Expand Up @@ -1351,49 +1351,6 @@ public <T> T reportTrailingTokens(Class<?> targetType,
)); ));
} }


@Deprecated // since 2.9
public void reportWrongTokenException(JsonParser p,
JsonToken expToken, String msg, Object... msgArgs)
throws JsonMappingException
{
msg = _format(msg, msgArgs);
throw wrongTokenException(p, expToken, msg);
}

/**
* Helper method for reporting a problem with unhandled unknown property.
*
* @param instanceOrClass Either value being populated (if one has been
* instantiated), or Class that indicates type that would be (or
* have been) instantiated
* @param deser Deserializer that had the problem, if called by deserializer
* (or on behalf of one)
*
* @deprecated Since 2.8 call {@link #handleUnknownProperty} instead
*/
@Deprecated
public void reportUnknownProperty(Object instanceOrClass, String fieldName,
JsonDeserializer<?> deser)
throws JsonMappingException
{
if (isEnabled(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES)) {
// Do we know properties that are expected instead?
Collection<Object> propIds = (deser == null) ? null : deser.getKnownPropertyNames();
throw UnrecognizedPropertyException.from(_parser,
instanceOrClass, fieldName, propIds);
}
}

/**
* @since 2.8
*
* @deprecated Since 2.9: not clear this ever occurs
*/
@Deprecated // since 2.9
public void reportMissingContent(String msg, Object... msgArgs) throws JsonMappingException {
throw MismatchedInputException.from(getParser(), (JavaType) null, "No content to map due to end-of-input");
}

/* /*
/********************************************************** /**********************************************************
/* Methods for problem reporting, in cases where recovery /* Methods for problem reporting, in cases where recovery
Expand All @@ -1405,8 +1362,6 @@ public void reportMissingContent(String msg, Object... msgArgs) throws JsonMappi
* Helper method called to indicate problem in POJO (serialization) definitions or settings * Helper method called to indicate problem in POJO (serialization) definitions or settings
* regarding specific Java type, unrelated to actual JSON content to map. * regarding specific Java type, unrelated to actual JSON content to map.
* Default behavior is to construct and throw a {@link JsonMappingException}. * Default behavior is to construct and throw a {@link JsonMappingException}.
*
* @since 2.9
*/ */
public <T> T reportBadTypeDefinition(BeanDescription bean, public <T> T reportBadTypeDefinition(BeanDescription bean,
String msg, Object... msgArgs) throws JsonMappingException { String msg, Object... msgArgs) throws JsonMappingException {
Expand All @@ -1420,8 +1375,6 @@ public <T> T reportBadTypeDefinition(BeanDescription bean,
* Helper method called to indicate problem in POJO (serialization) definitions or settings * Helper method called to indicate problem in POJO (serialization) definitions or settings
* regarding specific property (of a type), unrelated to actual JSON content to map. * regarding specific property (of a type), unrelated to actual JSON content to map.
* Default behavior is to construct and throw a {@link JsonMappingException}. * Default behavior is to construct and throw a {@link JsonMappingException}.
*
* @since 2.9
*/ */
public <T> T reportBadPropertyDefinition(BeanDescription bean, BeanPropertyDefinition prop, public <T> T reportBadPropertyDefinition(BeanDescription bean, BeanPropertyDefinition prop,
String msg, Object... msgArgs) throws JsonMappingException { String msg, Object... msgArgs) throws JsonMappingException {
Expand Down Expand Up @@ -1493,13 +1446,6 @@ public JsonMappingException wrongTokenException(JsonParser p, Class<?> targetTyp
msg = _colonConcat(msg, extra); msg = _colonConcat(msg, extra);
return MismatchedInputException.from(p, targetType, msg); return MismatchedInputException.from(p, targetType, msg);
} }

@Deprecated // since 2.9
public JsonMappingException wrongTokenException(JsonParser p, JsonToken expToken,
String msg)
{
return wrongTokenException(p, (JavaType) null, expToken, msg);
}


/** /**
* Helper method for constructing exception to indicate that given JSON * Helper method for constructing exception to indicate that given JSON
Expand Down Expand Up @@ -1527,8 +1473,6 @@ public JsonMappingException weirdKeyException(Class<?> keyClass, String keyValue
* @param value String value from input being deserialized * @param value String value from input being deserialized
* @param instClass Type that String should be deserialized into * @param instClass Type that String should be deserialized into
* @param msg Message that describes specific problem * @param msg Message that describes specific problem
*
* @since 2.1
*/ */
public JsonMappingException weirdStringException(String value, Class<?> instClass, public JsonMappingException weirdStringException(String value, Class<?> instClass,
String msg) { String msg) {
Expand Down
43 changes: 2 additions & 41 deletions src/main/java/com/fasterxml/jackson/databind/JsonDeserializer.java
Expand Up @@ -44,7 +44,7 @@
* contextualization. * contextualization.
*/ */
public abstract class JsonDeserializer<T> public abstract class JsonDeserializer<T>
implements NullValueProvider // since 2.9 implements NullValueProvider
{ {
/* /*
/********************************************************** /**********************************************************
Expand Down Expand Up @@ -179,8 +179,6 @@ public JsonDeserializer<T> unwrappingDeserializer(NameTransformer unwrapper) {
* delegate anything; or it does not want any changes), should either * delegate anything; or it does not want any changes), should either
* throw {@link UnsupportedOperationException} (if operation does not * throw {@link UnsupportedOperationException} (if operation does not
* make sense or is not allowed); or return this deserializer as is. * make sense or is not allowed); or return this deserializer as is.
*
* @since 2.1
*/ */
public JsonDeserializer<?> replaceDelegatee(JsonDeserializer<?> delegatee) { public JsonDeserializer<?> replaceDelegatee(JsonDeserializer<?> delegatee) {
throw new UnsupportedOperationException(); throw new UnsupportedOperationException();
Expand All @@ -202,8 +200,6 @@ public JsonDeserializer<?> replaceDelegatee(JsonDeserializer<?> delegatee) {
* Default implementation will return null, which means almost same * Default implementation will return null, which means almost same
* same as returning <code>Object.class</code> would; that is, that * same as returning <code>Object.class</code> would; that is, that
* nothing is known about handled type. * nothing is known about handled type.
*<p>
* @since 2.3
*/ */
public Class<?> handledType() { return null; } public Class<?> handledType() { return null; }


Expand Down Expand Up @@ -231,8 +227,6 @@ public JsonDeserializer<?> replaceDelegatee(JsonDeserializer<?> delegatee) {
* *
* @return Deserializer this deserializer delegates calls to, if null; * @return Deserializer this deserializer delegates calls to, if null;
* null otherwise. * null otherwise.
*
* @since 2.1
*/ */
public JsonDeserializer<?> getDelegatee() { public JsonDeserializer<?> getDelegatee() {
return null; return null;
Expand All @@ -247,8 +241,6 @@ public JsonDeserializer<?> getDelegatee() {
* This is only to be used for error reporting and diagnostics * This is only to be used for error reporting and diagnostics
* purposes (most commonly, to accompany "unknown property" * purposes (most commonly, to accompany "unknown property"
* exception). * exception).
*
* @since 2.0
*/ */
public Collection<Object> getKnownPropertyNames() { public Collection<Object> getKnownPropertyNames() {
return null; return null;
Expand All @@ -272,13 +264,10 @@ public Collection<Object> getKnownPropertyNames() {
* be handled. * be handled.
*<p> *<p>
* Default implementation simply returns null. * Default implementation simply returns null.
*
* @since 2.6 Added to replace earlier no-arguments variant
*/ */
@Override @Override
public T getNullValue(DeserializationContext ctxt) throws JsonMappingException { public T getNullValue(DeserializationContext ctxt) throws JsonMappingException {
// Change the direction in 2.7 return null;
return getNullValue();
} }


/** /**
Expand All @@ -299,8 +288,6 @@ public AccessPattern getNullAccessPattern() {
* {@link #getEmptyValue(DeserializationContext)}, to check whether it needs * {@link #getEmptyValue(DeserializationContext)}, to check whether it needs
* to be called just once (static values), or each time empty value is * to be called just once (static values), or each time empty value is
* needed. * needed.
*
* @since 2.9
*/ */
public AccessPattern getEmptyAccessPattern() { public AccessPattern getEmptyAccessPattern() {
return AccessPattern.DYNAMIC; return AccessPattern.DYNAMIC;
Expand All @@ -327,8 +314,6 @@ public AccessPattern getEmptyAccessPattern() {
*<p> *<p>
* Default implementation simply calls {@link #getNullValue} and * Default implementation simply calls {@link #getNullValue} and
* returns value. * returns value.
*
* @since 2.6 Added to replace earlier no-arguments variant
*/ */
public Object getEmptyValue(DeserializationContext ctxt) throws JsonMappingException { public Object getEmptyValue(DeserializationContext ctxt) throws JsonMappingException {
return getNullValue(ctxt); return getNullValue(ctxt);
Expand All @@ -349,16 +334,12 @@ public Object getEmptyValue(DeserializationContext ctxt) throws JsonMappingExcep
* @return ObjectIdReader used for resolving possible Object Identifier * @return ObjectIdReader used for resolving possible Object Identifier
* value, instead of full value serialization, if deserializer can do that; * value, instead of full value serialization, if deserializer can do that;
* null if no Object Id is expected. * null if no Object Id is expected.
*
* @since 2.0
*/ */
public ObjectIdReader getObjectIdReader() { return null; } public ObjectIdReader getObjectIdReader() { return null; }


/** /**
* Method needed by {@link BeanDeserializerFactory} to properly link * Method needed by {@link BeanDeserializerFactory} to properly link
* managed- and back-reference pairs. * managed- and back-reference pairs.
*
* @since 2.2 (was moved out of <code>BeanDeserializerBase</code>)
*/ */
public SettableBeanProperty findBackReference(String refName) public SettableBeanProperty findBackReference(String refName)
{ {
Expand All @@ -382,31 +363,11 @@ public SettableBeanProperty findBackReference(String refName)
*<p> *<p>
* Default implementation returns <code>null</code> to allow explicit per-type * Default implementation returns <code>null</code> to allow explicit per-type
* or per-property attempts. * or per-property attempts.
*
* @since 2.9
*/ */
public Boolean supportsUpdate(DeserializationConfig config) { public Boolean supportsUpdate(DeserializationConfig config) {
return null; return null;
} }


/*
/**********************************************************
/* Deprecated methods
/**********************************************************
*/

/**
* @deprecated Since 2.6 Use overloaded variant that takes context argument
*/
@Deprecated
public T getNullValue() { return null; }

/**
* @deprecated Since 2.6 Use overloaded variant that takes context argument
*/
@Deprecated
public Object getEmptyValue() { return getNullValue(); }

/* /*
/********************************************************** /**********************************************************
/* Helper classes /* Helper classes
Expand Down
Expand Up @@ -206,33 +206,6 @@ Object writeReplace() {
/********************************************************** /**********************************************************
*/ */


/**
* @deprecated Since 2.7 Use variant that takes {@link JsonParser} instead
*/
@Deprecated // since 2.7
public JsonMappingException(String msg) { super(msg); }

/**
* @deprecated Since 2.7 Use variant that takes {@link JsonParser} instead
*/
@Deprecated // since 2.7
public JsonMappingException(String msg, Throwable rootCause) { super(msg, rootCause); }

/**
* @deprecated Since 2.7 Use variant that takes {@link JsonParser} instead
*/
@Deprecated // since 2.7
public JsonMappingException(String msg, JsonLocation loc) { super(msg, loc); }

/**
* @deprecated Since 2.7 Use variant that takes {@link JsonParser} instead
*/
@Deprecated // since 2.7
public JsonMappingException(String msg, JsonLocation loc, Throwable rootCause) { super(msg, loc, rootCause); }

/**
* @since 2.7
*/
public JsonMappingException(Closeable processor, String msg) { public JsonMappingException(Closeable processor, String msg) {
super(msg); super(msg);
_processor = processor; _processor = processor;
Expand All @@ -244,9 +217,6 @@ public JsonMappingException(Closeable processor, String msg) {
} }
} }


/**
* @since 2.7
*/
public JsonMappingException(Closeable processor, String msg, Throwable problem) { public JsonMappingException(Closeable processor, String msg, Throwable problem) {
super(msg, problem); super(msg, problem);
_processor = processor; _processor = processor;
Expand All @@ -255,82 +225,53 @@ public JsonMappingException(Closeable processor, String msg, Throwable problem)
} }
} }


/**
* @since 2.7
*/
public JsonMappingException(Closeable processor, String msg, JsonLocation loc) { public JsonMappingException(Closeable processor, String msg, JsonLocation loc) {
super(msg, loc); super(msg, loc);
_processor = processor; _processor = processor;
} }


/**
* @since 2.7
*/
public static JsonMappingException from(JsonParser p, String msg) { public static JsonMappingException from(JsonParser p, String msg) {
return new JsonMappingException(p, msg); return new JsonMappingException(p, msg);
} }


/**
* @since 2.7
*/
public static JsonMappingException from(JsonParser p, String msg, Throwable problem) { public static JsonMappingException from(JsonParser p, String msg, Throwable problem) {
return new JsonMappingException(p, msg, problem); return new JsonMappingException(p, msg, problem);
} }


/**
* @since 2.7
*/
public static JsonMappingException from(JsonGenerator g, String msg) { public static JsonMappingException from(JsonGenerator g, String msg) {
return new JsonMappingException(g, msg, (Throwable) null); return new JsonMappingException(g, msg, (Throwable) null);
} }


/**
* @since 2.7
*/
public static JsonMappingException from(JsonGenerator g, String msg, Throwable problem) { public static JsonMappingException from(JsonGenerator g, String msg, Throwable problem) {
return new JsonMappingException(g, msg, problem); return new JsonMappingException(g, msg, problem);
} }


/**
* @since 2.7
*/
public static JsonMappingException from(DeserializationContext ctxt, String msg) { public static JsonMappingException from(DeserializationContext ctxt, String msg) {
return new JsonMappingException(ctxt.getParser(), msg); return new JsonMappingException(ctxt.getParser(), msg);
} }


/**
* @since 2.7
*/
public static JsonMappingException from(DeserializationContext ctxt, String msg, Throwable t) { public static JsonMappingException from(DeserializationContext ctxt, String msg, Throwable t) {
return new JsonMappingException(ctxt.getParser(), msg, t); return new JsonMappingException(ctxt.getParser(), msg, t);
} }


/**
* @since 2.7
*/
public static JsonMappingException from(SerializerProvider ctxt, String msg) { public static JsonMappingException from(SerializerProvider ctxt, String msg) {
return new JsonMappingException(ctxt.getGenerator(), msg); return new JsonMappingException(ctxt.getGenerator(), msg);
} }


/**
* @since 2.7
*/
public static JsonMappingException from(SerializerProvider ctxt, String msg, Throwable problem) { public static JsonMappingException from(SerializerProvider ctxt, String msg, Throwable problem) {
/* 17-Aug-2015, tatu: As per [databind#903] this is bit problematic as /* 17-Aug-2015, tatu: As per [databind#903] this is bit problematic as
* SerializerProvider instance does not currently hold on to generator... * SerializerProvider instance does not currently hold on to generator...
*/ */
return new JsonMappingException(ctxt.getGenerator(), msg, problem); return new JsonMappingException(ctxt.getGenerator(), msg, problem);
} }

/** /**
* Factory method used when "upgrading" an {@link IOException} into * Factory method used when "upgrading" an {@link IOException} into
* {@link JsonMappingException}: usually only needed to comply with * {@link JsonMappingException}: usually only needed to comply with
* a signature. * a signature.
*<p> *<p>
* NOTE: since 2.9 should usually NOT be used on input-side (deserialization) * NOTE: since 2.9 should usually NOT be used on input-side (deserialization)
* exceptions; instead use method(s) of <code>InputMismatchException</code> * exceptions; instead use method(s) of <code>InputMismatchException</code>
*
* @since 2.1
*/ */
public static JsonMappingException fromUnexpectedIOE(IOException src) { public static JsonMappingException fromUnexpectedIOE(IOException src) {
return new JsonMappingException(null, return new JsonMappingException(null,
Expand Down

0 comments on commit e433f59

Please sign in to comment.