Skip to content

Commit

Permalink
chore: prepare for java 23
Browse files Browse the repository at this point in the history
  • Loading branch information
derklaro committed Sep 15, 2024
1 parent 47f813a commit d541a98
Show file tree
Hide file tree
Showing 18 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Setup java
uses: actions/setup-java@v4
with:
java-version: 22
java-version: 23
check-latest: true
distribution: 'zulu'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- name: Setup java
uses: actions/setup-java@v4
with:
java-version: 22
java-version: 23
check-latest: true
distribution: 'zulu'

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
- name: Setup java
uses: actions/setup-java@v4
with:
java-version: 22
java-version: 23
check-latest: true
distribution: 'zulu'

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
FROM azul/zulu-openjdk:22-jre-headless AS build
FROM azul/zulu-openjdk:23-jre-headless AS build

COPY . /home/cloudnet-build
WORKDIR /home/cloudnet-build

RUN chmod +x gradlew && ./gradlew -x test --no-daemon --stacktrace

FROM azul/zulu-openjdk:22-jre-headless
FROM azul/zulu-openjdk:23-jre-headless

RUN mkdir -p /cloudnet
WORKDIR /cloudnet
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ just append the `-SNAPSHOT` suffix to the version.

## Compile from source

To compile CloudNet you need JDK 22 and an internet connection. Then clone this repository and run `./gradlew` inside
To compile CloudNet you need JDK 23 and an internet connection. Then clone this repository and run `./gradlew` inside
the cloned project.

## Warnings
Expand Down
2 changes: 1 addition & 1 deletion build-extensions/src/main/kotlin/publishing-extensions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ fun applyDefaultJavadocOptions(options: StandardJavadocDocletOptions) {
options.use()
options.encoding = "UTF-8"
options.memberLevel = JavadocMemberLevel.PRIVATE
options.addStringOption("source", "22")
options.addStringOption("source", "23")
options.addBooleanOption("-enable-preview", true)
options.addBooleanOption("Xdoclint:-missing", true)
options.links(
Expand Down
4 changes: 2 additions & 2 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -109,8 +109,8 @@ subprojects {
}

tasks.withType<JavaCompile>().configureEach {
sourceCompatibility = JavaVersion.VERSION_22.toString()
targetCompatibility = JavaVersion.VERSION_22.toString()
sourceCompatibility = JavaVersion.VERSION_23.toString()
targetCompatibility = JavaVersion.VERSION_23.toString()

options.encoding = "UTF-8"
options.isIncremental = true
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ public class JavaVersionTest {

@Test
void testRuntimeVersion() {
// we require java 22 to build (atm)
// we require java 23 to build (atm)
var runtimeVersion = JavaVersion.runtimeVersion();
Assertions.assertTrue(JavaVersion.JAVA_22.atOrAbove());
Assertions.assertTrue(runtimeVersion.isNewerOrAt(JavaVersion.JAVA_22));
Assertions.assertTrue(JavaVersion.JAVA_23.atOrAbove());
Assertions.assertTrue(runtimeVersion.isNewerOrAt(JavaVersion.JAVA_23));
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public void generate(
} else {
// unbox the primitive value
CodeGenerationUtil.unboxPrimitive(codeBuilder, returnType.descriptorString());
codeBuilder.returnInstruction(returnTypeKind);
codeBuilder.return_(returnTypeKind);
}
} else {
// cast & return the value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ private int storeExtraParameterArray(
if (paramType.isPrimitive()) {
// box primitive type before storing
var typeKind = TypeKind.fromDescriptor(paramType.descriptorString());
codeBuilder.loadInstruction(typeKind, paramSlot);
codeBuilder.loadLocal(typeKind, paramSlot);
CodeGenerationUtil.boxPrimitive(codeBuilder, paramType.descriptorString());
codeBuilder.aastore();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ static void generateObjectArgumentStore(@NonNull CodeBuilder codeBuilder, @NonNu
codeBuilder
.dup()
.ldc(index)
.loadInstruction(typeKind, parameterSlot);
.loadLocal(typeKind, parameterSlot);
CodeGenerationUtil.boxPrimitive(codeBuilder, descriptor);
codeBuilder.aastore();
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ private static void generateSerializeMethod(
.aload(1)
.aload(3)
.checkcast(targetClassDesc)
.invokeInstruction(
.invoke(
invocationOpcode,
targetClassDesc,
getterMethod.getName(),
Expand Down Expand Up @@ -360,7 +360,7 @@ private static void generateDeserializeMethod(
// store the variable on the stack
var typeKind = TypeKind.fromDescriptor(fieldType.descriptorString());
var parameterSlot = code.allocateLocal(typeKind);
code.storeInstruction(typeKind, parameterSlot);
code.storeLocal(typeKind, parameterSlot);

// store the information about the parameter
constructorParamTypes[index] = fieldType;
Expand All @@ -376,7 +376,7 @@ private static void generateDeserializeMethod(
var type = constructorParamTypes[index];
var storeSlot = parameterTypesStoreSlots[index];
var typeKind = TypeKind.fromDescriptor(type.descriptorString());
code.loadInstruction(typeKind, storeSlot);
code.loadLocal(typeKind, storeSlot);
}

// invoke the constructor and return the constructed value
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
public final class Launcher {

public static void main(String[] args) throws Exception {
// check if we're at least on java 22
if (detectJavaVersion() == 22) {
// check if we're at least on java 23
if (detectJavaVersion() == 23) {
Class.forName("eu.cloudnetservice.launcher.java22.CloudNetLauncher")
.getConstructor(String[].class)
.newInstance((Object) args);
} else {
// CHECKSTYLE.OFF: Launcher has no proper logger
System.err.println("CloudNet requires exactly Java 22. Download it from https://adoptium.net/");
System.err.println("CloudNet requires exactly Java 23. Download it from https://adoptium.net/");
System.exit(1);
// CHECKSTYLE.ON
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
dependencies = {
@Dependency(name = "fabricloader", version = ">=0.15.0"),
@Dependency(name = "minecraft", version = "~1.21"),
@Dependency(name = "java", version = ">=22")
@Dependency(name = "java", version = ">=23")
},
authors = "CloudNetService"
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void loadConfiguration() {
() -> new DockerConfiguration(
"docker-jvm",
"host",
DockerImage.builder().repository("azul/zulu-openjdk").tag("22-jre-headless").build(),
DockerImage.builder().repository("azul/zulu-openjdk").tag("23-jre-headless").build(),
Set.of(),
Set.of(),
Set.of(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public final class VersionCommand {
.column(pair -> pair.first().name())
.column(pair -> pair.second().name())
.column(pair -> pair.second().deprecated())
.column(pair -> pair.second().minJavaVersion().orElse(JavaVersion.JAVA_22).name())
.column(pair -> pair.second().minJavaVersion().orElse(JavaVersion.JAVA_23).name())
.column(pair -> pair.second().maxJavaVersion().map(JavaVersion::name).orElse("No maximum"))
.build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,9 +241,9 @@ protected void loadServiceTasks() {
task = ServiceTask.builder(task).javaCommand(command).build();
}

// remove all custom java paths that do not support Java 22
// remove all custom java paths that do not support Java 23
var javaVersion = JavaVersionResolver.resolveFromJavaExecutable(task.javaCommand());
if (javaVersion != JavaVersion.JAVA_22) {
if (javaVersion != JavaVersion.JAVA_23) {
task = ServiceTask.builder(task).javaCommand(null).build();
LOGGER.warn(I18n.trans("cloudnet-load-task-unsupported-java-version", taskName));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
dependencies = {
@Dependency(name = "fabricloader", version = ">=0.14.17"),
@Dependency(name = "minecraft", version = ">=1.20.4"),
@Dependency(name = "java", version = ">=22"),
@Dependency(name = "java", version = ">=23"),
@Dependency(name = "LuckPerms")
},
authors = "CloudNetService",
Expand Down

0 comments on commit d541a98

Please sign in to comment.