private static AnnotationMirror isFluent(DeclaredType annotationType, Elements elementUtils,
Types typeUtils, TypeElement declaring, ExecutableElement method, TypeMirror type) {
for (TypeMirror directSuperType : typeUtils.directSupertypes(type)) {
Element directSuperTypeElt = typeUtils.asElement(directSuperType);
if (directSuperTypeElt instanceof TypeElement) {
List<ExecutableElement> methods = ((TypeElement) directSuperTypeElt).getEnclosedElements().stream().
filter(member -> member.getKind() == ElementKind.METHOD).map(member -> (ExecutableElement) member).
collect(Collectors.toList());
for (ExecutableElement m : methods) {
if (elementUtils.overrides(method, m, declaring)) {
AnnotationMirror annotation = resolveMethodAnnotation(annotationType, elementUtils, typeUtils, (TypeElement) directSuperTypeElt, m);
if (annotation != null) {
return annotation;
}
}
}
AnnotationMirror annotation = isFluent(annotationType, elementUtils, typeUtils, declaring, method, directSuperType);
if (annotation != null) {
return annotation;
}
}
}
return null;
}