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