Skip to content
This repository was archived by the owner on May 12, 2025. It is now read-only.

Commit 2e4418d

Browse files
authored
Prevent potential Java 21 issue (#209)
* Apply new caselabel way of working and make sure rewrite java 21 is available on classpath * Fix compile issue
1 parent 4d28da3 commit 2e4418d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

rewrite-javascript/src/main/java/org/openrewrite/javascript/cleanup/UseCaseFallThrough.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public J.Switch visitSwitch(J.Switch switch_, ExecutionContext ctx) {
7171
}
7272

7373
s = s.withCases(s.getCases().withStatements(ListUtils.flatMap(s.getCases().getStatements(), it -> {
74-
if (it instanceof J.Case && changeCondition(((J.Case) it).getExpressions())) {
74+
if (it instanceof J.Case && changeCondition(((J.Case) it).getCaseLabels())) {
7575
J.Case c = (J.Case) it;
7676
final List<Statement> converted = convertToFallThrough(c);
7777
return ListUtils.map(converted, (i, st) -> {
@@ -129,8 +129,8 @@ private List<Statement> convertToFallThrough(J.Case c) {
129129
return cases;
130130
}
131131

132-
private boolean changeCondition(List<Expression> expressions) {
133-
for (Expression expression : expressions) {
132+
private boolean changeCondition(List<J> expressions) {
133+
for (J expression : expressions) {
134134
if (!(expression instanceof J.Binary) || !isTarget((J.Binary) expression)) {
135135
return false;
136136
}

0 commit comments

Comments
 (0)