@Override public boolean satisfiedBy(PsiElement element) { if (!(element instanceof GrMethodCallExpression)) { return false; } final GrMethodCallExpression call = (GrMethodCallExpression) element; final GrExpression invokedExpression = call.getInvokedExpression(); if (invokedExpression == null) { return false; } final PsiType type = invokedExpression.getType(); if (type == null) { return false; } if (!type.equalsToText(GroovyCommonClassNames.GROOVY_LANG_CLOSURE)) { return false; } return !ErrorUtil.containsError(element); }
@Override public void visitConditionalExpression(GrConditionalExpression exp) { super.visitConditionalExpression(exp); final GrExpression condition = exp.getCondition(); final PsiType type = condition.getType(); if (type == null || !(PsiType.BOOLEAN.isAssignableFrom(type))) { return; } if (ErrorUtil.containsError(exp)) return; final GrExpression thenExpression = exp.getThenBranch(); if (thenExpression == null) { return; } final GrExpression elseExpression = exp.getElseBranch(); if (elseExpression == null) { return; } if ((isFalse(thenExpression) && isTrue(elseExpression)) || (isTrue(thenExpression) && isFalse(elseExpression))) { registerError(exp); } }