From da2206168bfcc7808ae110d441007f38c17ecf39 Mon Sep 17 00:00:00 2001 From: embeddedt <42941056+embeddedt@users.noreply.github.com> Date: Wed, 4 Mar 2026 19:18:01 -0500 Subject: [PATCH] Port AP to Java 17 --- annotation-processor/build.gradle | 2 +- .../annotation/ClientMixinValidator.java | 27 ++++++++----------- build.gradle.kts | 5 ---- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/annotation-processor/build.gradle b/annotation-processor/build.gradle index beb7ea1b..2921bf3d 100644 --- a/annotation-processor/build.gradle +++ b/annotation-processor/build.gradle @@ -30,7 +30,7 @@ dependencies { } tasks.withType(JavaCompile) { - options.release = 21 + options.release = 17 } shadowJar { diff --git a/annotation-processor/src/main/java/org/fury_phoenix/mixinAp/annotation/ClientMixinValidator.java b/annotation-processor/src/main/java/org/fury_phoenix/mixinAp/annotation/ClientMixinValidator.java index 139c6b20..df0fab31 100644 --- a/annotation-processor/src/main/java/org/fury_phoenix/mixinAp/annotation/ClientMixinValidator.java +++ b/annotation-processor/src/main/java/org/fury_phoenix/mixinAp/annotation/ClientMixinValidator.java @@ -90,24 +90,19 @@ public class ClientMixinValidator { } private boolean targetsClient(Object classTarget) { - return switch (classTarget) { - case TypeElement te -> - isClientMarked(te); - case TypeMirror tm -> { - var el = types.asElement(tm); - yield el != null ? targetsClient(el) : warn("TypeMirror of " + tm); - } - // If you're using a dollar sign in class names you are insane - case String s -> { - var te = - elemUtils.getTypeElement(toSourceString(s.split("\\$")[0])); - yield te != null ? targetsClient(te) : warn(s); - } - default -> - throw new IllegalArgumentException("Unhandled type: " + if (classTarget instanceof TypeElement te) { + return isClientMarked(te); + } else if (classTarget instanceof TypeMirror tm) { + var el = types.asElement(tm); + return el != null ? targetsClient(el) : warn("TypeMirror of " + tm); + } else if (classTarget instanceof String s) { + var te = elemUtils.getTypeElement(toSourceString(s.split("\\$")[0])); + return te != null ? targetsClient(te) : warn(s); + } else { + throw new IllegalArgumentException("Unhandled type: " + classTarget.getClass() + "\n" + "Stringified contents: " + classTarget.toString()); - }; + } } private boolean isClientMarked(TypeElement te) { diff --git a/build.gradle.kts b/build.gradle.kts index 29f385ef..25f1716e 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -91,12 +91,7 @@ tasks.named("jar") { )) } -// We must force the Java 21 compiler to be used because our AP requires Java 21 - java { - toolchain { - languageVersion = JavaLanguageVersion.of(21) - } val curSourceCompatLevel = JavaVersion.VERSION_17 sourceCompatibility = curSourceCompatLevel targetCompatibility = curSourceCompatLevel