Skip to content

Commit

Permalink
Merge pull request #184 from ling-kong-ran/mybranch
Browse files Browse the repository at this point in the history
fix:MAP类型未指定泛型空指针问题
  • Loading branch information
jhunters authored Aug 29, 2022
2 parents 2e8e4a7 + 49049cd commit 56a4856
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,12 @@ private static void generateIDL(StringBuilder code, Class<?> cls, Set<Class<?>>
isMap = true;
Class keyClass = field.getGenericKeyType();
Class valueClass = field.getGenericeValueType();
if (keyClass == null) {
keyClass = String.class;
}
if (valueClass == null) {
valueClass = Object.class;
}
type = type + "<" + ProtobufProxyUtils.processProtobufType(keyClass) + ", ";
type = type + ProtobufProxyUtils.processProtobufType(valueClass) + ">";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,9 @@ public static List<FieldInfo> processDefaultValue(List<Field> fields, boolean ig
if (isList) {
fieldTypeClass = fieldInfo.getGenericKeyType();
}
if (fieldTypeClass == null) {
fieldTypeClass = Object.class;
}

FieldType fieldType = TYPE_MAPPING.get(fieldTypeClass);
if (fieldType == null) {
Expand Down

0 comments on commit 56a4856

Please sign in to comment.