Skip to content

Commit 9f53a67

Browse files
authored
fix: address some deprecation warnings in Java 9+ (#1215)
1 parent 6b9b6c5 commit 9f53a67

File tree

3 files changed

+14
-3
lines changed
  • google-http-client/src
  • google-http-client-xml/src/main/java/com/google/api/client/xml

3 files changed

+14
-3
lines changed

google-http-client-xml/src/main/java/com/google/api/client/xml/Xml.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -575,10 +575,10 @@ private static Object parseValue(Type valueType, List<Type> context, String valu
575575
valueType = Data.resolveWildcardTypeOrTypeVariable(context, valueType);
576576
if (valueType == Double.class || valueType == double.class) {
577577
if (value.equals("INF")) {
578-
return new Double(Double.POSITIVE_INFINITY);
578+
return Double.valueOf(Double.POSITIVE_INFINITY);
579579
}
580580
if (value.equals("-INF")) {
581-
return new Double(Double.NEGATIVE_INFINITY);
581+
return Double.valueOf(Double.NEGATIVE_INFINITY);
582582
}
583583
}
584584
if (valueType == Float.class || valueType == float.class) {

google-http-client/src/main/java/com/google/api/client/util/Data.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,36 +45,47 @@ public class Data {
4545
// NOTE: create new instances to avoid cache, e.g. new String()
4646

4747
/** The single instance of the magic null object for a {@link Boolean}. */
48+
@SuppressWarnings("deprecation")
4849
public static final Boolean NULL_BOOLEAN = new Boolean(true);
4950

5051
/** The single instance of the magic null object for a {@link String}. */
52+
@SuppressWarnings("deprecation")
5153
public static final String NULL_STRING = new String();
5254

5355
/** The single instance of the magic null object for a {@link Character}. */
56+
@SuppressWarnings("deprecation")
5457
public static final Character NULL_CHARACTER = new Character((char) 0);
5558

5659
/** The single instance of the magic null object for a {@link Byte}. */
60+
@SuppressWarnings("deprecation")
5761
public static final Byte NULL_BYTE = new Byte((byte) 0);
5862

5963
/** The single instance of the magic null object for a {@link Short}. */
64+
@SuppressWarnings("deprecation")
6065
public static final Short NULL_SHORT = new Short((short) 0);
6166

6267
/** The single instance of the magic null object for a {@link Integer}. */
68+
@SuppressWarnings("deprecation")
6369
public static final Integer NULL_INTEGER = new Integer(0);
6470

6571
/** The single instance of the magic null object for a {@link Float}. */
72+
@SuppressWarnings("deprecation")
6673
public static final Float NULL_FLOAT = new Float(0);
6774

6875
/** The single instance of the magic null object for a {@link Long}. */
76+
@SuppressWarnings("deprecation")
6977
public static final Long NULL_LONG = new Long(0);
7078

7179
/** The single instance of the magic null object for a {@link Double}. */
80+
@SuppressWarnings("deprecation")
7281
public static final Double NULL_DOUBLE = new Double(0);
7382

7483
/** The single instance of the magic null object for a {@link BigInteger}. */
84+
@SuppressWarnings("deprecation")
7585
public static final BigInteger NULL_BIG_INTEGER = new BigInteger("0");
7686

7787
/** The single instance of the magic null object for a {@link BigDecimal}. */
88+
@SuppressWarnings("deprecation")
7889
public static final BigDecimal NULL_BIG_DECIMAL = new BigDecimal("0");
7990

8091
/** The single instance of the magic null object for a {@link DateTime}. */

google-http-client/src/test/java/com/google/api/client/util/ObjectsTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public void testConstructor_innerClass() {
3434

3535
public void testToString_oneIntegerField() {
3636
String toTest =
37-
Objects.toStringHelper(new TestClass()).add("field1", new Integer(42)).toString();
37+
Objects.toStringHelper(new TestClass()).add("field1", Integer.valueOf(42)).toString();
3838
assertEquals("TestClass{field1=42}", toTest);
3939
}
4040

0 commit comments

Comments
 (0)