diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java index cbb8d9a1eb..5e48876fb7 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/NumberDeserializers.java @@ -267,12 +267,12 @@ public Byte deserialize(JsonParser p, DeserializationContext ctxt) throws IOExce return p.getByteValue(); } if (_primitive) { - return _parseBytePrimitive(ctxt, p); + return _parseBytePrimitive(p, ctxt); } - return _parseByte(ctxt, p); + return _parseByte(p, ctxt); } - protected Byte _parseByte(DeserializationContext ctxt, JsonParser p) + protected Byte _parseByte(JsonParser p, DeserializationContext ctxt) throws IOException { CoercionAction act; @@ -306,7 +306,7 @@ protected Byte _parseByte(DeserializationContext ctxt, JsonParser p) } return Byte.valueOf((byte) value); case JsonTokenId.ID_NUMBER_FLOAT: - act = _checkFloatToIntCoercion(ctxt, p, _valueClass); + act = _checkFloatToIntCoercion(p, ctxt, _valueClass); if (act == CoercionAction.AsNull) { return (Byte) getNullValue(ctxt); } @@ -347,7 +347,7 @@ public Short deserialize(JsonParser p, DeserializationContext ctxt) return p.getShortValue(); } if (_primitive) { - return _parseShortPrimitive(ctxt, p); + return _parseShortPrimitive(p, ctxt); } return _parseShort(ctxt, p); } @@ -384,7 +384,7 @@ protected Short _parseShort(DeserializationContext ctxt, JsonParser p) } return (short) value; case JsonTokenId.ID_NUMBER_FLOAT: - act = _checkFloatToIntCoercion(ctxt, p, _valueClass); + act = _checkFloatToIntCoercion(p, ctxt, _valueClass); if (act == CoercionAction.AsNull) { return (Short) getNullValue(ctxt); } @@ -490,7 +490,7 @@ public Integer deserialize(JsonParser p, DeserializationContext ctxt) throws IOE return p.getIntValue(); } if (_primitive) { - return _parseIntPrimitive(ctxt, p); + return _parseIntPrimitive(p, ctxt); } return _parseInteger(ctxt, p); } @@ -505,7 +505,7 @@ public Integer deserializeWithType(JsonParser p, DeserializationContext ctxt, return p.getIntValue(); } if (_primitive) { - return _parseIntPrimitive(ctxt, p); + return _parseIntPrimitive(p, ctxt); } return _parseInteger(ctxt, p); } @@ -546,7 +546,7 @@ protected final Integer _parseInteger(DeserializationContext ctxt, JsonParser p) "not a valid Integer value"); } case JsonTokenId.ID_NUMBER_FLOAT: // coercing may work too - act = _checkFloatToIntCoercion(ctxt, p, _valueClass); + act = _checkFloatToIntCoercion(p, ctxt, _valueClass); if (act == CoercionAction.AsNull) { return (Integer) getNullValue(ctxt); } @@ -588,7 +588,7 @@ public Long deserialize(JsonParser p, DeserializationContext ctxt) throws IOExce return p.getLongValue(); } if (_primitive) { - return _parseLongPrimitive(ctxt, p); + return _parseLongPrimitive(p, ctxt); } return _parseLong(ctxt, p); } @@ -619,7 +619,7 @@ protected final Long _parseLong(DeserializationContext ctxt, JsonParser p) return (Long) ctxt.handleWeirdStringValue(_valueClass, text, "not a valid Long value"); case JsonTokenId.ID_NUMBER_FLOAT: - act = _checkFloatToIntCoercion(ctxt, p, _valueClass); + act = _checkFloatToIntCoercion(p, ctxt, _valueClass); if (act == CoercionAction.AsNull) { return (Long) getNullValue(ctxt); } @@ -659,7 +659,7 @@ public Float deserialize(JsonParser p, DeserializationContext ctxt) throws IOExc return p.getFloatValue(); } if (_primitive) { - return _parseFloatPrimitive(ctxt, p); + return _parseFloatPrimitive(p, ctxt); } return _parseFloat(p, ctxt); } @@ -736,7 +736,7 @@ public Double deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx return p.getDoubleValue(); } if (_primitive) { - return _parseDoublePrimitive(ctxt, p); + return _parseDoublePrimitive(p, ctxt); } return _parseDouble(p, ctxt); } @@ -751,7 +751,7 @@ public Double deserializeWithType(JsonParser p, DeserializationContext ctxt, return p.getDoubleValue(); } if (_primitive) { - return _parseDoublePrimitive(ctxt, p); + return _parseDoublePrimitive(p, ctxt); } return _parseDouble(p, ctxt); } @@ -973,7 +973,7 @@ public BigInteger deserialize(JsonParser p, DeserializationContext ctxt) throws } break; case JsonTokenId.ID_NUMBER_FLOAT: - act = _checkFloatToIntCoercion(ctxt, p, _valueClass); + act = _checkFloatToIntCoercion(p, ctxt, _valueClass); if (act == CoercionAction.AsNull) { return (BigInteger) getNullValue(ctxt); } 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 c4520ab0fc..8665bec3f7 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 @@ -507,7 +507,7 @@ public byte[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx _verifyNullForPrimitive(ctxt); value = (byte) 0; } else { - value = _parseBytePrimitive(ctxt, p); + value = _parseBytePrimitive(p, ctxt); } } if (ix >= chunk.length) { @@ -600,7 +600,7 @@ public short[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOE _verifyNullForPrimitive(ctxt); value = (short) 0; } else { - value = _parseShortPrimitive(ctxt, p); + value = _parseShortPrimitive(p, ctxt); } if (ix >= chunk.length) { chunk = builder.appendCompletedChunk(chunk, ix); @@ -617,7 +617,7 @@ public short[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOE @Override protected short[] handleSingleElementUnwrapped(JsonParser p, DeserializationContext ctxt) throws IOException { - return new short[] { _parseShortPrimitive(ctxt, p) }; + return new short[] { _parseShortPrimitive(p, ctxt) }; } @Override @@ -678,7 +678,7 @@ public int[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOExc _verifyNullForPrimitive(ctxt); value = 0; } else { - value = _parseIntPrimitive(ctxt, p); + value = _parseIntPrimitive(p, ctxt); } if (ix >= chunk.length) { chunk = builder.appendCompletedChunk(chunk, ix); @@ -695,7 +695,7 @@ public int[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOExc @Override protected int[] handleSingleElementUnwrapped(JsonParser p, DeserializationContext ctxt) throws IOException { - return new int[] { _parseIntPrimitive(ctxt, p) }; + return new int[] { _parseIntPrimitive(p, ctxt) }; } @Override @@ -756,7 +756,7 @@ public long[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx _verifyNullForPrimitive(ctxt); value = 0L; } else { - value = _parseLongPrimitive(ctxt, p); + value = _parseLongPrimitive(p, ctxt); } if (ix >= chunk.length) { chunk = builder.appendCompletedChunk(chunk, ix); @@ -773,7 +773,7 @@ public long[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOEx @Override protected long[] handleSingleElementUnwrapped(JsonParser p, DeserializationContext ctxt) throws IOException { - return new long[] { _parseLongPrimitive(ctxt, p) }; + return new long[] { _parseLongPrimitive(p, ctxt) }; } @Override @@ -828,7 +828,7 @@ public float[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOE continue; } } - float value = _parseFloatPrimitive(ctxt, p); + float value = _parseFloatPrimitive(p, ctxt); if (ix >= chunk.length) { chunk = builder.appendCompletedChunk(chunk, ix); ix = 0; @@ -844,7 +844,7 @@ public float[] deserialize(JsonParser p, DeserializationContext ctxt) throws IOE @Override protected float[] handleSingleElementUnwrapped(JsonParser p, DeserializationContext ctxt) throws IOException { - return new float[] { _parseFloatPrimitive(ctxt, p) }; + return new float[] { _parseFloatPrimitive(p, ctxt) }; } @Override @@ -898,7 +898,7 @@ public double[] deserialize(JsonParser p, DeserializationContext ctxt) throws IO continue; } } - double value = _parseDoublePrimitive(ctxt, p); + double value = _parseDoublePrimitive(p, ctxt); if (ix >= chunk.length) { chunk = builder.appendCompletedChunk(chunk, ix); ix = 0; @@ -914,7 +914,7 @@ public double[] deserialize(JsonParser p, DeserializationContext ctxt) throws IO @Override protected double[] handleSingleElementUnwrapped(JsonParser p, DeserializationContext ctxt) throws IOException { - return new double[] { _parseDoublePrimitive(ctxt, p) }; + return new double[] { _parseDoublePrimitive(p, ctxt) }; } @Override diff --git a/src/main/java/com/fasterxml/jackson/databind/deser/std/StackTraceElementDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/deser/std/StackTraceElementDeserializer.java index 0cf0390416..a7b6022ea7 100644 --- a/src/main/java/com/fasterxml/jackson/databind/deser/std/StackTraceElementDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/deser/std/StackTraceElementDeserializer.java @@ -40,7 +40,7 @@ public StackTraceElement deserialize(JsonParser p, DeserializationContext ctxt) if (t.isNumeric()) { lineNumber = p.getIntValue(); } else { - lineNumber = _parseIntPrimitive(ctxt, p); + lineNumber = _parseIntPrimitive(p, ctxt); } } else if ("methodName".equals(propName)) { methodName = p.getText(); 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 a976a27f8d..6749420e91 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 @@ -486,15 +486,7 @@ protected final Boolean _parseBoolean(JsonParser p, DeserializationContext ctxt, return (Boolean) ctxt.handleUnexpectedToken(targetType, p); } - @Deprecated // since 2.12, use overloaded variant - protected final byte _parseBytePrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { - return _parseBytePrimitive(ctxt, p); - } - - /** - * @since 2.12 - */ - protected final byte _parseBytePrimitive(DeserializationContext ctxt, JsonParser p) + protected final byte _parseBytePrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { final JsonToken t = p.currentToken(); @@ -535,7 +527,7 @@ protected final byte _parseBytePrimitive(DeserializationContext ctxt, JsonParser return (byte) value; } if (t == JsonToken.VALUE_NUMBER_FLOAT) { - CoercionAction act = _checkFloatToIntCoercion(ctxt, p, Byte.TYPE); + CoercionAction act = _checkFloatToIntCoercion(p, ctxt, Byte.TYPE); if (act == CoercionAction.AsNull) { return (byte) 0; } @@ -547,22 +539,14 @@ protected final byte _parseBytePrimitive(DeserializationContext ctxt, JsonParser // 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 byte parsed = _parseBytePrimitive(ctxt, p); + final byte parsed = _parseBytePrimitive(p, ctxt); _verifyEndArrayForSingle(p, ctxt); return parsed; } return ((Byte) ctxt.handleUnexpectedToken(ctxt.constructType(Byte.TYPE), p)).byteValue(); } - @Deprecated // since 2.12, use overloaded variant - protected final short _parseShortPrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { - return _parseShortPrimitive(ctxt, p); - } - - /** - * @since 2.12 - */ - protected final short _parseShortPrimitive(DeserializationContext ctxt, JsonParser p) + protected final short _parseShortPrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { final JsonToken t = p.currentToken(); @@ -600,7 +584,7 @@ protected final short _parseShortPrimitive(DeserializationContext ctxt, JsonPars return (short) value; } if (t == JsonToken.VALUE_NUMBER_FLOAT) { - CoercionAction act = _checkFloatToIntCoercion(ctxt, p, Short.TYPE); + CoercionAction act = _checkFloatToIntCoercion(p, ctxt, Short.TYPE); if (act == CoercionAction.AsNull) { return (short) 0; } @@ -612,19 +596,14 @@ protected final short _parseShortPrimitive(DeserializationContext ctxt, JsonPars // 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 short parsed = _parseShortPrimitive(ctxt, p); + final short parsed = _parseShortPrimitive(p, ctxt); _verifyEndArrayForSingle(p, ctxt); return parsed; } return ((Short) ctxt.handleUnexpectedToken(ctxt.constructType(Short.TYPE), p)).shortValue(); } - @Deprecated // since 2.12, use overloaded variant - protected final int _parseIntPrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { - return _parseIntPrimitive(ctxt, p); - } - - protected final int _parseIntPrimitive(DeserializationContext ctxt, JsonParser p) + protected final int _parseIntPrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { CoercionAction act; @@ -651,7 +630,7 @@ protected final int _parseIntPrimitive(DeserializationContext ctxt, JsonParser p } return _parseIntPrimitive(ctxt, text); case JsonTokenId.ID_NUMBER_FLOAT: - act = _checkFloatToIntCoercion(ctxt, p, Integer.TYPE); + act = _checkFloatToIntCoercion(p, ctxt, Integer.TYPE); if (act == CoercionAction.AsNull) { return 0; } @@ -662,7 +641,7 @@ protected final int _parseIntPrimitive(DeserializationContext ctxt, JsonParser p case JsonTokenId.ID_START_ARRAY: if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); - final int parsed = _parseIntPrimitive(ctxt, p); + final int parsed = _parseIntPrimitive(p, ctxt); _verifyEndArrayForSingle(p, ctxt); return parsed; } @@ -697,13 +676,7 @@ protected final int _parseIntPrimitive(DeserializationContext ctxt, String text) } } - @Deprecated // since 2.12, use overloaded variant protected final long _parseLongPrimitive(JsonParser p, DeserializationContext ctxt) - throws IOException { - return _parseLongPrimitive(ctxt, p); - } - - protected final long _parseLongPrimitive(DeserializationContext ctxt, JsonParser p) throws IOException { CoercionAction act; @@ -730,7 +703,7 @@ protected final long _parseLongPrimitive(DeserializationContext ctxt, JsonParser } return _parseLongPrimitive(ctxt, text); case JsonTokenId.ID_NUMBER_FLOAT: - act = _checkFloatToIntCoercion(ctxt, p, Long.TYPE); + act = _checkFloatToIntCoercion(p, ctxt, Long.TYPE); if (act == CoercionAction.AsNull) { return 0L; } @@ -741,7 +714,7 @@ protected final long _parseLongPrimitive(DeserializationContext ctxt, JsonParser case JsonTokenId.ID_START_ARRAY: if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); - final long parsed = _parseLongPrimitive(ctxt, p); + final long parsed = _parseLongPrimitive(p, ctxt); _verifyEndArrayForSingle(p, ctxt); return parsed; } @@ -766,13 +739,7 @@ protected final long _parseLongPrimitive(DeserializationContext ctxt, String tex } } - @Deprecated // since 2.12, use overloaded variant protected final float _parseFloatPrimitive(JsonParser p, DeserializationContext ctxt) - throws IOException { - return _parseFloatPrimitive(ctxt, p); - } - - protected final float _parseFloatPrimitive(DeserializationContext ctxt, JsonParser p) throws IOException { CoercionAction act; @@ -802,7 +769,7 @@ protected final float _parseFloatPrimitive(DeserializationContext ctxt, JsonPars case JsonTokenId.ID_START_ARRAY: if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); - final float parsed = _parseFloatPrimitive(ctxt, p); + final float parsed = _parseFloatPrimitive(p, ctxt); _verifyEndArrayForSingle(p, ctxt); return parsed; } @@ -841,13 +808,7 @@ protected final float _parseFloatPrimitive(DeserializationContext ctxt, String t return _nonNullNumber(v).floatValue(); } - @Deprecated // since 2.12, use overloaded variant protected final double _parseDoublePrimitive(JsonParser p, DeserializationContext ctxt) - throws IOException { - return _parseDoublePrimitive(ctxt, p); - } - - protected final double _parseDoublePrimitive(DeserializationContext ctxt, JsonParser p) throws IOException { CoercionAction act; @@ -877,7 +838,7 @@ protected final double _parseDoublePrimitive(DeserializationContext ctxt, JsonPa case JsonTokenId.ID_START_ARRAY: if (ctxt.isEnabled(DeserializationFeature.UNWRAP_SINGLE_VALUE_ARRAYS)) { p.nextToken(); - final double parsed = _parseDoublePrimitive(ctxt, p); + final double parsed = _parseDoublePrimitive(p, ctxt); _verifyEndArrayForSingle(p, ctxt); return parsed; } @@ -1126,7 +1087,7 @@ protected CoercionAction _checkFromStringCoercion(DeserializationContext ctxt, S /** * @since 2.12 */ - protected CoercionAction _checkFloatToIntCoercion(DeserializationContext ctxt, JsonParser p, + protected CoercionAction _checkFloatToIntCoercion(JsonParser p, DeserializationContext ctxt, Class rawTargetType) throws IOException {