Enum Class MixinEnvironment.CompatibilityLevel

java.lang.Object
java.lang.Enum<MixinEnvironment.CompatibilityLevel>
org.spongepowered.asm.mixin.MixinEnvironment.CompatibilityLevel
All Implemented Interfaces:
Serializable, Comparable<MixinEnvironment.CompatibilityLevel>, Constable
Enclosing class:
MixinEnvironment

public static enum MixinEnvironment.CompatibilityLevel extends Enum<MixinEnvironment.CompatibilityLevel>
Operational compatibility level for the mixin subsystem
  • Enum Constant Details

  • Field Details

    • 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 Details

    • values

      public static MixinEnvironment.CompatibilityLevel[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static MixinEnvironment.CompatibilityLevel valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (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:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • classVersion

      @Deprecated public int classVersion()
      Deprecated.
      Use getClassVersion
      Class 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.
      Use supports(int) instead
      Get 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 specified LanguageFeatures is 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)