修改多个@RetLabel不能正确根据locale获取对应值的bug
This commit is contained in:
@@ -49,8 +49,8 @@ public @interface RetLabel {
|
|||||||
for (Field field : clazz.getFields()) {
|
for (Field field : clazz.getFields()) {
|
||||||
if (!Modifier.isStatic(field.getModifiers())) continue;
|
if (!Modifier.isStatic(field.getModifiers())) continue;
|
||||||
if (field.getType() != int.class) continue;
|
if (field.getType() != int.class) continue;
|
||||||
RetLabel info = field.getAnnotation(RetLabel.class);
|
RetLabel[] infos = field.getAnnotationsByType(RetLabel.class);
|
||||||
if (info == null) continue;
|
if (infos == null || infos.length == 0) continue;
|
||||||
int value;
|
int value;
|
||||||
try {
|
try {
|
||||||
value = field.getInt(null);
|
value = field.getInt(null);
|
||||||
@@ -58,8 +58,10 @@ public @interface RetLabel {
|
|||||||
ex.printStackTrace();
|
ex.printStackTrace();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
for (RetLabel info : infos) {
|
||||||
rets.computeIfAbsent(info.locale(), (k) -> new HashMap<>()).put(value, info.value());
|
rets.computeIfAbsent(info.locale(), (k) -> new HashMap<>()).put(value, info.value());
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return rets;
|
return rets;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user