mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-05-06 05:10:22 +07:00
FoldExpressionIntoStreamInspection: deparenthesize when testing whether it's too simple case
This commit is contained in:
@@ -79,8 +79,8 @@ public class FoldExpressionIntoStreamInspection extends AbstractBaseJavaLocalIns
|
||||
if (!StreamApiUtil.isSupportedStreamElement(left.getType()) || !ExpressionUtils.isSafelyRecomputableExpression(left)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
if (operands[0] instanceof PsiBinaryExpression) {
|
||||
PsiBinaryExpression binOp = (PsiBinaryExpression)operands[0];
|
||||
PsiBinaryExpression binOp = tryCast(PsiUtil.skipParenthesizedExprDown(operands[0]), PsiBinaryExpression.class);
|
||||
if (binOp != null) {
|
||||
if (ComparisonUtils.isComparison(binOp) &&
|
||||
(left == binOp.getLOperand() && ExpressionUtils.isSafelyRecomputableExpression(binOp.getROperand())) ||
|
||||
(left == binOp.getROperand() && ExpressionUtils.isSafelyRecomputableExpression(binOp.getLOperand()))) {
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
// "Fold expression into Stream chain" "false"
|
||||
class Test {
|
||||
boolean foo(String a, String b, String c, String d) {
|
||||
return ((a) == (null)) || b == null || c == null || d == <caret>null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user