Skip to content

Commit 590ec57

Browse files
committed
Fix unnamed variable errors for JDK 21 compatibility
- Replace unnamed variables (_) with named variables (ignored) - Fixes compilation errors on JDK 21 which doesn't support unnamed variables - Updated in JsonNumberImpl.java, JsonObject.java, and Json.java
1 parent f4221db commit 590ec57

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

src/main/java/jdk/sandbox/internal/util/json/JsonNumberImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public Number toNumber() {
8080
} else {
8181
try {
8282
return Long.parseLong(str);
83-
} catch (NumberFormatException _) {
83+
} catch (NumberFormatException ignored) {
8484
return new BigInteger(str);
8585
}
8686
}

src/main/java/jdk/sandbox/java/util/json/Json.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ public static Object toUntyped(JsonValue src) {
257257
.map(Json::toUntyped)
258258
.toList();
259259
case JsonBoolean jb -> jb.value();
260-
case JsonNull _ -> null;
260+
case JsonNull ignored -> null;
261261
case JsonNumber n -> n.toNumber();
262262
case JsonString js -> js.value();
263263
};

src/main/java/jdk/sandbox/java/util/json/JsonObject.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ static JsonObject of(Map<String, ? extends JsonValue> map) {
6767
.stream()
6868
.collect(Collectors.toMap(
6969
e -> Objects.requireNonNull(e.getKey()), Map.Entry::getValue, // Implicit NPE on val
70-
(_, v) -> v, LinkedHashMap::new)));
70+
(ignored, v) -> v, LinkedHashMap::new)));
7171
}
7272

7373
/**

0 commit comments

Comments
 (0)