mirror of
https://github.com/konsoletyper/teavm.git
synced 2024-12-03 01:50:07 +08:00
classlib: force class initialization in EnumSet implementation in order to get enum constants array filled
This commit is contained in:
parent
2b671b8088
commit
fcb13b24ad
@ -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<E extends Enum<E>> extends TEnumSet<E> {
|
||||
Class<E> cls;
|
||||
@ -39,7 +40,9 @@ class TGenericEnumSet<E extends Enum<E>> extends TEnumSet<E> {
|
||||
}
|
||||
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user