Skip to content

Commit c932663

Browse files
authored
Merge pull request #507 from Rainfisher/dev
fix(protobuf): handle same package proto type reference
2 parents d5d17ed + e397c4a commit c932663

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

widget/light-jprotobuf/src/main/java/com/iohao/game/widget/light/protobuf/ProtoJavaAnalyse.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,13 @@ private String fieldProtoTypeToString(ProtoJavaField protoJavaField, Class<?> fi
209209
ProtoJavaRegionKey regionKey = protoJavaParent.getProtoJavaRegionKey();
210210
ProtoJavaRegion protoJavaRegion = this.getProtoJavaRegion(regionKey);
211211
protoJavaRegion.addOtherProtoFile(protoJavaFieldType);
212-
// 不在同一个文件中
213-
fieldProtoType = StrKit.format("{}.{}", filePackage, className);
212+
if (Objects.equals(protoJavaParent.getFilePackage(), filePackage)) {
213+
// 不在同一个文件夹,但是在同一个包下
214+
fieldProtoType = className;
215+
} else {
216+
// 不在同一个文件中
217+
fieldProtoType = StrKit.format("{}.{}", filePackage, className);
218+
}
214219
}
215220

216221
return fieldProtoType;

0 commit comments

Comments
 (0)