mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-20 13:31:28 +07:00
SimplifyBooleanExpressionAction: do not warn on x = (true)
This commit is contained in:
@@ -60,7 +60,9 @@ public class SimplifyBooleanExpressionAction implements IntentionAction{
|
||||
if (element == null) return null;
|
||||
PsiExpression expression = PsiTreeUtil.getParentOfType(element, PsiExpression.class);
|
||||
PsiElement parent = expression;
|
||||
while (parent instanceof PsiExpression && (PsiType.BOOLEAN.equals(((PsiExpression)parent).getType()) || parent instanceof PsiConditionalExpression)) {
|
||||
while (parent instanceof PsiExpression &&
|
||||
!(parent instanceof PsiAssignmentExpression) &&
|
||||
(PsiType.BOOLEAN.equals(((PsiExpression)parent).getType()) || parent instanceof PsiConditionalExpression)) {
|
||||
expression = (PsiExpression)parent;
|
||||
parent = parent.getParent();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
// "Simplify boolean expression" "false"
|
||||
class X {
|
||||
void f() {
|
||||
boolean x;
|
||||
x = (<caret>false); // Another action "Remove redundant parentheses" is ok here
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user