disable "invert if condition" on invalid negation

This commit is contained in:
peter
2017-07-12 16:44:49 +02:00
parent 88c5ca5332
commit adbd75d086
2 changed files with 7 additions and 0 deletions

View File

@@ -47,6 +47,7 @@ public class InvertIfConditionAction extends PsiElementBaseIntentionAction {
if (ifStatement == null) return false;
final PsiExpression condition = ifStatement.getCondition();
if (condition == null) return false;
if (condition instanceof PsiPrefixExpression && ((PsiPrefixExpression)condition).getOperand() == null) return false;
if (ifStatement.getThenBranch() == null) return false;
if (element instanceof PsiKeyword) {
PsiKeyword keyword = (PsiKeyword) element;

View File

@@ -0,0 +1,6 @@
// "Invert 'if' condition" "false"
class A {
public void foo(boolean c) {
if (<caret>!) return;
}
}