Port AP to Java 17
This commit is contained in:
parent
17f930ea6f
commit
da2206168b
|
|
@ -30,7 +30,7 @@ dependencies {
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.withType(JavaCompile) {
|
tasks.withType(JavaCompile) {
|
||||||
options.release = 21
|
options.release = 17
|
||||||
}
|
}
|
||||||
|
|
||||||
shadowJar {
|
shadowJar {
|
||||||
|
|
|
||||||
|
|
@ -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);
|
return el != null ? targetsClient(el) : warn("TypeMirror of " + tm);
|
||||||
yield el != null ? targetsClient(el) : warn("TypeMirror of " + tm);
|
} else if (classTarget instanceof String s) {
|
||||||
}
|
var te = elemUtils.getTypeElement(toSourceString(s.split("\\$")[0]));
|
||||||
// If you're using a dollar sign in class names you are insane
|
return te != null ? targetsClient(te) : warn(s);
|
||||||
case String s -> {
|
} else {
|
||||||
var te =
|
throw new IllegalArgumentException("Unhandled type: "
|
||||||
elemUtils.getTypeElement(toSourceString(s.split("\\$")[0]));
|
|
||||||
yield te != null ? targetsClient(te) : warn(s);
|
|
||||||
}
|
|
||||||
default ->
|
|
||||||
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) {
|
||||||
|
|
|
||||||
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user