Skip to content

Commit

Permalink
fix(rpc): Fix the ClassCastException issue that occurs during the con…
Browse files Browse the repository at this point in the history
…struction of the RPC
  • Loading branch information
luoxianggan committed Aug 16, 2024
1 parent 78f737d commit 1339f45
Showing 1 changed file with 24 additions and 9 deletions.
33 changes: 24 additions & 9 deletions src/main/java/com/ly/doc/template/RpcDocBuildTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,14 @@
import com.ly.doc.constants.DocTags;
import com.ly.doc.constants.DubboAnnotationConstants;
import com.ly.doc.constants.FrameworkEnum;
import com.ly.doc.model.ApiConfig;
import com.ly.doc.model.ApiSchema;
import com.ly.doc.model.RpcJavaMethod;
import com.ly.doc.model.WebSocketDoc;
import com.ly.doc.model.*;
import com.ly.doc.model.annotation.FrameworkAnnotations;
import com.ly.doc.model.rpc.RpcApiDoc;
import com.ly.doc.utils.DocUtil;
import com.ly.doc.utils.JavaClassUtil;
import com.power.common.util.StringUtil;
import com.power.common.util.ValidateUtil;
import com.thoughtworks.qdox.model.DocletTag;
import com.thoughtworks.qdox.model.JavaAnnotation;
import com.thoughtworks.qdox.model.JavaClass;
import com.thoughtworks.qdox.model.JavaType;
import com.thoughtworks.qdox.model.*;
import com.thoughtworks.qdox.model.expression.AnnotationValue;

import java.util.*;
Expand Down Expand Up @@ -87,7 +81,7 @@ public ApiSchema<RpcApiDoc> renderApi(ProjectDocConfigBuilder projectBuilder,
setCustomOrder = true;
maxOrder = Math.max(maxOrder, order);
}
List<RpcJavaMethod> apiMethodDocs = (List<RpcJavaMethod>) buildServiceMethod(cls, apiConfig,
List<RpcJavaMethod> apiMethodDocs = (List<RpcJavaMethod>) this.buildServiceMethod(cls, apiConfig,
projectBuilder);
this.handleJavaApiDoc(cls, apiDocList, apiMethodDocs, order, projectBuilder);
}
Expand Down Expand Up @@ -228,4 +222,25 @@ private void handleJavaApiDoc(JavaClass cls, List<RpcApiDoc> apiDocList, List<Rp
apiDocList.add(apiDoc);
}

@Override
public JavadocJavaMethod convertToJavadocJavaMethod(ApiConfig apiConfig, JavaMethod method,
Map<String, JavaType> actualTypesMap) {
JavadocJavaMethod javaMethod = IRpcDocTemplate.super.convertToJavadocJavaMethod(apiConfig, method,
actualTypesMap);
return new RpcJavaMethod().setDetail(javaMethod.getDetail())
.setAuthor(javaMethod.getAuthor())
.setMethodDefinition(javaMethod.getMethodDefinition())
.setOrder(javaMethod.getOrder())
.setRequestParams(javaMethod.getRequestParams())
.setResponseParams(javaMethod.getResponseParams())
.setDeprecated((javaMethod.isDeprecated()))
.setVersion((javaMethod.getVersion()))
.setActualTypesMap(javaMethod.getActualTypesMap())
.setName(javaMethod.getName())
.setEscapeMethodDefinition(javaMethod.getEscapeMethodDefinition())
.setMethodId(javaMethod.getMethodId())
.setJavaMethod(javaMethod.getJavaMethod())
.setReturnClassInfo(javaMethod.getReturnClassInfo());
}

}

0 comments on commit 1339f45

Please sign in to comment.