mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-13 09:19:13 +07:00
don't insert unneeded parentheses on "invert if"
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
// "Invert 'if' condition" "true"
|
||||
class Inversion {
|
||||
public void context(boolean a, boolean b, boolean c) {
|
||||
if ((!a || !b || !c)) {
|
||||
System.out.println(1);
|
||||
}
|
||||
else {
|
||||
System.out.println(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// "Invert 'if' condition" "true"
|
||||
class Inversion {
|
||||
public void context(boolean a, boolean b, boolean c) {
|
||||
if ((a &<caret>& b && c)) {
|
||||
System.out.println(0);
|
||||
} else {
|
||||
System.out.println(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -54,7 +54,7 @@ public class CodeInsightServicesUtil {
|
||||
op.replace(inverted);
|
||||
}
|
||||
}
|
||||
if (tokenType == JavaTokenType.ANDAND && booleanExpression.getParent() instanceof PsiExpression) {
|
||||
if (tokenType == JavaTokenType.ANDAND && booleanExpression.getParent() instanceof PsiPolyadicExpression) {
|
||||
final PsiParenthesizedExpression parth = (PsiParenthesizedExpression)factory.createExpressionFromText("(a)", expression);
|
||||
parth.getExpression().replace(expression);
|
||||
return parth;
|
||||
|
||||
Reference in New Issue
Block a user