Skip to content

Commit

Permalink
Undo unnecessary (and actually inconsistent) change to parser/context…
Browse files Browse the repository at this point in the history
… argument ordering for helper methods in `StdDeserializer`
  • Loading branch information
cowtowncoder committed Jun 14, 2020
1 parent dd7f4d8 commit 22d9595
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public AtomicBoolean deserialize(JsonParser p, DeserializationContext ctxt) thro
}
// 12-Jun-2020, tatu: May look convoluted, but need to work correctly with
// CoercionConfig
Boolean b = _parseBoolean(ctxt, p, AtomicBoolean.class);
Boolean b = _parseBoolean(p, ctxt, AtomicBoolean.class);
return (b == null) ? null : new AtomicBoolean(b.booleanValue());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ public Boolean deserialize(JsonParser p, DeserializationContext ctxt) throws IOE
return Boolean.FALSE;
}
if (_primitive) {
return _parseBooleanPrimitive(ctxt, p);
return _parseBooleanPrimitive(p, ctxt);
}
return _parseBoolean(ctxt, p, _valueClass);
return _parseBoolean(p, ctxt, _valueClass);
}

// Since we can never have type info ("natural type"; String, Boolean, Integer, Double):
Expand All @@ -240,9 +240,9 @@ public Boolean deserializeWithType(JsonParser p, DeserializationContext ctxt,
return Boolean.FALSE;
}
if (_primitive) {
return _parseBooleanPrimitive(ctxt, p);
return _parseBooleanPrimitive(p, ctxt);
}
return _parseBoolean(ctxt, p, _valueClass);
return _parseBoolean(p, ctxt, _valueClass);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ public boolean[] deserialize(JsonParser p, DeserializationContext ctxt)
_verifyNullForPrimitive(ctxt);
value = false;
} else {
value = _parseBooleanPrimitive(ctxt, p);
value = _parseBooleanPrimitive(p, ctxt);
}
if (ix >= chunk.length) {
chunk = builder.appendCompletedChunk(chunk, ix);
Expand All @@ -409,7 +409,7 @@ public boolean[] deserialize(JsonParser p, DeserializationContext ctxt)
@Override
protected boolean[] handleSingleElementUnwrapped(JsonParser p,
DeserializationContext ctxt) throws IOException {
return new boolean[] { _parseBooleanPrimitive(ctxt, p) };
return new boolean[] { _parseBooleanPrimitive(p, ctxt) };
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -353,9 +353,10 @@ protected T _deserializeWrappedValue(JsonParser p, DeserializationContext ctxt)
/**********************************************************
*/

@Deprecated // since 2.11, use overloaded variant
protected final boolean _parseBooleanPrimitive(JsonParser p, DeserializationContext ctxt) throws IOException {
return _parseBooleanPrimitive(ctxt, p);
@Deprecated // since 2.12, use overloaded variant that does NOT take target type
protected final boolean _parseBooleanPrimitive(DeserializationContext ctxt,
JsonParser p, Class<?> targetType) throws IOException {
return _parseBooleanPrimitive(p, ctxt);
}

/**
Expand All @@ -365,12 +366,9 @@ protected final boolean _parseBooleanPrimitive(JsonParser p, DeserializationCont
* same as {@link #handledType}, and not necessarily {@code boolean}
* (may be {@code boolean[]} or {@code AtomicBoolean} for example);
* used for coercion config access
*
* @since 2.12
*/
protected final boolean _parseBooleanPrimitive(DeserializationContext ctxt,
JsonParser p)
throws IOException
protected final boolean _parseBooleanPrimitive(JsonParser p, DeserializationContext ctxt)
throws IOException
{
final JsonToken t = p.currentToken();
// usually caller should have handled but:
Expand Down Expand Up @@ -419,7 +417,7 @@ protected final boolean _parseBooleanPrimitive(DeserializationContext ctxt,
// 12-Jun-2020, tatu: For some reason calling `_deserializeFromArray()` won't work so:
if (t == JsonToken.START_ARRAY && ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) {
p.nextToken();
final boolean parsed = _parseBooleanPrimitive(ctxt, p);
final boolean parsed = _parseBooleanPrimitive(p, ctxt);
_verifyEndArrayForSingle(p, ctxt);
return parsed;
}
Expand All @@ -436,16 +434,16 @@ protected final boolean _parseBooleanPrimitive(DeserializationContext ctxt,
* Caller may need to translate from 3 possible result types into appropriately
* matching output types.
*
* @param ctxt Deserialization context for accessing configuration
* @param p Underlying parser
* @param ctxt Deserialization context for accessing configuration
* @param targetType Actual type that is being deserialized, may be
* same as {@link #handledType} but could be {@code AtomicBoolean} for example.
* Used for coercion config access.
*
* @since 2.12
*/
protected final Boolean _parseBoolean(DeserializationContext ctxt,
JsonParser p, Class<?> targetType)
protected final Boolean _parseBoolean(JsonParser p, DeserializationContext ctxt,
Class<?> targetType)
throws IOException
{
switch (p.currentTokenId()) {
Expand Down

0 comments on commit 22d9595

Please sign in to comment.