2323public class StdArraySerializers
2424{
2525 protected final static HashMap <String , JsonSerializer <?>> _arraySerializers =
26- new HashMap <String , JsonSerializer <?> >();
26+ new HashMap <>();
2727 static {
2828 // Arrays of various types (including common object types)
29- _arraySerializers .put (boolean [].class .getName (), new StdArraySerializers . BooleanArraySerializer ());
29+ _arraySerializers .put (boolean [].class .getName (), new BooleanArraySerializer ());
3030 _arraySerializers .put (byte [].class .getName (), new ByteArraySerializer ());
31- _arraySerializers .put (char [].class .getName (), new StdArraySerializers . CharArraySerializer ());
32- _arraySerializers .put (short [].class .getName (), new StdArraySerializers . ShortArraySerializer ());
33- _arraySerializers .put (int [].class .getName (), new StdArraySerializers . IntArraySerializer ());
34- _arraySerializers .put (long [].class .getName (), new StdArraySerializers . LongArraySerializer ());
35- _arraySerializers .put (float [].class .getName (), new StdArraySerializers . FloatArraySerializer ());
36- _arraySerializers .put (double [].class .getName (), new StdArraySerializers . DoubleArraySerializer ());
31+ _arraySerializers .put (char [].class .getName (), new CharArraySerializer ());
32+ _arraySerializers .put (short [].class .getName (), new ShortArraySerializer ());
33+ _arraySerializers .put (int [].class .getName (), new IntArraySerializer ());
34+ _arraySerializers .put (long [].class .getName (), new LongArraySerializer ());
35+ _arraySerializers .put (float [].class .getName (), new FloatArraySerializer ());
36+ _arraySerializers .put (double [].class .getName (), new DoubleArraySerializer ());
3737 }
3838
3939 protected StdArraySerializers () { }
@@ -46,6 +46,12 @@ public static JsonSerializer<?> findStandardImpl(Class<?> cls) {
4646 return _arraySerializers .get (cls .getName ());
4747 }
4848
49+ // @since 2.19
50+ @ SuppressWarnings ("deprecation" )
51+ static JavaType simpleElementType (Class <?> elemClass ) {
52+ return TypeFactory .defaultInstance ().uncheckedSimpleType (elemClass );
53+ }
54+
4955 /*
5056 ****************************************************************
5157 /* Intermediate base classes
@@ -88,8 +94,7 @@ public static class BooleanArraySerializer
8894 extends ArraySerializerBase <boolean []>
8995 {
9096 // as above, assuming no one re-defines primitive/wrapper types
91- @ SuppressWarnings ("deprecation" )
92- private final static JavaType VALUE_TYPE = TypeFactory .defaultInstance ().uncheckedSimpleType (Boolean .class );
97+ private final static JavaType VALUE_TYPE = simpleElementType (Boolean .TYPE );
9398
9499 public BooleanArraySerializer () { super (boolean [].class ); }
95100
@@ -179,8 +184,7 @@ public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType t
179184 public static class ShortArraySerializer extends TypedPrimitiveArraySerializer <short []>
180185 {
181186 // as above, assuming no one re-defines primitive/wrapper types
182- @ SuppressWarnings ("deprecation" )
183- private final static JavaType VALUE_TYPE = TypeFactory .defaultInstance ().uncheckedSimpleType (Short .TYPE );
187+ private final static JavaType VALUE_TYPE = simpleElementType (Short .TYPE );
184188
185189 public ShortArraySerializer () { super (short [].class ); }
186190 public ShortArraySerializer (ShortArraySerializer src , BeanProperty prop ,
@@ -340,8 +344,7 @@ public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType t
340344 public static class IntArraySerializer extends ArraySerializerBase <int []>
341345 {
342346 // as above, assuming no one re-defines primitive/wrapper types
343- @ SuppressWarnings ("deprecation" )
344- private final static JavaType VALUE_TYPE = TypeFactory .defaultInstance ().uncheckedSimpleType (Integer .TYPE );
347+ private final static JavaType VALUE_TYPE = simpleElementType (Integer .TYPE );
345348
346349 public IntArraySerializer () { super (int [].class ); }
347350
@@ -429,8 +432,7 @@ public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType t
429432 public static class LongArraySerializer extends TypedPrimitiveArraySerializer <long []>
430433 {
431434 // as above, assuming no one re-defines primitive/wrapper types
432- @ SuppressWarnings ("deprecation" )
433- private final static JavaType VALUE_TYPE = TypeFactory .defaultInstance ().uncheckedSimpleType (Long .TYPE );
435+ private final static JavaType VALUE_TYPE = simpleElementType (Long .TYPE );
434436
435437 public LongArraySerializer () { super (long [].class ); }
436438 public LongArraySerializer (LongArraySerializer src , BeanProperty prop ,
@@ -508,8 +510,7 @@ public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType t
508510 public static class FloatArraySerializer extends TypedPrimitiveArraySerializer <float []>
509511 {
510512 // as above, assuming no one re-defines primitive/wrapper types
511- @ SuppressWarnings ("deprecation" )
512- private final static JavaType VALUE_TYPE = TypeFactory .defaultInstance ().uncheckedSimpleType (Float .TYPE );
513+ private final static JavaType VALUE_TYPE = simpleElementType (Float .TYPE );
513514
514515 public FloatArraySerializer () {
515516 super (float [].class );
@@ -587,8 +588,7 @@ public void acceptJsonFormatVisitor(JsonFormatVisitorWrapper visitor, JavaType t
587588 public static class DoubleArraySerializer extends ArraySerializerBase <double []>
588589 {
589590 // as above, assuming no one re-defines primitive/wrapper types
590- @ SuppressWarnings ("deprecation" )
591- private final static JavaType VALUE_TYPE = TypeFactory .defaultInstance ().uncheckedSimpleType (Double .TYPE );
591+ private final static JavaType VALUE_TYPE = simpleElementType (Double .TYPE );
592592
593593 public DoubleArraySerializer () { super (double [].class ); }
594594
0 commit comments