Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix some deprecation warnings in Java 9+ #1215

Merged
merged 1 commit into from Jan 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -575,10 +575,10 @@ private static Object parseValue(Type valueType, List<Type> context, String valu
valueType = Data.resolveWildcardTypeOrTypeVariable(context, valueType);
if (valueType == Double.class || valueType == double.class) {
if (value.equals("INF")) {
return new Double(Double.POSITIVE_INFINITY);
return Double.valueOf(Double.POSITIVE_INFINITY);
}
if (value.equals("-INF")) {
return new Double(Double.NEGATIVE_INFINITY);
return Double.valueOf(Double.NEGATIVE_INFINITY);
}
}
if (valueType == Float.class || valueType == float.class) {
Expand Down
Expand Up @@ -45,36 +45,47 @@ public class Data {
// NOTE: create new instances to avoid cache, e.g. new String()

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

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

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

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

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

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

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

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

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

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

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

/** The single instance of the magic null object for a {@link DateTime}. */
Expand Down
Expand Up @@ -34,7 +34,7 @@ public void testConstructor_innerClass() {

public void testToString_oneIntegerField() {
String toTest =
Objects.toStringHelper(new TestClass()).add("field1", new Integer(42)).toString();
Objects.toStringHelper(new TestClass()).add("field1", Integer.valueOf(42)).toString();
assertEquals("TestClass{field1=42}", toTest);
}

Expand Down