Skip to content

Commit

Permalink
Mark OperatorWrap.wrapOption as optional
Browse files Browse the repository at this point in the history
  • Loading branch information
timtebeek committed Sep 21, 2024
1 parent 811af2d commit 606ce4b
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions src/main/java/org/openrewrite/staticanalysis/OperatorWrap.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public class OperatorWrap extends Recipe {
@Option(displayName = "Operator wrapping style",
description = "The operator wrapping style to enforce, which may differ from the configured or detected style.",
valid = {"EOL", "NL"},
example = "NL")
example = "NL",
required = false)
OperatorWrapStyle.@Nullable WrapOption wrapOption;

@Override
Expand Down Expand Up @@ -181,7 +182,7 @@ public J.InstanceOf visitInstanceOf(J.InstanceOf instanceOf, ExecutionContext ct
if (OperatorWrapStyle.WrapOption.NL.equals(operatorWrapStyle.getWrapOption())) {
if (i.getClazz().getPrefix().getWhitespace().contains("\n")) {
i = i.getPadding().withExpr(
i.getPadding().getExpr().withAfter(
i.getPadding().getExpression().withAfter(
i.getClazz().getPrefix()
)
);
Expand All @@ -191,15 +192,15 @@ public J.InstanceOf visitInstanceOf(J.InstanceOf instanceOf, ExecutionContext ct
)
);
}
} else if (i.getPadding().getExpr().getAfter().getWhitespace().contains("\n")) {
} else if (i.getPadding().getExpression().getAfter().getWhitespace().contains("\n")) {
i = i.withClazz(
i.getClazz().withPrefix(
i.getPadding().getExpr().getAfter()
i.getPadding().getExpression().getAfter()
)
);
i = i.getPadding().withExpr(
i.getPadding().getExpr().withAfter(
i.getPadding().getExpr().getAfter().withWhitespace(" ")
i.getPadding().getExpression().withAfter(
i.getPadding().getExpression().getAfter().withWhitespace(" ")
)
);
}
Expand Down

0 comments on commit 606ce4b

Please sign in to comment.