From a22eb43bde76a6022d127c9bbdf95ccd27f45cd1 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Thu, 26 Oct 2017 16:16:27 +0300 Subject: [PATCH] Fix Enum.getDeclaringClass --- classlib/src/main/java/org/teavm/classlib/java/lang/TEnum.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/classlib/src/main/java/org/teavm/classlib/java/lang/TEnum.java b/classlib/src/main/java/org/teavm/classlib/java/lang/TEnum.java index e77639fc9..6cd9a4def 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/lang/TEnum.java +++ b/classlib/src/main/java/org/teavm/classlib/java/lang/TEnum.java @@ -57,7 +57,8 @@ public abstract class TEnum> extends TObject implements TComp @SuppressWarnings("unchecked") public final TClass getDeclaringClass() { - return (TClass) (Object) getClass(); + Class result = (Class) getClass(); + return (TClass) (Object) (result.getSuperclass().equals(Enum.class) ? result : result.getSuperclass()); } @Override