Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@ public static SimplifyStatus verifyBooleanIfElse(final IfStatement ifStatement)
if (thenStatement instanceof ReturnStatement returnStatement) {
if (returnStatement.getExpression() instanceof BooleanLiteral literal) {
thenValue= literal.booleanValue();
} else {
return SimplifyStatus.INVALID;
}
} else if (thenStatement instanceof Block block && block.statements().size() == 1
&& block.statements().get(0) instanceof ReturnStatement returnStatement) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16879,6 +16879,7 @@ public void testDoNotSimplifyBooleanIfElseExpression01() throws Exception {
package test1;

public class E {
String text;
public boolean doNotSimplifyIfBooleanSame(int x) {
if (x > 0 && x < 7) {
return true;
Expand Down Expand Up @@ -16911,6 +16912,13 @@ public int doNotSimplifyNoneBoolean(String x) {
return 2;
}
}

public boolean doNotSimplifyInfixExpression(Integer x) {
if (text != null)
return text.length() > 43;
else
return false;
}
}
""";

Expand Down
Loading