Encountered a ClassCastException during the build of Dubbo
Closed this issue · 2 comments
Contact Details
Version
3.0.6
Plugin
smart-doc-maven-plugin
Build tool version
maven 3.8.2
Jdk version
17
Describe the bug (Bug描述,社区已开启国际化推广,请用文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)
During the generation of Dubbo API documentation using torna-rpc, an object conversion problem occurred: ClassCastException: class com.ly.doc.model.JavadocJavaMethod cannot be cast to class com.ly.doc.model.RpcJavaMethod.
Specific reasons were found through debugging in the following code:
In the RpcDocBuildTemplate class, there's an issue with the object conversion in the collection for the method (List) buildServiceMethod(cls, apiConfig, projectBuilder).
Then, in the RpcTornaBuilder class, a ClassCastException occurs when executing the TornaUtil.buildDubboApis method at line 80, during the for loop.
Expected Behavior (您期望的结果,社区已开启国际化推广,请用文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)
The ability to construct Dubbo interface documentation
Current Behavior (当前结果,社区已开启国际化推广,请用文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)
ClassCastException
Steps to Reproduce (Bug产生步骤,请尽量提供用例代码。社区已开启国际化推广,请用文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)
- JavaDoc annotations for the Dubbo interface:
/**
Possible Solution (Bug解决建议,社区已开启国际化推广,请用文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)
Method one:
Implement the buildServiceMethod method in IRpcDocTemplate, facilitating future extensions of the RpcJavaMethod field.
Method two:
Change the RpcJavaMethod used in the for loop to JavadocJavaMethod. Currently, there are no special fields in RpcJavaMethod.
Context (Bug影响描述,社区已开启国际化推广,请用文心一言、讯飞星火等辅助翻译成英文,减少社区开发者的工作)
No response
Validations
- Check if you're on the latest smart-doc version. (请检查是否为最新版本)
- Read the docs. (请先阅读官方文档)
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate. (检查是否存在报告相同错误的问题,以避免产生重复)
@xiangganLuo Pull requests are warmly welcomed for collaborative development.
Alright, I'll handle it this afternoon and submit the PR.