Skip to content

Commit 4268b6d

Browse files
committed
优化泛型数据获取
1 parent 226fd46 commit 4268b6d

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ plugins {
44
}
55

66
group 'com.liuzhihang'
7-
version '1.1.9'
7+
version '1.1.10'
88

99
JavaVersion.VERSION_11
1010

parts/changeNotes.html

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,19 +3,18 @@
33

44
<h4>English introduction</h4>
55
<ul>
6-
<li>1.1.9
6+
<li>1.1.10
77
<ol>
8-
<li>Fix: Dubbo interface input object upload YApi does not show</li>
9-
<li>merge: Support feign client</li>
8+
<li>Optimize generic data acquisition</li>
109
</ol>
1110
</li>
1211
<li><a href="https://github.com/liuzhihang/doc-view/blob/master/doc/ChangeNotes.md">More records</a></li>
1312
</ul>
1413
<h4>中文介绍</h4>
1514
<ul>
16-
<li>1.1.9
15+
<li>1.1.10
1716
<ol>
18-
<li>fix: Dubbo 接口入参对象上传 YApi 不展示</li>
17+
<li>优化泛型数据获取</li>
1918
<li>备注:当前版本使用 swingx-core 依赖生成 TreeTable, 导致插件包占用空间变大, 需要后期调整, 具体可参考:
2019
https://youtrack.jetbrains.com/issue/IDEA-275249 ,如果小伙伴有其他解决方式, 希望可以联系我,或者提 Issue.
2120
</li>

src/main/java/com/liuzhihang/doc/view/utils/ParamPsiUtils.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public static void buildBodyParam(PsiField field, Map<String, PsiType> genericsM
8080
// 集合参数构建, 集合就一个参数, 泛型 E
8181
fieldGenericsMap = CustomPsiUtils.getGenericsMap((PsiClassType) iterableType);
8282
parentBody = buildFieldGenericsBody("E", childClass, body);
83-
parent.getChildList().add(parentBody);
83+
8484

8585
} else if (InheritanceUtil.isInheritor(type, CommonClassNames.JAVA_UTIL_MAP)) {
8686
// HashMap or Map 的泛型获取 value
@@ -95,8 +95,7 @@ public static void buildBodyParam(PsiField field, Map<String, PsiType> genericsM
9595
return;
9696
}
9797

98-
Body matKeyBody = buildFieldGenericsBody("key", matKeyClass, body);
99-
parent.getChildList().add(matKeyBody);
98+
buildFieldGenericsBody("key", matKeyClass, body);
10099

101100
// Value
102101
PsiType matValueType = PsiUtil.substituteTypeParameter(type, CommonClassNames.JAVA_UTIL_MAP, 1, false);
@@ -111,7 +110,7 @@ public static void buildBodyParam(PsiField field, Map<String, PsiType> genericsM
111110

112111
fieldGenericsMap = CustomPsiUtils.getGenericsMap((PsiClassType) matValueType);
113112
parentBody = buildFieldGenericsBody("value", childClass, body);
114-
parent.getChildList().add(parentBody);
113+
115114

116115
} else if (fieldClass.isEnum() || fieldClass.isInterface() || fieldClass.isAnnotationType()) {
117116
// 字段是类, 也可能带泛型
@@ -142,6 +141,7 @@ private static Body buildFieldGenericsBody(String name, PsiClass GenericsClass,
142141
listBody.setDesc("");
143142
listBody.setParent(parent);
144143

144+
parent.getChildList().add(listBody);
145145
return listBody;
146146
}
147147

0 commit comments

Comments
 (0)