Condition<PsiMethod> (@NotNull PsiAnnotation annotation) { Condition<PsiMethod> result = method -> { if (method.isConstructor() || method.hasModifierProperty(PsiModifier.STATIC)) return false; final PsiClass containingClass = method.getContainingClass(); if (containingClass == null) return false; final String qname = containingClass.getQualifiedName(); if (CommonClassNames.JAVA_LANG_OBJECT.equals(qname)) return false; if (GroovyCommonClassNames.GROOVY_OBJECT.equals(qname)) return false; if (GroovyCommonClassNames.GROOVY_OBJECT_SUPPORT.equals(qname)) return false; if (overridesObjectOrGroovyObject(method)) return false; return true; }; if (!myDeprecated) { result = Conditions.and(result, method -> PsiImplUtil.getAnnotation(method, CommonClassNames.JAVA_LANG_DEPRECATED) == null); } List<String> excludes = GrAnnotationUtil.getStringArrayValue(annotation, "excludes", true); if (!excludes.isEmpty()) { return Conditions.and(result, method -> !excludes.contains(method.getName())); } List<String> includes = GrAnnotationUtil.getStringArrayValue(annotation, "includes", true); if (!includes.isEmpty()) { return Conditions.and(result, method -> includes.contains(method.getName())); } List<PsiClass> excludeTypes = GrAnnotationUtil.getClassArrayValue(annotation, "excludeTypes", true); if (!excludeTypes.isEmpty()) { return Conditions.and(result, method -> { for (PsiClass excludeProvider : excludeTypes) { if (excludeProvider.findMethodBySignature(method, false) != null) { return false; } } return true; }); } List<PsiClass> includeTypes = GrAnnotationUtil.getClassArrayValue(annotation, "includeTypes", true); if (!includeTypes.isEmpty()) { return Conditions.and(result, method -> { for (PsiClass includeProvider : includeTypes) { if (includeProvider.findMethodBySignature(method, false) != null) { return true; } } return false; }); } return result; }