Skip to content

Commit 78844f6

Browse files
authored
Fix #4263: remove generic type parameterization from ObjectArrayDeserializer (#4264)
1 parent 398190e commit 78844f6

File tree

3 files changed

+13
-9
lines changed

3 files changed

+13
-9
lines changed

release-notes/VERSION-2.x

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ Project: jackson-databind
2222
#4248: `ThrowableDeserializer` does not handle `null` well for `cause`
2323
#4250: Add input validation for `NumberDeserializers` deserializers
2424
for "stringified" FP numbers
25+
#4263: Change `ObjectArrayDeserializer` to use "generic" type parameter
26+
(`java.lang.Object`) to remove co-variant return type
2527

2628
2.16.1 (not yet released)
2729

src/main/java/com/fasterxml/jackson/databind/deser/std/ObjectArrayDeserializer.java

+10-8
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
*/
2727
@JacksonStdImpl
2828
public class ObjectArrayDeserializer
29-
extends ContainerDeserializerBase<Object[]>
29+
// Nominal type changes to `java.lang.Object` in 2.17; was `Object[]` before
30+
extends ContainerDeserializerBase<Object>
3031
implements ContextualDeserializer
3132
{
3233
private static final long serialVersionUID = 1L;
@@ -189,7 +190,7 @@ public Object getEmptyValue(DeserializationContext ctxt) throws JsonMappingExcep
189190
*/
190191

191192
@Override
192-
public Object[] deserialize(JsonParser p, DeserializationContext ctxt)
193+
public Object deserialize(JsonParser p, DeserializationContext ctxt)
193194
throws IOException
194195
{
195196
// Ok: must point to START_ARRAY (or equivalent)
@@ -240,7 +241,7 @@ public Object[] deserialize(JsonParser p, DeserializationContext ctxt)
240241
}
241242

242243
@Override
243-
public Object[] deserializeWithType(JsonParser p, DeserializationContext ctxt,
244+
public Object deserializeWithType(JsonParser p, DeserializationContext ctxt,
244245
TypeDeserializer typeDeserializer)
245246
throws IOException
246247
{
@@ -250,11 +251,12 @@ public Object[] deserializeWithType(JsonParser p, DeserializationContext ctxt,
250251
}
251252

252253
@Override // since 2.9
253-
public Object[] deserialize(JsonParser p, DeserializationContext ctxt,
254-
Object[] intoValue) throws IOException
254+
public Object deserialize(JsonParser p, DeserializationContext ctxt,
255+
Object intoValue0) throws IOException
255256
{
257+
final Object[] intoValue = (Object[]) intoValue0;
256258
if (!p.isExpectedStartArrayToken()) {
257-
Object[] arr = handleNonArray(p, ctxt);
259+
Object[] arr = (Object[]) handleNonArray(p, ctxt);
258260
if (arr == null) {
259261
return intoValue;
260262
}
@@ -324,7 +326,7 @@ protected Byte[] deserializeFromBase64(JsonParser p, DeserializationContext ctxt
324326
return result;
325327
}
326328

327-
protected Object[] handleNonArray(JsonParser p, DeserializationContext ctxt)
329+
protected Object handleNonArray(JsonParser p, DeserializationContext ctxt)
328330
throws IOException
329331
{
330332
// Can we do implicit coercion to a single-element array still?
@@ -342,7 +344,7 @@ protected Object[] handleNonArray(JsonParser p, DeserializationContext ctxt)
342344
// Second: empty (and maybe blank) String
343345
return _deserializeFromString(p, ctxt);
344346
}
345-
return (Object[]) ctxt.handleUnexpectedToken(_containerType, p);
347+
return ctxt.handleUnexpectedToken(_containerType, p);
346348
}
347349

348350
Object value;

src/main/java/com/fasterxml/jackson/databind/deser/std/StdKeyDeserializer.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ protected long _parseLong(String key) throws IllegalArgumentException {
260260
}
261261

262262
protected double _parseDouble(String key) throws IllegalArgumentException {
263-
return NumberInput.parseDouble(key);
263+
return NumberInput.parseDouble(key, false);
264264
}
265265

266266
// @since 2.9

0 commit comments

Comments
 (0)