Skip to content

Commit 0f1da8f

Browse files
committed
Minor touch-ups
1 parent 0b09c20 commit 0f1da8f

File tree

2 files changed

+6
-5
lines changed

2 files changed

+6
-5
lines changed

src/main/java/org/openrewrite/staticanalysis/AvoidBoxedBooleanExpressions.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ public Expression visitExpression(Expression expression, ExecutionContext ctx) {
5959
Expression e = (Expression) super.visitExpression(expression, ctx);
6060
if (TypeUtils.isOfClassType(e.getType(), "java.lang.Boolean")) {
6161
if (isControlExpression(expression)) {
62-
return JavaTemplate.builder("Boolean.TRUE.equals(#{any(java.lang.Boolean)})").build()
63-
.apply(updateCursor(e), e.getCoordinates().replace(), e);
62+
return JavaTemplate.apply("Boolean.TRUE.equals(#{any(java.lang.Boolean)})",
63+
updateCursor(e), e.getCoordinates().replace(), e);
6464
}
6565
}
6666
return e;
@@ -70,8 +70,8 @@ public Expression visitExpression(Expression expression, ExecutionContext ctx) {
7070
public J visitUnary(J.Unary unary, ExecutionContext executionContext) {
7171
J.Unary un = (J.Unary) super.visitUnary(unary, executionContext);
7272
if (J.Unary.Type.Not == un.getOperator() && TypeUtils.isOfClassType(un.getExpression().getType(), "java.lang.Boolean")) {
73-
return JavaTemplate.builder("Boolean.FALSE.equals(#{any(java.lang.Boolean)})").build()
74-
.apply(updateCursor(un), un.getCoordinates().replace(), un.getExpression());
73+
return JavaTemplate.apply("Boolean.FALSE.equals(#{any(java.lang.Boolean)})",
74+
updateCursor(un), un.getCoordinates().replace(), un.getExpression());
7575
}
7676
return un;
7777
}

src/main/java/org/openrewrite/staticanalysis/UseForEachRemoveInsteadOfSetRemoveAll.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ public J.MethodInvocation visitMethodInvocation(J.MethodInvocation method, Execu
4444
J.MethodInvocation mi = super.visitMethodInvocation(method, executionContext);
4545
if (removeAll.matches(mi) && !returnValueIsUsed()) {
4646
mi = JavaTemplate.builder("#{any(java.util.Collection)}.forEach(#{any(java.util.Set)}::remove)")
47-
.build().apply(updateCursor(mi), mi.getCoordinates().replace(), mi.getArguments().get(0), mi.getSelect());
47+
.build()
48+
.apply(updateCursor(mi), mi.getCoordinates().replace(), mi.getArguments().get(0), mi.getSelect());
4849
}
4950
return mi;
5051
}

0 commit comments

Comments
 (0)