boolean (PsiExpression subExpression) { if (CodeBlockSurrounder.canSurround(subExpression)) return true; if (!mySubExpressionValue) { PsiElement parent = PsiUtil.skipParenthesizedExprUp(subExpression.getParent()); if (parent instanceof PsiWhileStatement || parent instanceof PsiForStatement) return true; // code like "if (foo || alwaysFalseWithSideEffects) {}" return parent instanceof PsiPolyadicExpression polyadic && polyadic.getOperationTokenType().equals(JavaTokenType.OROR) && PsiTreeUtil.isAncestor(ArrayUtil.getLastElement(polyadic.getOperands()), subExpression, false) && PsiUtil.skipParenthesizedExprUp(parent.getParent()) instanceof PsiIfStatement; } return false; }