From ad87b2115d20b8098656c73c80af66ca12124b82 Mon Sep 17 00:00:00 2001 From: Redkale <8730487+redkale@users.noreply.github.com> Date: Wed, 17 Jul 2019 15:14:48 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=A4=9A=E4=B8=AA@RetLabel?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E6=AD=A3=E7=A1=AE=E6=A0=B9=E6=8D=AElocale?= =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=AF=B9=E5=BA=94=E5=80=BC=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/org/redkale/service/RetLabel.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/org/redkale/service/RetLabel.java b/src/org/redkale/service/RetLabel.java index eeb94939f..094d6540e 100644 --- a/src/org/redkale/service/RetLabel.java +++ b/src/org/redkale/service/RetLabel.java @@ -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; }