Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(rpc): Fix the ClassCastException issue that occurs during the construction of the RPC. #889 #890

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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());
}

}