Skip to content

Commit cc154f7

Browse files
committed
use enhance switch statement
1 parent f832dcf commit cc154f7

File tree

1 file changed

+9
-16
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json

1 file changed

+9
-16
lines changed

spring-boot-project/spring-boot-tools/spring-boot-configuration-processor/src/json-shade/java/org/springframework/boot/configurationprocessor/json/JSONTokener.java

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,23 +90,16 @@ public JSONTokener(String in) {
9090
*/
9191
public Object nextValue() throws JSONException {
9292
int c = nextCleanInternal();
93-
switch (c) {
94-
case -1:
95-
throw syntaxError("End of input");
96-
97-
case '{':
98-
return readObject();
99-
100-
case '[':
101-
return readArray();
102-
103-
case '\'', '"':
104-
return nextString((char) c);
105-
106-
default:
93+
return switch (c) {
94+
case -1 -> throw syntaxError("End of input");
95+
case '{' -> readObject();
96+
case '[' -> readArray();
97+
case '\'', '"' -> nextString((char) c);
98+
default -> {
10799
this.pos--;
108-
return readLiteral();
109-
}
100+
yield readLiteral();
101+
}
102+
};
110103
}
111104

112105
private int nextCleanInternal() throws JSONException {

0 commit comments

Comments
 (0)