diff --git a/hugo-runtime/src/main/java/hugo/weaving/internal/Hugo.java b/hugo-runtime/src/main/java/hugo/weaving/internal/Hugo.java index 1d57125..8fed6b8 100644 --- a/hugo-runtime/src/main/java/hugo/weaving/internal/Hugo.java +++ b/hugo-runtime/src/main/java/hugo/weaving/internal/Hugo.java @@ -116,8 +116,17 @@ private static void exitMethod(JoinPoint joinPoint, Object result, long lengthMi private static String asTag(Class cls) { if (cls.isAnonymousClass()) { - return asTag(cls.getEnclosingClass()); + final Class enclosingClass = cls.getEnclosingClass(); + if (enclosingClass.isEnum()) { + String splits[] = cls.getName().split("\\$"); + return enumAsTag(enclosingClass, Integer.parseInt(splits[splits.length-1])); + } + return asTag(enclosingClass); } return cls.getSimpleName(); } + + private static String enumAsTag(Class enclosingClass, int enumIdx) { + return ((Enum)enclosingClass.getEnumConstants()[enumIdx]).name(); + } }