Use instanceof patterns
See gh-33987
This commit is contained in:
committed by
Phillip Webb
parent
a9c547e767
commit
0e68cae57f
@@ -29,8 +29,7 @@ class JSON {
|
||||
if (value instanceof Boolean) {
|
||||
return (Boolean) value;
|
||||
}
|
||||
if (value instanceof String) {
|
||||
String stringValue = (String) value;
|
||||
if (value instanceof String stringValue) {
|
||||
if ("true".equalsIgnoreCase(stringValue)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -311,8 +311,7 @@ public class JSONObject {
|
||||
JSON.checkDouble(((Number) value).doubleValue());
|
||||
}
|
||||
|
||||
if (current instanceof JSONArray) {
|
||||
JSONArray array = (JSONArray) current;
|
||||
if (current instanceof JSONArray array) {
|
||||
array.put(value);
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user