mirror of
https://github.com/Eaglercraft-TeaVM-Fork/eagler-teavm.git
synced 2024-12-22 16:14:10 -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 java.util.NoSuchElementException;
|
||||||
import org.teavm.classlib.java.lang.TClass;
|
import org.teavm.classlib.java.lang.TClass;
|
||||||
import org.teavm.platform.Platform;
|
import org.teavm.platform.Platform;
|
||||||
|
import org.teavm.platform.PlatformClass;
|
||||||
|
|
||||||
class TGenericEnumSet<E extends Enum<E>> extends TEnumSet<E> {
|
class TGenericEnumSet<E extends Enum<E>> extends TEnumSet<E> {
|
||||||
Class<E> cls;
|
Class<E> cls;
|
||||||
|
@ -39,7 +40,9 @@ class TGenericEnumSet<E extends Enum<E>> extends TEnumSet<E> {
|
||||||
}
|
}
|
||||||
|
|
||||||
static Enum<?>[] getConstants(Class<?> cls) {
|
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
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue
Block a user