Fix Enum.getDeclaringClass

This commit is contained in:
Alexey Andreev 2017-10-26 16:16:27 +03:00
parent f61567dfde
commit a22eb43bde

View File

@ -57,7 +57,8 @@ public abstract class TEnum<E extends TEnum<E>> extends TObject implements TComp
@SuppressWarnings("unchecked")
public final TClass<E> getDeclaringClass() {
return (TClass<E>) (Object) getClass();
Class<E> result = (Class<E>) getClass();
return (TClass<E>) (Object) (result.getSuperclass().equals(Enum.class) ? result : result.getSuperclass());
}
@Override