mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
TrivialIfInspection: remove asserts (for some reason javac compiles this file incorrectly if asserts present)
This commit is contained in:
+5
-4
@@ -142,11 +142,13 @@ public class TrivialIfInspection extends BaseInspection implements CleanupLocalI
|
||||
if (condition == null) {
|
||||
return;
|
||||
}
|
||||
CommentTracker tr = new CommentTracker();
|
||||
PsiReturnStatement nextStatement = ControlFlowUtils.getNextReturnStatement(statement);
|
||||
if (nextStatement == null) {
|
||||
return;
|
||||
}
|
||||
CommentTracker tr = new CommentTracker();
|
||||
@NonNls final String newStatement = "return " + tr.text(condition) + ';';
|
||||
PsiReplacementUtil.replaceStatement(statement, newStatement, tr);
|
||||
assert nextStatement != null;
|
||||
if (!ControlFlowUtils.isReachable(nextStatement)) {
|
||||
nextStatement.delete();
|
||||
}
|
||||
@@ -219,7 +221,7 @@ public class TrivialIfInspection extends BaseInspection implements CleanupLocalI
|
||||
private static void replaceSimplifiableImplicitAssignmentNegated(PsiIfStatement statement) {
|
||||
final PsiElement prevStatement = PsiTreeUtil.skipWhitespacesBackward(statement);
|
||||
final PsiExpression condition = statement.getCondition();
|
||||
if (condition == null) {
|
||||
if (condition == null || prevStatement == null) {
|
||||
return;
|
||||
}
|
||||
final String conditionText = BoolUtils.getNegatedExpressionText(condition);
|
||||
@@ -234,7 +236,6 @@ public class TrivialIfInspection extends BaseInspection implements CleanupLocalI
|
||||
final PsiExpression lhs = assignmentExpression.getLExpression();
|
||||
final String lhsText = lhs.getText();
|
||||
PsiReplacementUtil.replaceStatement(statement, lhsText + operand + conditionText + ';');
|
||||
assert prevStatement != null;
|
||||
prevStatement.delete();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user