Use instanceof patterns

See gh-33987
This commit is contained in:
Krzysztof Krason
2023-01-26 18:27:37 -08:00
committed by Phillip Webb
parent a9c547e767
commit 0e68cae57f
9 changed files with 24 additions and 42 deletions

View File

@@ -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;
}

View File

@@ -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 {