Package org.spongepowered.asm.mixin
Enum MixinEnvironment.CompatibilityLevel
- java.lang.Object
-
- java.lang.Enum<MixinEnvironment.CompatibilityLevel>
-
- org.spongepowered.asm.mixin.MixinEnvironment.CompatibilityLevel
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<MixinEnvironment.CompatibilityLevel>
- Enclosing class:
- MixinEnvironment
public static enum MixinEnvironment.CompatibilityLevel extends java.lang.Enum<MixinEnvironment.CompatibilityLevel>
Operational compatibility level for the mixin subsystem
-
-
Enum Constant Summary
Enum Constants Enum Constant Description JAVA_10Java 10 or above is requiredJAVA_11Java 11 or above is requiredJAVA_12Java 12 or above is requiredJAVA_13Java 13 or above is requiredJAVA_14Java 14 or above is required.JAVA_15Java 15 or above is required.JAVA_16Java 16 or above is requiredJAVA_17Java 17 or above is requiredJAVA_18Java 18 or above is requiredJAVA_19Java 19 or above is requiredJAVA_20Java 20 or above is requiredJAVA_21Java 21 or above is requiredJAVA_22Java 22 or above is requiredJAVA_23Java 23 or above is requiredJAVA_24Java 23 or above is requiredJAVA_25Java 25 or above is requiredJAVA_6Java 6 (1.6) or above is requiredJAVA_7Java 7 (1.7) or above is requiredJAVA_8Java 8 (1.8) or above is requiredJAVA_9Java 9 or above is required
-
Field Summary
Fields Modifier and Type Field Description static MixinEnvironment.CompatibilityLevelDEFAULTDefault compatibility level to use if not specified by the servicestatic MixinEnvironment.CompatibilityLevelMAX_SUPPORTEDMaximum compatibility level actually supported.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description booleancanElevateTo(MixinEnvironment.CompatibilityLevel level)Get whether this level can be elevated to the specified levelbooleancanSupport(MixinEnvironment.CompatibilityLevel level)True if this level can support the specified levelintclassVersion()Deprecated.Use getClassVersionstatic MixinEnvironment.CompatibilityLevelforClassVersion(int version)intgetClassMajorVersion()Get the major class version expected at this compatibility levelintgetClassVersion()Class version expected at this compatibility levelintgetLanguageFeatures()Get all supported language featuresstatic MixinEnvironment.CompatibilityLevelgetMaxEffective()Return the maximum compatibility level which is actually effective in the current runtime, taking into account the current JRE and ASM versionsbooleanisAtLeast(MixinEnvironment.CompatibilityLevel level)Get whether this level is the same or greater than the specified levelbooleanisLessThan(MixinEnvironment.CompatibilityLevel level)Get whether this level is less than the specified levelstatic MixinEnvironment.CompatibilityLevelrequiredFor(int languageFeatures)Return the minimum language level required to support the specified language feature(s).booleansupports(int languageFeatures)Get whether the specifiedLanguageFeaturesis supported by this runtime.booleansupportsMethodsInInterfaces()Deprecated.Usesupports(int)insteadstatic MixinEnvironment.CompatibilityLevelvalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static MixinEnvironment.CompatibilityLevel[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
JAVA_6
public static final MixinEnvironment.CompatibilityLevel JAVA_6
Java 6 (1.6) or above is required
-
JAVA_7
public static final MixinEnvironment.CompatibilityLevel JAVA_7
Java 7 (1.7) or above is required
-
JAVA_8
public static final MixinEnvironment.CompatibilityLevel JAVA_8
Java 8 (1.8) or above is required
-
JAVA_9
public static final MixinEnvironment.CompatibilityLevel JAVA_9
Java 9 or above is required
-
JAVA_10
public static final MixinEnvironment.CompatibilityLevel JAVA_10
Java 10 or above is required
-
JAVA_11
public static final MixinEnvironment.CompatibilityLevel JAVA_11
Java 11 or above is required
-
JAVA_12
public static final MixinEnvironment.CompatibilityLevel JAVA_12
Java 12 or above is required
-
JAVA_13
public static final MixinEnvironment.CompatibilityLevel JAVA_13
Java 13 or above is required
-
JAVA_14
public static final MixinEnvironment.CompatibilityLevel JAVA_14
Java 14 or above is required. Records are a preview feature in this release.
-
JAVA_15
public static final MixinEnvironment.CompatibilityLevel JAVA_15
Java 15 or above is required. Records and sealed classes are preview features in this release.
-
JAVA_16
public static final MixinEnvironment.CompatibilityLevel JAVA_16
Java 16 or above is required
-
JAVA_17
public static final MixinEnvironment.CompatibilityLevel JAVA_17
Java 17 or above is required
-
JAVA_18
public static final MixinEnvironment.CompatibilityLevel JAVA_18
Java 18 or above is required
-
JAVA_19
public static final MixinEnvironment.CompatibilityLevel JAVA_19
Java 19 or above is required
-
JAVA_20
public static final MixinEnvironment.CompatibilityLevel JAVA_20
Java 20 or above is required
-
JAVA_21
public static final MixinEnvironment.CompatibilityLevel JAVA_21
Java 21 or above is required
-
JAVA_22
public static final MixinEnvironment.CompatibilityLevel JAVA_22
Java 22 or above is required
-
JAVA_23
public static final MixinEnvironment.CompatibilityLevel JAVA_23
Java 23 or above is required
-
JAVA_24
public static final MixinEnvironment.CompatibilityLevel JAVA_24
Java 23 or above is required
-
JAVA_25
public static final MixinEnvironment.CompatibilityLevel JAVA_25
Java 25 or above is required
-
-
Field Detail
-
DEFAULT
public static MixinEnvironment.CompatibilityLevel DEFAULT
Default compatibility level to use if not specified by the service
-
MAX_SUPPORTED
public static MixinEnvironment.CompatibilityLevel MAX_SUPPORTED
Maximum compatibility level actually supported. Other compatibility levels might exist but we don't actually have any internal code in place which supports those features. This is mainly used to indicate that mixin classes compiled with newer JDKs might have bytecode-level class features that this version of mixin doesn't understand, even when the current ASM or JRE do.This is particularly important for the case where a config declares a higher version (eg. JAVA_14) which has been added to the enum but no code actually exists within Mixin as a library to handle language features from that version. In other words adding values to this enum doesn't magically add support for language features, and this field should point to the highest known supported version regardless of other known versions.
This comment mainly added to avoid stuff in the future like PR #500 which demonstrates that the nature of compatibility levels in mixin are not understood that well.
-
-
Method Detail
-
values
public static MixinEnvironment.CompatibilityLevel[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (MixinEnvironment.CompatibilityLevel c : MixinEnvironment.CompatibilityLevel.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static MixinEnvironment.CompatibilityLevel valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
classVersion
@Deprecated public int classVersion()
Deprecated.Use getClassVersionClass version expected at this compatibility level
-
getClassVersion
public int getClassVersion()
Class version expected at this compatibility level
-
getClassMajorVersion
public int getClassMajorVersion()
Get the major class version expected at this compatibility level
-
getLanguageFeatures
public int getLanguageFeatures()
Get all supported language features
-
supportsMethodsInInterfaces
@Deprecated public boolean supportsMethodsInInterfaces()
Deprecated.Usesupports(int)insteadGet whether this environment supports non-abstract methods in interfaces, true in Java 1.8 and above
-
supports
public boolean supports(int languageFeatures)
Get whether the specifiedLanguageFeaturesis supported by this runtime.- Parameters:
languageFeatures- language feature (or features) to check- Returns:
- true if all specified language features are supported
-
isAtLeast
public boolean isAtLeast(MixinEnvironment.CompatibilityLevel level)
Get whether this level is the same or greater than the specified level- Parameters:
level- level to compare to- Returns:
- true if this level is equal or higher the supplied level
-
isLessThan
public boolean isLessThan(MixinEnvironment.CompatibilityLevel level)
Get whether this level is less than the specified level- Parameters:
level- level to compare to- Returns:
- true if this level is less than the supplied level
-
canElevateTo
public boolean canElevateTo(MixinEnvironment.CompatibilityLevel level)
Get whether this level can be elevated to the specified level- Parameters:
level- desired level- Returns:
- true if this level supports elevation
-
canSupport
public boolean canSupport(MixinEnvironment.CompatibilityLevel level)
True if this level can support the specified level- Parameters:
level- desired level- Returns:
- true if the other level can be elevated to this level
-
requiredFor
public static MixinEnvironment.CompatibilityLevel requiredFor(int languageFeatures)
Return the minimum language level required to support the specified language feature(s). Returns null if no compatibility level available can support the requested language features.- Parameters:
languageFeatures- Language feature(s) to check for- Returns:
- Lowest compatibility level which supports the requested language feature, or null if no levels support the requested feature
-
getMaxEffective
public static MixinEnvironment.CompatibilityLevel getMaxEffective()
Return the maximum compatibility level which is actually effective in the current runtime, taking into account the current JRE and ASM versions
-
forClassVersion
public static MixinEnvironment.CompatibilityLevel forClassVersion(int version)
-
-