Port AP to Java 17

This commit is contained in:
embeddedt 2026-03-04 19:18:01 -05:00
parent 17f930ea6f
commit da2206168b
No known key found for this signature in database
GPG Key ID: A69433EC199B5613
3 changed files with 12 additions and 22 deletions

View File

@ -30,7 +30,7 @@ dependencies {
} }
tasks.withType(JavaCompile) { tasks.withType(JavaCompile) {
options.release = 21 options.release = 17
} }
shadowJar { shadowJar {

View File

@ -90,24 +90,19 @@ public class ClientMixinValidator {
} }
private boolean targetsClient(Object classTarget) { private boolean targetsClient(Object classTarget) {
return switch (classTarget) { if (classTarget instanceof TypeElement te) {
case TypeElement te -> return isClientMarked(te);
isClientMarked(te); } else if (classTarget instanceof TypeMirror tm) {
case TypeMirror tm -> {
var el = types.asElement(tm); var el = types.asElement(tm);
yield el != null ? targetsClient(el) : warn("TypeMirror of " + tm); return el != null ? targetsClient(el) : warn("TypeMirror of " + tm);
} } else if (classTarget instanceof String s) {
// If you're using a dollar sign in class names you are insane var te = elemUtils.getTypeElement(toSourceString(s.split("\\$")[0]));
case String s -> { return te != null ? targetsClient(te) : warn(s);
var te = } else {
elemUtils.getTypeElement(toSourceString(s.split("\\$")[0]));
yield te != null ? targetsClient(te) : warn(s);
}
default ->
throw new IllegalArgumentException("Unhandled type: " throw new IllegalArgumentException("Unhandled type: "
+ classTarget.getClass() + "\n" + "Stringified contents: " + classTarget.getClass() + "\n" + "Stringified contents: "
+ classTarget.toString()); + classTarget.toString());
}; }
} }
private boolean isClientMarked(TypeElement te) { private boolean isClientMarked(TypeElement te) {

View File

@ -91,12 +91,7 @@ tasks.named<Jar>("jar") {
)) ))
} }
// We must force the Java 21 compiler to be used because our AP requires Java 21
java { java {
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
val curSourceCompatLevel = JavaVersion.VERSION_17 val curSourceCompatLevel = JavaVersion.VERSION_17
sourceCompatibility = curSourceCompatLevel sourceCompatibility = curSourceCompatLevel
targetCompatibility = curSourceCompatLevel targetCompatibility = curSourceCompatLevel