Source:
private static <C, R> R processMethodHierarchy(C context, int[] aggregateIndex, Class<?> sourceClass, AnnotationsProcessor<C, R> processor, @Nullable BiPredicate<C, Class<?>> classFilter, Method rootMethod, boolean includeInterfaces) { R result = processor.doWithAggregate(context, aggregateIndex[0]); if (result != null) { return result; } if (hasPlainJavaAnnotationsOnly(sourceClass)) { return null; } boolean calledProcessor = false; if (sourceClass == rootMethod.getDeclaringClass()) { result = processMethodAnnotations(context, aggregateIndex[0], rootMethod, processor, classFilter); calledProcessor = true; if (result != null) { return result; } } else { for (Method candidateMethod : getBaseTypeMethods(context, sourceClass, classFilter)) { if (candidateMethod != null && isOverride(rootMethod, candidateMethod)) { result = processMethodAnnotations(context, aggregateIndex[0], candidateMethod, processor, classFilter); calledProcessor = true; if (result != null) { return result; } } } } if (Modifier.isPrivate(rootMethod.getModifiers())) { return null; } if (calledProcessor) { aggregateIndex[0]++; } if (includeInterfaces) { for (Class<?> interfaceType : sourceClass.getInterfaces()) { R interfacesResult = processMethodHierarchy(context, aggregateIndex, interfaceType, processor, classFilter, rootMethod, true); if (interfacesResult != null) { return interfacesResult; } } } Class<?> superclass = sourceClass.getSuperclass(); if (superclass != Object.class && superclass != null) { R superclassResult = processMethodHierarchy(context, aggregateIndex, superclass, processor, classFilter, rootMethod, includeInterfaces); return superclassResult; } return null; }

Target:
private static <C, R> R processMethodHierarchy(C context, int[] aggregateIndex, Class<?> sourceClass, AnnotationsProcessor<C, R> processor, @Nullable BiPredicate<C, Class<?>> classFilter, Method rootMethod, boolean includeInterfaces) { R result = processor.doWithAggregate(context, aggregateIndex[0]); if (result != null) { return result; } if (hasPlainJavaAnnotationsOnly(sourceClass)) { return null; } boolean calledProcessor = false; if (sourceClass == rootMethod.getDeclaringClass()) { result = processMethodAnnotations(context, aggregateIndex[0], rootMethod, processor, classFilter); calledProcessor = true; if (result != null) { return result; } } else { for (Method candidateMethod : getBaseTypeMethods(context, sourceClass, classFilter)) { if (candidateMethod != null && isOverride(rootMethod, candidateMethod)) { result = processMethodAnnotations(context, aggregateIndex[0], candidateMethod, processor, classFilter); calledProcessor = true; if (result != null) { return result; } } } } if (Modifier.isPrivate(rootMethod.getModifiers())) { return null; } if (calledProcessor) { aggregateIndex[0]++; } if (includeInterfaces) { for (Class<?> interfaceType : sourceClass.getInterfaces()) { R interfacesResult = processMethodHierarchy(context, aggregateIndex, interfaceType, processor, classFilter, rootMethod, true); if (interfacesResult != null) { return interfacesResult; } } } Class<?> superclass = sourceClass.getSuperclass(); if (superclass != Object.class && superclass != null) { R superclassResult = processMethodHierarchy(context, aggregateIndex, superclass, processor, classFilter, rootMethod, includeInterfaces); if (superclassResult != null) { return superclassResult; } } return null; }