diff --git a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java index 682ca94ae7ea..0a8405a5ea88 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java @@ -90,23 +90,16 @@ public JSONTokener(String in) { */ public Object nextValue() throws JSONException { int c = nextCleanInternal(); - switch (c) { - case -1: - throw syntaxError("End of input"); - - case '{': - return readObject(); - - case '[': - return readArray(); - - case '\'', '"': - return nextString((char) c); - - default: + return switch (c) { + case -1 -> throw syntaxError("End of input"); + case '{' -> readObject(); + case '[' -> readArray(); + case '\'', '"' -> nextString((char) c); + default -> { this.pos--; - return readLiteral(); - } + yield readLiteral(); + } + }; } private int nextCleanInternal() throws JSONException {