Fix JVM Warnings

This commit is contained in:
Daniel Mills
2021-07-21 08:10:11 -04:00
parent 8f57364547
commit c5262f188e
7 changed files with 34 additions and 14 deletions

View File

@@ -697,7 +697,7 @@ public class JSONArray implements Iterable<Object> {
* @throws JSONException if the value is not finite.
*/
public JSONArray put(double value) throws JSONException {
Double d = new Double(value);
Double d = Double.valueOf(value);
JSONObject.testValidity(d);
this.put(d);
return this;
@@ -710,7 +710,7 @@ public class JSONArray implements Iterable<Object> {
* @return this.
*/
public JSONArray put(int value) {
this.put(new Integer(value));
this.put(Integer.valueOf(value));
return this;
}
@@ -721,7 +721,7 @@ public class JSONArray implements Iterable<Object> {
* @return this.
*/
public JSONArray put(long value) {
this.put(new Long(value));
this.put(Long.valueOf(value));
return this;
}
@@ -790,7 +790,7 @@ public class JSONArray implements Iterable<Object> {
* @throws JSONException If the index is negative or if the value is not finite.
*/
public JSONArray put(int index, double value) throws JSONException {
this.put(index, new Double(value));
this.put(index, Double.valueOf(value));
return this;
}
@@ -805,7 +805,7 @@ public class JSONArray implements Iterable<Object> {
* @throws JSONException If the index is negative.
*/
public JSONArray put(int index, int value) throws JSONException {
this.put(index, new Integer(value));
this.put(index, Integer.valueOf(value));
return this;
}
@@ -820,7 +820,7 @@ public class JSONArray implements Iterable<Object> {
* @throws JSONException If the index is negative.
*/
public JSONArray put(int index, long value) throws JSONException {
this.put(index, new Long(value));
this.put(index, Long.valueOf(value));
return this;
}

View File

@@ -1115,7 +1115,7 @@ public class JSONObject {
* @throws JSONException If the key is null or if the number is invalid.
*/
public JSONObject put(String key, double value) throws JSONException {
this.put(key, new Double(value));
this.put(key, Double.valueOf(value));
return this;
}
@@ -1128,7 +1128,7 @@ public class JSONObject {
* @throws JSONException If the key is null.
*/
public JSONObject put(String key, int value) throws JSONException {
this.put(key, new Integer(value));
this.put(key, Integer.valueOf(value));
return this;
}
@@ -1141,7 +1141,7 @@ public class JSONObject {
* @throws JSONException If the key is null.
*/
public JSONObject put(String key, long value) throws JSONException {
this.put(key, new Long(value));
this.put(key, Long.valueOf(value));
return this;
}
@@ -1389,7 +1389,7 @@ public class JSONObject {
return d;
}
} else {
Long myLong = new Long(string);
Long myLong = Long.valueOf(string);
if (string.equals(myLong.toString())) {
if (myLong == myLong.intValue()) {
return myLong.intValue();

View File

@@ -301,7 +301,7 @@ public class JSONWriter {
* @throws JSONException If the number is not finite.
*/
public JSONWriter value(double d) throws JSONException {
return this.value(new Double(d));
return this.value(Double.valueOf(d));
}
/**

View File

@@ -318,7 +318,7 @@ public class XML {
try {
char initial = string.charAt(0);
if (initial == '-' || (initial >= '0' && initial <= '9')) {
Long value = new Long(string);
Long value = Long.valueOf(string);
if (value.toString().equals(string)) {
return value;
}
@@ -326,7 +326,7 @@ public class XML {
} catch (Exception ignore) {
Iris.reportError(ignore);
try {
Double value = new Double(string);
Double value = Double.valueOf(string);
if (value.toString().equals(string)) {
return value;
}