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 ff0d0657bc..3a1800a672 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 @@ -254,12 +254,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; @@ -293,7 +293,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); } @@ -332,7 +332,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); } @@ -369,7 +369,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); } @@ -470,7 +470,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); } @@ -485,7 +485,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); } @@ -525,7 +525,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); } @@ -564,7 +564,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); } @@ -594,7 +594,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); } @@ -632,7 +632,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); } @@ -707,7 +707,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); } @@ -722,7 +722,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); } @@ -942,7 +942,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 2a2131b741..10248d5938 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 @@ -491,7 +491,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) { @@ -582,7 +582,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); @@ -599,7 +599,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 @@ -658,7 +658,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); @@ -675,7 +675,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 @@ -734,7 +734,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); @@ -751,7 +751,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 @@ -804,7 +804,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; @@ -820,7 +820,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 @@ -872,7 +872,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; @@ -888,7 +888,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 d53e38cb5f..ae3530780b 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 @@ -42,7 +42,7 @@ public StackTraceElement deserialize(JsonParser p, DeserializationContext ctxt) if (t.isNumeric()) { lineNumber = p.getIntValue(); } else { - lineNumber = _parseIntPrimitive(ctxt, p); + lineNumber = _parseIntPrimitive(p, ctxt); } break; case "methodName": 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 b741d4da59..99604358c9 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 @@ -10,7 +10,6 @@ import com.fasterxml.jackson.core.JsonParser.NumberType; import com.fasterxml.jackson.core.exc.InputCoercionException; import com.fasterxml.jackson.core.io.NumberInput; - import com.fasterxml.jackson.databind.*; import com.fasterxml.jackson.databind.annotation.JacksonStdImpl; import com.fasterxml.jackson.databind.cfg.CoercionAction; @@ -427,7 +426,7 @@ protected final Boolean _parseBoolean(JsonParser p, DeserializationContext ctxt, return (Boolean) ctxt.handleUnexpectedToken(ctxt.constructType(targetType), p); } - protected final byte _parseBytePrimitive(DeserializationContext ctxt, JsonParser p) + protected final byte _parseBytePrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { final JsonToken t = p.currentToken(); @@ -468,7 +467,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; } @@ -480,14 +479,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(); } - protected final short _parseShortPrimitive(DeserializationContext ctxt, JsonParser p) + protected final short _parseShortPrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { final JsonToken t = p.currentToken(); @@ -525,7 +524,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; } @@ -537,14 +536,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(); } - protected final int _parseIntPrimitive(DeserializationContext ctxt, JsonParser p) + protected final int _parseIntPrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { CoercionAction act; @@ -571,7 +570,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; } @@ -582,7 +581,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; } @@ -614,7 +613,7 @@ protected final int _parseIntPrimitive(DeserializationContext ctxt, String text) } } - protected final long _parseLongPrimitive(DeserializationContext ctxt, JsonParser p) + protected final long _parseLongPrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { CoercionAction act; @@ -641,7 +640,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; } @@ -652,7 +651,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; } @@ -674,7 +673,7 @@ protected final long _parseLongPrimitive(DeserializationContext ctxt, String tex } } - protected final float _parseFloatPrimitive(DeserializationContext ctxt, JsonParser p) + protected final float _parseFloatPrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { CoercionAction act; @@ -704,7 +703,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; } @@ -742,7 +741,7 @@ protected final float _parseFloatPrimitive(DeserializationContext ctxt, String t return _nonNullNumber(v).floatValue(); } - protected final double _parseDoublePrimitive(DeserializationContext ctxt, JsonParser p) + protected final double _parseDoublePrimitive(JsonParser p, DeserializationContext ctxt) throws IOException { CoercionAction act; @@ -772,7 +771,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; } @@ -1015,7 +1014,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 { diff --git a/src/main/java/com/fasterxml/jackson/databind/ext/jdk8/OptionalIntDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/ext/jdk8/OptionalIntDeserializer.java index b3c6a9c559..ffac08c095 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ext/jdk8/OptionalIntDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ext/jdk8/OptionalIntDeserializer.java @@ -45,7 +45,7 @@ public OptionalInt deserialize(JsonParser p, DeserializationContext ctxt) throws } return OptionalInt.of(_parseIntPrimitive(ctxt, text)); case JsonTokenId.ID_NUMBER_FLOAT: - act = _checkFloatToIntCoercion(ctxt, p, _valueClass); + act = _checkFloatToIntCoercion(p, ctxt, _valueClass); if (act == CoercionAction.AsNull) { return (OptionalInt) getNullValue(ctxt); } diff --git a/src/main/java/com/fasterxml/jackson/databind/ext/jdk8/OptionalLongDeserializer.java b/src/main/java/com/fasterxml/jackson/databind/ext/jdk8/OptionalLongDeserializer.java index b5db46ebbb..8de0f1d061 100644 --- a/src/main/java/com/fasterxml/jackson/databind/ext/jdk8/OptionalLongDeserializer.java +++ b/src/main/java/com/fasterxml/jackson/databind/ext/jdk8/OptionalLongDeserializer.java @@ -46,7 +46,7 @@ public OptionalLong deserialize(JsonParser p, DeserializationContext ctxt) throw } return OptionalLong.of(_parseLongPrimitive(ctxt, text)); case JsonTokenId.ID_NUMBER_FLOAT: - act = _checkFloatToIntCoercion(ctxt, p, _valueClass); + act = _checkFloatToIntCoercion(p, ctxt, _valueClass); if (act == CoercionAction.AsNull) { return (OptionalLong) getNullValue(ctxt); }