boolean (@Nullable GrExpression expression, boolean acceptVoidCalls) { if (expression instanceof GrParenthesizedExpression) return true; if (PsiUtil.isSuperReference(expression)) return true; if (expression instanceof GrReferenceExpression && expression.getParent() instanceof GrCall) { final GroovyResolveResult resolveResult = ((GrReferenceExpression)expression).advancedResolve(); final PsiElement resolved = resolveResult.getElement(); return resolved instanceof PsiMethod && !resolveResult.isInvokedOnProperty() || resolved instanceof PsiClass; } if (expression instanceof GrReferenceExpression && expression.getParent() instanceof GrReferenceExpression) { return !PsiUtil.isThisReference(expression) && ((GrReferenceExpression)expression).resolve() instanceof PsiClass; } if (expression instanceof GrClosableBlock && expression.getParent() instanceof GrStringInjection) return true; if (!acceptVoidCalls && expression instanceof GrMethodCall && PsiTypes.voidType().equals(expression.getType())) return true; return false; }