修改多个@RetLabel不能正确根据locale获取对应值的bug

This commit is contained in:
Redkale
2019-07-17 15:14:48 +08:00
parent 27a587d31f
commit ad87b2115d

View File

@@ -49,8 +49,8 @@ public @interface RetLabel {
for (Field field : clazz.getFields()) {
if (!Modifier.isStatic(field.getModifiers())) continue;
if (field.getType() != int.class) continue;
RetLabel info = field.getAnnotation(RetLabel.class);
if (info == null) continue;
RetLabel[] infos = field.getAnnotationsByType(RetLabel.class);
if (infos == null || infos.length == 0) continue;
int value;
try {
value = field.getInt(null);
@@ -58,7 +58,9 @@ public @interface RetLabel {
ex.printStackTrace();
continue;
}
rets.computeIfAbsent(info.locale(), (k) -> new HashMap<>()).put(value, info.value());
for (RetLabel info : infos) {
rets.computeIfAbsent(info.locale(), (k) -> new HashMap<>()).put(value, info.value());
}
}
return rets;
}