diff --git a/src/main/java/com/ly/doc/template/IRpcDocTemplate.java b/src/main/java/com/ly/doc/template/IRpcDocTemplate.java index 6aace296..546ea170 100644 --- a/src/main/java/com/ly/doc/template/IRpcDocTemplate.java +++ b/src/main/java/com/ly/doc/template/IRpcDocTemplate.java @@ -132,6 +132,19 @@ default List getParentsClassMethods(ApiConfig apiConfig, JavaClas return docJavaMethods; } + default List getInterfaceMethods(ApiConfig apiConfig, JavaClass cls) { + List docJavaMethods = new ArrayList<>(); + for (JavaClass javaInterface : cls.getInterfaces()) { + Map actualTypesMap = JavaClassUtil.getActualTypesMap(javaInterface); + List interfaceMethodList = javaInterface.getMethods(); + for (JavaMethod method : interfaceMethodList) { + docJavaMethods.add(convertToRpcJavaMethod(apiConfig, method, actualTypesMap)); + } + docJavaMethods.addAll(getInterfaceMethods(apiConfig, javaInterface)); + } + return docJavaMethods; + } + default String replaceTypeName(String type, Map actualTypesMap, boolean simple) { if (Objects.isNull(actualTypesMap)) { return type; diff --git a/src/main/java/com/ly/doc/template/RpcDocBuildTemplate.java b/src/main/java/com/ly/doc/template/RpcDocBuildTemplate.java index 24864dc8..391a8dea 100644 --- a/src/main/java/com/ly/doc/template/RpcDocBuildTemplate.java +++ b/src/main/java/com/ly/doc/template/RpcDocBuildTemplate.java @@ -126,16 +126,7 @@ private List buildServiceMethod(final JavaClass cls, ApiConfig ap // add parent class methods methodDocList.addAll(getParentsClassMethods(apiConfig, cls)); if (cls.isInterface() || cls.isAbstract()) { - List implClasses = cls.getImplements(); - for (JavaType type : implClasses) { - JavaClass javaClass = (JavaClass) type; - Map actualTypesMap = JavaClassUtil.getActualTypesMap(javaClass); - for (JavaMethod method : javaClass.getMethods()) { - if (!method.isDefault()) { - methodDocList.add(convertToRpcJavaMethod(apiConfig, method, actualTypesMap)); - } - } - } + methodDocList.addAll(getInterfaceMethods(apiConfig,cls)); } int methodOrder = 0;