Skip to content

Commit

Permalink
Define newer Java versions (#124)
Browse files Browse the repository at this point in the history
  • Loading branch information
modmuss50 authored Mar 3, 2024
1 parent 9213536 commit 8bb4cfe
Show file tree
Hide file tree
Showing 3 changed files with 79 additions and 2 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
59 changes: 58 additions & 1 deletion src/main/java/org/spongepowered/asm/mixin/MixinEnvironment.java
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/org/spongepowered/asm/util/JavaVersion.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit 8bb4cfe

Please sign in to comment.