SharedConstants still making issues.

This commit is contained in:
Speiger 2021-06-22 19:40:48 +02:00
parent fd32f404c0
commit 500514fb20
2 changed files with 8 additions and 1 deletions

View File

@ -256,6 +256,7 @@ public class GlobalVariables
{
flags.add("TYPE_"+type.getCapType());
flags.add("VALUE_"+valueType.getCapType());
// flags.add("UNSAVE_ENUM"); //if we want to use shared constants... Not compile save
if(type == valueType) flags.add("SAME_TYPE");
if(type.hasFunction(valueType)) flags.add("JDK_FUNCTION");
if(!type.needsCustomJDKType()) flags.add("JDK_TYPE");

View File

@ -16,7 +16,9 @@ import speiger.src.collections.objects.maps.abstracts.ABSTRACT_MAP;
import speiger.src.collections.objects.maps.interfaces.MAP;
import speiger.src.collections.objects.sets.AbstractObjectSet;
import speiger.src.collections.objects.sets.ObjectSet;
#if UNSAVE_ENUM
import sun.misc.SharedSecrets;
#endif
/**
* A Type Specific EnumMap implementation that allows for Primitive Values.
@ -211,8 +213,12 @@ public class ENUM_MAP KEY_ENUM_VALUE_GENERIC_TYPE extends ABSTRACT_MAP KEY_VALUE
onNodeRemoved(index);
}
protected boolean isSet(int index) { return (present[index >> 6] & (1L << index)) != 0; }
private static <K extends Enum<K>> K[] getKeyUniverse(Class<K> keyType) {
private static <K extends Enum<K>> K[] getKeyUniverse(Class<K> keyType) {
#if UNSAVE_ENUM
return keyType.getEnumConstants();
#else
return SharedSecrets.getJavaLangAccess().getEnumConstantsShared(keyType);
#endif
}
class EntrySet extends AbstractObjectSet<MAP.Entry KEY_VALUE_GENERIC_TYPE> {