@@ -595,7 +595,7 @@ private Map<String, List<String>> getRolesAllowedMethodReferences(OpenApiFiltere
595595 .flatMap (Collection ::stream )
596596 .flatMap (t -> getMethods (t , index ))
597597 .collect (Collectors .toMap (
598- e -> createUniqueMethodReference (e .getKey ().declaringClass (), e .getKey ()),
598+ e -> createUniqueMethodReference (e .getKey ().classInfo (), e .getKey (). method ()),
599599 e -> List .of (e .getValue ().value ().asStringArray ()),
600600 (v1 , v2 ) -> {
601601 if (!Objects .equals (v1 , v2 )) {
@@ -615,7 +615,7 @@ private List<String> getPermissionsAllowedMethodReferences(
615615 .getAnnotations (DotName .createSimple (PermissionsAllowed .class ))
616616 .stream ()
617617 .flatMap (t -> getMethods (t , index ))
618- .map (e -> createUniqueMethodReference (e .getKey ().declaringClass (), e .getKey ()))
618+ .map (e -> createUniqueMethodReference (e .getKey ().classInfo (), e .getKey (). method ()))
619619 .distinct ()
620620 .toList ();
621621 }
@@ -626,18 +626,18 @@ private List<String> getAuthenticatedMethodReferences(OpenApiFilteredIndexViewBu
626626 .getAnnotations (DotName .createSimple (Authenticated .class .getName ()))
627627 .stream ()
628628 .flatMap (t -> getMethods (t , index ))
629- .map (e -> createUniqueMethodReference (e .getKey ().declaringClass (), e .getKey ()))
629+ .map (e -> createUniqueMethodReference (e .getKey ().classInfo (), e .getKey (). method ()))
630630 .distinct ()
631631 .toList ();
632632 }
633633
634- private static Stream <Map .Entry <MethodInfo , AnnotationInstance >> getMethods (AnnotationInstance annotation ,
634+ private static Stream <Map .Entry <ClassAndMethod , AnnotationInstance >> getMethods (AnnotationInstance annotation ,
635635 IndexView index ) {
636636 if (annotation .target ().kind () == Kind .METHOD ) {
637637 MethodInfo method = annotation .target ().asMethod ();
638638
639639 if (isValidOpenAPIMethodForAutoAdd (method )) {
640- return Stream .of (Map .entry (method , annotation ));
640+ return Stream .of (Map .entry (new ClassAndMethod ( method . declaringClass (), method ) , annotation ));
641641 }
642642 } else if (annotation .target ().kind () == Kind .CLASS ) {
643643 ClassInfo classInfo = annotation .target ().asClass ();
@@ -647,7 +647,23 @@ private static Stream<Map.Entry<MethodInfo, AnnotationInstance>> getMethods(Anno
647647 // drop methods that specify the annotation directly
648648 .filter (method -> !method .hasDeclaredAnnotation (annotation .name ()))
649649 .filter (method -> isValidOpenAPIMethodForAutoAdd (method ))
650- .map (method -> Map .entry (method , annotation ));
650+ .map (method -> {
651+ final ClassInfo resourceClass ;
652+
653+ if (method .declaringClass ().isInterface ()) {
654+ /*
655+ * smallrye-open-api processes interfaces as the resource class as long as
656+ * there is a concrete implementation available. Using the interface method's
657+ * declaring class here allows us to match on the hash that will be set by
658+ * #handleOperation during scanning.
659+ */
660+ resourceClass = method .declaringClass ();
661+ } else {
662+ resourceClass = classInfo ;
663+ }
664+
665+ return Map .entry (new ClassAndMethod (resourceClass , method ), annotation );
666+ });
651667 }
652668
653669 return Stream .empty ();
@@ -678,7 +694,7 @@ private Map<String, ClassAndMethod> getClassNamesMethodReferences(
678694 .getAllKnownSubclasses (declaringClass .name ()), classNames );
679695 } else {
680696 String ref = createUniqueMethodReference (declaringClass , method );
681- classNames .put (ref , new ClassAndMethod (declaringClass . simpleName () , method . name () ));
697+ classNames .put (ref , new ClassAndMethod (declaringClass , method ));
682698 }
683699 }
684700 }
@@ -688,16 +704,15 @@ private Map<String, ClassAndMethod> getClassNamesMethodReferences(
688704 void addMethodImplementationClassNames (MethodInfo method , Type [] params , Collection <ClassInfo > classes ,
689705 Map <String , ClassAndMethod > classNames ) {
690706 for (ClassInfo impl : classes ) {
691- String simpleClassName = impl .simpleName ();
692707 MethodInfo implMethod = impl .method (method .name (), params );
693708
694709 if (implMethod != null ) {
695710 classNames .put (createUniqueMethodReference (impl , implMethod ),
696- new ClassAndMethod (simpleClassName , implMethod . name () ));
711+ new ClassAndMethod (impl , implMethod ));
697712 }
698713
699714 classNames .put (createUniqueMethodReference (impl , method ),
700- new ClassAndMethod (simpleClassName , method . name () ));
715+ new ClassAndMethod (impl , method ));
701716 }
702717 }
703718
@@ -769,7 +784,6 @@ private static boolean isOpenAPIEndpoint(MethodInfo method) {
769784 }
770785
771786 private static List <MethodInfo > getMethods (ClassInfo declaringClass , IndexView index ) {
772-
773787 List <MethodInfo > methods = new ArrayList <>();
774788 methods .addAll (declaringClass .methods ());
775789
@@ -782,8 +796,17 @@ private static List<MethodInfo> getMethods(ClassInfo declaringClass, IndexView i
782796 }
783797 }
784798 }
785- return methods ;
786799
800+ DotName superClassName = declaringClass .superName ();
801+ if (superClassName != null ) {
802+ ClassInfo superClass = index .getClassByName (superClassName );
803+
804+ if (superClass != null ) {
805+ methods .addAll (getMethods (superClass , index ));
806+ }
807+ }
808+
809+ return methods ;
787810 }
788811
789812 private static Set <DotName > getAllOpenAPIEndpoints () {
0 commit comments