Skip to content

Commit da22061

Browse files
committed
Port AP to Java 17
1 parent 17f930e commit da22061

3 files changed

Lines changed: 12 additions & 22 deletions

File tree

annotation-processor/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ dependencies {
3030
}
3131

3232
tasks.withType(JavaCompile) {
33-
options.release = 21
33+
options.release = 17
3434
}
3535

3636
shadowJar {

annotation-processor/src/main/java/org/fury_phoenix/mixinAp/annotation/ClientMixinValidator.java

Lines changed: 11 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -90,24 +90,19 @@ private boolean targetsClient(Collection<?> classTargets) {
9090
}
9191

9292
private boolean targetsClient(Object classTarget) {
93-
return switch (classTarget) {
94-
case TypeElement te ->
95-
isClientMarked(te);
96-
case TypeMirror tm -> {
97-
var el = types.asElement(tm);
98-
yield el != null ? targetsClient(el) : warn("TypeMirror of " + tm);
99-
}
100-
// If you're using a dollar sign in class names you are insane
101-
case String s -> {
102-
var te =
103-
elemUtils.getTypeElement(toSourceString(s.split("\\$")[0]));
104-
yield te != null ? targetsClient(te) : warn(s);
105-
}
106-
default ->
107-
throw new IllegalArgumentException("Unhandled type: "
93+
if (classTarget instanceof TypeElement te) {
94+
return isClientMarked(te);
95+
} else if (classTarget instanceof TypeMirror tm) {
96+
var el = types.asElement(tm);
97+
return el != null ? targetsClient(el) : warn("TypeMirror of " + tm);
98+
} else if (classTarget instanceof String s) {
99+
var te = elemUtils.getTypeElement(toSourceString(s.split("\\$")[0]));
100+
return te != null ? targetsClient(te) : warn(s);
101+
} else {
102+
throw new IllegalArgumentException("Unhandled type: "
108103
+ classTarget.getClass() + "\n" + "Stringified contents: "
109104
+ classTarget.toString());
110-
};
105+
}
111106
}
112107

113108
private boolean isClientMarked(TypeElement te) {

build.gradle.kts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -91,12 +91,7 @@ tasks.named<Jar>("jar") {
9191
))
9292
}
9393

94-
// We must force the Java 21 compiler to be used because our AP requires Java 21
95-
9694
java {
97-
toolchain {
98-
languageVersion = JavaLanguageVersion.of(21)
99-
}
10095
val curSourceCompatLevel = JavaVersion.VERSION_17
10196
sourceCompatibility = curSourceCompatLevel
10297
targetCompatibility = curSourceCompatLevel

0 commit comments

Comments
 (0)