Replace usages of deprecated constructors

This commit is contained in:
aboyko
2024-07-17 17:30:20 -04:00
parent fcbd052bf4
commit 038323affc
9 changed files with 34 additions and 34 deletions

View File

@@ -9,7 +9,7 @@
<description>Repackaged org.json</description>
<properties>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
</properties>
</project>

View File

@@ -608,7 +608,7 @@ public class JSONArray {
* @return this.
*/
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;
@@ -622,7 +622,7 @@ public class JSONArray {
* @return this.
*/
public JSONArray put(int value) {
this.put(new Integer(value));
this.put(Integer.valueOf(value));
return this;
}
@@ -634,7 +634,7 @@ public class JSONArray {
* @return this.
*/
public JSONArray put(long value) {
this.put(new Long(value));
this.put(Long.valueOf(value));
return this;
}
@@ -714,7 +714,7 @@ public class JSONArray {
* 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;
}
@@ -732,7 +732,7 @@ public class JSONArray {
* 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;
}
@@ -750,7 +750,7 @@ public class JSONArray {
* 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

@@ -1067,7 +1067,7 @@ public class JSONObject {
* 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;
}
@@ -1083,7 +1083,7 @@ public class JSONObject {
* 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;
}
@@ -1099,7 +1099,7 @@ public class JSONObject {
* 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;
}
@@ -1319,10 +1319,10 @@ public class JSONObject {
return d;
}
} else {
Long myLong = new Long(string);
Long myLong = Long.valueOf(string);
if (string.equals(myLong.toString())) {
if (myLong.longValue() == myLong.intValue()) {
return new Integer(myLong.intValue());
return Integer.valueOf(myLong.intValue());
} else {
return myLong;
}

View File

@@ -300,7 +300,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

@@ -36,31 +36,31 @@ import java.util.Iterator;
public class XML {
/** The Character '&amp;'. */
public static final Character AMP = new Character('&');
public static final Character AMP = Character.valueOf('&');
/** The Character '''. */
public static final Character APOS = new Character('\'');
public static final Character APOS = Character.valueOf('\'');
/** The Character '!'. */
public static final Character BANG = new Character('!');
public static final Character BANG = Character.valueOf('!');
/** The Character '='. */
public static final Character EQ = new Character('=');
public static final Character EQ = Character.valueOf('=');
/** The Character '>'. */
public static final Character GT = new Character('>');
public static final Character GT = Character.valueOf('>');
/** The Character '&lt;'. */
public static final Character LT = new Character('<');
public static final Character LT = Character.valueOf('<');
/** The Character '?'. */
public static final Character QUEST = new Character('?');
public static final Character QUEST = Character.valueOf('?');
/** The Character '"'. */
public static final Character QUOT = new Character('"');
public static final Character QUOT = Character.valueOf('"');
/** The Character '/'. */
public static final Character SLASH = new Character('/');
public static final Character SLASH = Character.valueOf('/');
/**
* Replace special characters with XML escapes:
@@ -317,14 +317,14 @@ 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;
}
}
} catch (Exception ignore) {
try {
Double value = new Double(string);
Double value = Double.valueOf(string);
if (value.toString().equals(string)) {
return value;
}

View File

@@ -288,7 +288,7 @@ public class Decompressor extends JSONzip {
private Object readValue() throws JSONException {
switch (read(2)) {
case 0:
return new Integer(read(!bit() ? 4 : !bit() ? 7 : 14));
return Integer.valueOf(read(!bit() ? 4 : !bit() ? 7 : 14));
case 1:
byte[] bytes = new byte[256];
int length = 0;

View File

@@ -65,7 +65,7 @@ class MapKeep extends Keep {
if (usage > 0) {
this.uses[to] = usage;
this.list[to] = key;
this.map.put(key, new Integer(to));
this.map.put(key, Integer.valueOf(to));
to += 1;
} else {
this.map.remove(key);
@@ -141,7 +141,7 @@ class MapKeep extends Keep {
compact();
}
this.list[this.length] = value;
this.map.put(value, new Integer(this.length));
this.map.put(value, Integer.valueOf(this.length));
this.uses[this.length] = 1;
if (JSONzip.probe) {
JSONzip.log("<" + this.length + " " + value + "> ");

View File

@@ -1094,7 +1094,7 @@ public class JSONObject {
* 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;
}
@@ -1110,7 +1110,7 @@ public class JSONObject {
* 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;
}
@@ -1126,7 +1126,7 @@ public class JSONObject {
* 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;
}
@@ -1346,10 +1346,10 @@ public class JSONObject {
return d;
}
} else {
Long myLong = new Long(string);
Long myLong = Long.valueOf(string);
if (string.equals(myLong.toString())) {
if (myLong.longValue() == myLong.intValue()) {
return new Integer(myLong.intValue());
return Integer.valueOf(myLong.intValue());
} else {
return myLong;
}

View File

@@ -107,7 +107,7 @@ public class SpringProcessConnectorOverJMX implements SpringProcessConnector {
jmxServiceURL = new JMXServiceURL(jmxURL);
Map<String, Object> environment = new HashMap<>();
environment.put(JMX_CLIENT_CONNECTION_CHECK_PERIOD_PROPERTY_KEY, new Long(JMX_HEARTBEAT_INTERVAL));
environment.put(JMX_CLIENT_CONNECTION_CHECK_PERIOD_PROPERTY_KEY, Long.valueOf(JMX_HEARTBEAT_INTERVAL));
jmxConnection = JMXConnectorFactory.connect(jmxServiceURL, environment);
jmxConnection.addConnectionNotificationListener(notificationListener, null, null);