diff --git a/gradle.properties b/gradle.properties index dbfa355f4..210d5c3d6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -7,7 +7,7 @@ organization=FabricMC buildVersion=0.12.5 upstreamMixinVersion=0.8.5 buildType=RELEASE -asmVersion=9.2 +asmVersion=9.6 legacyForgeAsmVersion=5.0.3 modlauncherAsmVersion=9.1 modlauncherVersion=9.0.7 diff --git a/src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java b/src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java index 0eb13c9c5..8aabef67f 100644 --- a/src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java +++ b/src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java @@ -753,7 +753,64 @@ boolean isSupported() { return JavaVersion.current() >= JavaVersion.JAVA_18 && ASM.isAtLeastVersion(9, 2); } - }; + }, + + /** + * Java 19 or above is required + */ + JAVA_19(19, Opcodes.V19, LanguageFeatures.METHODS_IN_INTERFACES | LanguageFeatures.PRIVATE_SYNTHETIC_METHODS_IN_INTERFACES + | LanguageFeatures.PRIVATE_METHODS_IN_INTERFACES | LanguageFeatures.NESTING | LanguageFeatures.DYNAMIC_CONSTANTS + | LanguageFeatures.RECORDS | LanguageFeatures.SEALED_CLASSES) { + + @Override + boolean isSupported() { + return JavaVersion.current() >= JavaVersion.JAVA_19 && ASM.isAtLeastVersion(9, 3); + } + + }, + + /** + * Java 20 or above is required + */ + JAVA_20(20, Opcodes.V20, LanguageFeatures.METHODS_IN_INTERFACES | LanguageFeatures.PRIVATE_SYNTHETIC_METHODS_IN_INTERFACES + | LanguageFeatures.PRIVATE_METHODS_IN_INTERFACES | LanguageFeatures.NESTING | LanguageFeatures.DYNAMIC_CONSTANTS + | LanguageFeatures.RECORDS | LanguageFeatures.SEALED_CLASSES) { + + @Override + boolean isSupported() { + return JavaVersion.current() >= JavaVersion.JAVA_20 && ASM.isAtLeastVersion(9, 4); + } + + }, + + /** + * Java 20 or above is required + */ + JAVA_21(21, Opcodes.V21, LanguageFeatures.METHODS_IN_INTERFACES | LanguageFeatures.PRIVATE_SYNTHETIC_METHODS_IN_INTERFACES + | LanguageFeatures.PRIVATE_METHODS_IN_INTERFACES | LanguageFeatures.NESTING | LanguageFeatures.DYNAMIC_CONSTANTS + | LanguageFeatures.RECORDS | LanguageFeatures.SEALED_CLASSES) { + + @Override + boolean isSupported() { + return JavaVersion.current() >= JavaVersion.JAVA_21 && ASM.isAtLeastVersion(9, 5); + } + + }, + + /** + * Java 22 or above is required + */ + JAVA_22(22, Opcodes.V22, LanguageFeatures.METHODS_IN_INTERFACES | LanguageFeatures.PRIVATE_SYNTHETIC_METHODS_IN_INTERFACES + | LanguageFeatures.PRIVATE_METHODS_IN_INTERFACES | LanguageFeatures.NESTING | LanguageFeatures.DYNAMIC_CONSTANTS + | LanguageFeatures.RECORDS | LanguageFeatures.SEALED_CLASSES) { + + @Override + boolean isSupported() { + return JavaVersion.current() >= JavaVersion.JAVA_22 && ASM.isAtLeastVersion(9, 6); + } + + }, + ; /** * Default compatibility level to use if not specified by the service diff --git a/src/main/java/org/spongepowered/asm/util/JavaVersion.java b/src/main/java/org/spongepowered/asm/util/JavaVersion.java index 1197d121d..c95c93302 100644 --- a/src/main/java/org/spongepowered/asm/util/JavaVersion.java +++ b/src/main/java/org/spongepowered/asm/util/JavaVersion.java @@ -96,6 +96,26 @@ public abstract class JavaVersion { * Version number for Java 18 */ public static final double JAVA_18 = 18.0; + + /** + * Version number for Java 19 + */ + public static final double JAVA_19 = 19.0; + + /** + * Version number for Java 20 + */ + public static final double JAVA_20 = 20.0; + + /** + * Version number for Java 21 + */ + public static final double JAVA_21 = 21.0; + + /** + * Version number for Java 22 + */ + public static final double JAVA_22 = 22.0; private static double current = 0.0;