@@ -117,7 +117,7 @@ public List<XmlTag> getRoutes(final @NotNull Method method) {
117
117
final String methodFqn = method .getFQN ();
118
118
119
119
if (!routesCache .containsKey (methodFqn )) {
120
- List <XmlTag > routesForMethod = extractRoutesForMethod (method );
120
+ final List <XmlTag > routesForMethod = extractRoutesForMethod (method );
121
121
sortRoutes (routesForMethod );
122
122
routesCache .put (methodFqn , routesForMethod );
123
123
}
@@ -132,16 +132,40 @@ public List<XmlTag> getRoutes(final @NotNull Method method) {
132
132
* Results are not cached.
133
133
*/
134
134
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 ));
136
151
final PhpClass phpClass = method .getContainingClass ();
137
152
138
153
if (phpClass == null ) {
139
154
return routesForMethod ;
140
155
}
156
+
141
157
for (final PhpClass parent : method .getContainingClass ().getSupers ()) {
142
158
for (Method parentMethod : parent .getMethods ()) {
143
159
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
+ );
145
169
}
146
170
}
147
171
}
0 commit comments