@@ -117,7 +117,7 @@ public List<XmlTag> getRoutes(final @NotNull Method method) {
117117 final String methodFqn = method .getFQN ();
118118
119119 if (!routesCache .containsKey (methodFqn )) {
120- List <XmlTag > routesForMethod = extractRoutesForMethod (method );
120+ final List <XmlTag > routesForMethod = extractRoutesForMethod (method );
121121 sortRoutes (routesForMethod );
122122 routesCache .put (methodFqn , routesForMethod );
123123 }
@@ -132,16 +132,40 @@ public List<XmlTag> getRoutes(final @NotNull Method method) {
132132 * Results are not cached.
133133 */
134134 public List <XmlTag > extractRoutesForMethod (final @ NotNull Method method ) {
135- final List <XmlTag > routesForMethod = WebApiTypeIndex .getWebApiRoutes (method );
135+ final List <XmlTag > routesForMethod = new ArrayList <>();
136+ final Map <String , List <XmlTag >> routesForMethodMap = new HashMap <>();
137+
138+ for (final Map .Entry <String , List <XmlTag >> entry
139+ : extractRoutesForMethodRecursively (method , routesForMethodMap ).entrySet ()) {
140+ routesForMethod .addAll (entry .getValue ());
141+ }
142+
143+ return routesForMethod ;
144+ }
145+
146+ private Map <String , List <XmlTag >> extractRoutesForMethodRecursively (
147+ final @ NotNull Method method ,
148+ final Map <String , List <XmlTag >> routesForMethod
149+ ) {
150+ routesForMethod .put (method .getFQN (), WebApiTypeIndex .getWebApiRoutes (method ));
136151 final PhpClass phpClass = method .getContainingClass ();
137152
138153 if (phpClass == null ) {
139154 return routesForMethod ;
140155 }
156+
141157 for (final PhpClass parent : method .getContainingClass ().getSupers ()) {
142158 for (Method parentMethod : parent .getMethods ()) {
143159 if (parentMethod .getName ().equals (method .getName ())) {
144- routesForMethod .addAll (extractRoutesForMethod (parentMethod ));
160+ if (routesForMethod .containsKey (parentMethod .getFQN ())) {
161+ continue ;
162+ }
163+ routesForMethod .putAll (
164+ extractRoutesForMethodRecursively (
165+ parentMethod ,
166+ routesForMethod
167+ )
168+ );
145169 }
146170 }
147171 }
0 commit comments