Source:
<code>private boolean containsAnnotation(ClassInfo classInfo, DotName requiredAnnotationName, Class<? extends Annotation> requiredAnnotation) { if (classInfo.annotations().containsKey(requiredAnnotationName)) { return true; } for (DotName annotation : classInfo.annotations().keySet()) { if (annotationClassAnnotationsCache.getValue(annotation).contains(requiredAnnotationName.toString())) { return true; } } final DotName superName = classInfo.superName(); if (superName != null && !OBJECT_NAME.equals(superName)) { final ClassInfo superClassInfo = index.getClassByName(superName); if (superClassInfo == null) { return Reflections.containsAnnotation(loadClass(superName.toString()), requiredAnnotation); } if (containsAnnotation(superClassInfo, requiredAnnotationName, requiredAnnotation)) { return true; } } for (DotName interfaceName : classInfo.interfaceNames()) { final ClassInfo interfaceInfo = index.getClassByName(interfaceName); if (interfaceInfo == null) { Class<?> interfaceClass = loadClass(interfaceName.toString()); for (Method method : interfaceClass.getDeclaredMethods()) { if (method.isDefault() && Reflections.containsAnnotations(method.getAnnotations(), requiredAnnotation)) { return true; } } continue; } for (MethodInfo method : interfaceInfo.methods()) { if (isDefault(method)) { if (method.hasAnnotation(requiredAnnotationName)) { return true; } <START> for (AnnotationInstance annotation : method.annotations()) { <END> if (annotationClassAnnotationsCache.getValue(annotation.name()).contains(requiredAnnotationName.toString())) { return true; } } } } } return false; }</code><technical_language>need a test case for this ;-)</technical_language>

Target:
private boolean containsAnnotation(ClassInfo classInfo, DotName requiredAnnotationName, Class<? extends Annotation> requiredAnnotation) { if (classInfo.annotations().containsKey(requiredAnnotationName)) { return true; } for (DotName annotation : classInfo.annotations().keySet()) { if (annotationClassAnnotationsCache.getValue(annotation).contains(requiredAnnotationName.toString())) { return true; } } final DotName superName = classInfo.superName(); if (superName != null && !OBJECT_NAME.equals(superName)) { final ClassInfo superClassInfo = index.getClassByName(superName); if (superClassInfo == null) { return Reflections.containsAnnotation(loadClass(superName.toString()), requiredAnnotation); } if (containsAnnotation(superClassInfo, requiredAnnotationName, requiredAnnotation)) { return true; } } for (DotName interfaceName : classInfo.interfaceNames()) { final ClassInfo interfaceInfo = index.getClassByName(interfaceName); if (interfaceInfo == null) { Class<?> interfaceClass = loadClass(interfaceName.toString()); for (Method method : interfaceClass.getDeclaredMethods()) { if (method.isDefault() && Reflections.containsAnnotations(method.getAnnotations(), requiredAnnotation)) { return true; } } continue; } for (MethodInfo method : interfaceInfo.methods()) { if (isNonAbstractPublicInstanceMethod(method)) { if (method.hasAnnotation(requiredAnnotationName)) { return true; } for (AnnotationInstance annotation : method.annotations()) { if (annotationClassAnnotationsCache.getValue(annotation.name()).contains(requiredAnnotationName.toString())) { return true; } } } } } return false; }