From fcb13b24ad053fcfb7671986d73e031e93f1f812 Mon Sep 17 00:00:00 2001 From: Alexey Andreev Date: Tue, 13 Sep 2022 16:03:37 +0200 Subject: [PATCH] classlib: force class initialization in EnumSet implementation in order to get enum constants array filled --- .../java/org/teavm/classlib/java/util/TGenericEnumSet.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/classlib/src/main/java/org/teavm/classlib/java/util/TGenericEnumSet.java b/classlib/src/main/java/org/teavm/classlib/java/util/TGenericEnumSet.java index 0dbdee5a8..fb587162e 100644 --- a/classlib/src/main/java/org/teavm/classlib/java/util/TGenericEnumSet.java +++ b/classlib/src/main/java/org/teavm/classlib/java/util/TGenericEnumSet.java @@ -21,6 +21,7 @@ import java.util.Iterator; import java.util.NoSuchElementException; import org.teavm.classlib.java.lang.TClass; import org.teavm.platform.Platform; +import org.teavm.platform.PlatformClass; class TGenericEnumSet> extends TEnumSet { Class cls; @@ -39,7 +40,9 @@ class TGenericEnumSet> extends TEnumSet { } static Enum[] getConstants(Class cls) { - return Platform.getEnumConstants(((TClass) (Object) cls).getPlatformClass()); + PlatformClass platformClass = ((TClass) (Object) cls).getPlatformClass(); + Platform.initClass(platformClass); + return Platform.getEnumConstants(platformClass); } @Override