Skip to content

Commit cc0b542

Browse files
authored
chore: use java 23 (#1507)
### Motivation Java 23 will release at September 17, 2024. As we're cuirrently running on the STS version 22 we need to update as soon as possible. ### Modification Update all build scripts and code to use java 23, fix some issues with preview api that has changed. ### Result Java 23 is used for CloudNet instead of java 22.
1 parent 8f9081b commit cc0b542

File tree

19 files changed

+31
-31
lines changed

19 files changed

+31
-31
lines changed

.github/workflows/codeql-analysis.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- name: Setup java
2323
uses: actions/setup-java@v4
2424
with:
25-
java-version: 22
25+
java-version: 23
2626
check-latest: true
2727
distribution: 'zulu'
2828

.github/workflows/gradle-release.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Setup java
1818
uses: actions/setup-java@v4
1919
with:
20-
java-version: 22
20+
java-version: 23
2121
check-latest: true
2222
distribution: 'zulu'
2323

.github/workflows/gradle.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- name: Setup java
2525
uses: actions/setup-java@v4
2626
with:
27-
java-version: 22
27+
java-version: 23
2828
check-latest: true
2929
distribution: 'zulu'
3030

Dockerfile

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
FROM azul/zulu-openjdk:22-jre-headless AS build
1+
FROM azul/zulu-openjdk:23-jre-headless AS build
22

33
COPY . /home/cloudnet-build
44
WORKDIR /home/cloudnet-build
55

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

8-
FROM azul/zulu-openjdk:22-jre-headless
8+
FROM azul/zulu-openjdk:23-jre-headless
99

1010
RUN mkdir -p /cloudnet
1111
WORKDIR /cloudnet

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ just append the `-SNAPSHOT` suffix to the version.
7979

8080
## Compile from source
8181

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

8585
## Warnings

build-extensions/src/main/kotlin/publishing-extensions.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ fun applyDefaultJavadocOptions(options: StandardJavadocDocletOptions) {
120120
options.use()
121121
options.encoding = "UTF-8"
122122
options.memberLevel = JavadocMemberLevel.PRIVATE
123-
options.addStringOption("source", "22")
123+
options.addStringOption("source", "23")
124124
options.addBooleanOption("-enable-preview", true)
125125
options.addBooleanOption("Xdoclint:-missing", true)
126126
options.links(

build.gradle.kts

+2-2
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,8 @@ subprojects {
109109
}
110110

111111
tasks.withType<JavaCompile>().configureEach {
112-
sourceCompatibility = JavaVersion.VERSION_22.toString()
113-
targetCompatibility = JavaVersion.VERSION_22.toString()
112+
sourceCompatibility = JavaVersion.VERSION_23.toString()
113+
targetCompatibility = JavaVersion.VERSION_23.toString()
114114

115115
options.encoding = "UTF-8"
116116
options.isIncremental = true

common/src/test/java/eu/cloudnetservice/common/jvm/JavaVersionTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ public class JavaVersionTest {
2323

2424
@Test
2525
void testRuntimeVersion() {
26-
// we require java 22 to build (atm)
26+
// we require java 23 to build (atm)
2727
var runtimeVersion = JavaVersion.runtimeVersion();
28-
Assertions.assertTrue(JavaVersion.JAVA_22.atOrAbove());
29-
Assertions.assertTrue(runtimeVersion.isNewerOrAt(JavaVersion.JAVA_22));
28+
Assertions.assertTrue(JavaVersion.JAVA_23.atOrAbove());
29+
Assertions.assertTrue(runtimeVersion.isNewerOrAt(JavaVersion.JAVA_23));
3030
}
3131

3232
@Test

driver/src/main/java/eu/cloudnetservice/driver/network/rpc/defaults/generation/BasicRPCMethodGenerator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ public void generate(
112112
} else {
113113
// unbox the primitive value
114114
CodeGenerationUtil.unboxPrimitive(codeBuilder, returnType.descriptorString());
115-
codeBuilder.returnInstruction(returnTypeKind);
115+
codeBuilder.return_(returnTypeKind);
116116
}
117117
} else {
118118
// cast & return the value

driver/src/main/java/eu/cloudnetservice/driver/network/rpc/defaults/generation/ChainedRPCMethodGenerator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ private int storeExtraParameterArray(
156156
if (paramType.isPrimitive()) {
157157
// box primitive type before storing
158158
var typeKind = TypeKind.fromDescriptor(paramType.descriptorString());
159-
codeBuilder.loadInstruction(typeKind, paramSlot);
159+
codeBuilder.loadLocal(typeKind, paramSlot);
160160
CodeGenerationUtil.boxPrimitive(codeBuilder, paramType.descriptorString());
161161
codeBuilder.aastore();
162162
} else {

driver/src/main/java/eu/cloudnetservice/driver/network/rpc/defaults/generation/RPCImplementationGenerator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ static void generateObjectArgumentStore(@NonNull CodeBuilder codeBuilder, @NonNu
9898
codeBuilder
9999
.dup()
100100
.ldc(index)
101-
.loadInstruction(typeKind, parameterSlot);
101+
.loadLocal(typeKind, parameterSlot);
102102
CodeGenerationUtil.boxPrimitive(codeBuilder, descriptor);
103103
codeBuilder.aastore();
104104
} else {

driver/src/main/java/eu/cloudnetservice/driver/network/rpc/defaults/object/data/DataClassCodecGenerator.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ private static void generateSerializeMethod(
272272
.aload(1)
273273
.aload(3)
274274
.checkcast(targetClassDesc)
275-
.invokeInstruction(
275+
.invoke(
276276
invocationOpcode,
277277
targetClassDesc,
278278
getterMethod.getName(),
@@ -360,7 +360,7 @@ private static void generateDeserializeMethod(
360360
// store the variable on the stack
361361
var typeKind = TypeKind.fromDescriptor(fieldType.descriptorString());
362362
var parameterSlot = code.allocateLocal(typeKind);
363-
code.storeInstruction(typeKind, parameterSlot);
363+
code.storeLocal(typeKind, parameterSlot);
364364

365365
// store the information about the parameter
366366
constructorParamTypes[index] = fieldType;
@@ -376,7 +376,7 @@ private static void generateDeserializeMethod(
376376
var type = constructorParamTypes[index];
377377
var storeSlot = parameterTypesStoreSlots[index];
378378
var typeKind = TypeKind.fromDescriptor(type.descriptorString());
379-
code.loadInstruction(typeKind, storeSlot);
379+
code.loadLocal(typeKind, storeSlot);
380380
}
381381

382382
// invoke the constructor and return the constructed value

gradle/libs.versions.toml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
shadow = "8.3.2"
55
juppiter = "0.4.0"
66
spotless = "6.25.0"
7-
fabricLoom = "1.8.6"
7+
fabricLoom = "1.8.8"
88
nexusPublish = "2.0.0"
99
checkstyleTools = "10.18.1"
1010

@@ -78,7 +78,7 @@ luckPermsApi = "5.4"
7878

7979
# fabric platform special dependencies
8080
minecraft = "1.21.1"
81-
fabricLoader = "0.16.5"
81+
fabricLoader = "0.16.6"
8282

8383

8484
[libraries]

launcher/java8/src/main/java/eu/cloudnetservice/launcher/java8/Launcher.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
public final class Launcher {
2020

2121
public static void main(String[] args) throws Exception {
22-
// check if we're at least on java 22
23-
if (detectJavaVersion() == 22) {
22+
// check if we're at least on java 23
23+
if (detectJavaVersion() == 23) {
2424
Class.forName("eu.cloudnetservice.launcher.java22.CloudNetLauncher")
2525
.getConstructor(String[].class)
2626
.newInstance((Object) args);
2727
} else {
2828
// CHECKSTYLE.OFF: Launcher has no proper logger
29-
System.err.println("CloudNet requires exactly Java 22. Download it from https://adoptium.net/");
29+
System.err.println("CloudNet requires exactly Java 23. Download it from https://adoptium.net/");
3030
System.exit(1);
3131
// CHECKSTYLE.ON
3232
}

modules/bridge/src/main/java/eu/cloudnetservice/modules/bridge/platform/fabric/FabricBridgeInitializer.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
name = "CloudNet-Bridge",
3131
version = "@version@",
3232
dependencies = {
33-
@Dependency(name = "fabricloader", version = ">=0.15.0"),
33+
@Dependency(name = "fabricloader", version = ">=0.16.6"),
3434
@Dependency(name = "minecraft", version = "~1.21"),
35-
@Dependency(name = "java", version = ">=22")
35+
@Dependency(name = "java", version = ">=23")
3636
},
3737
authors = "CloudNetService"
3838
)

modules/dockerized-services/src/main/java/eu/cloudnetservice/modules/docker/DockerizedServicesModule.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public void loadConfiguration() {
4949
() -> new DockerConfiguration(
5050
"docker-jvm",
5151
"host",
52-
DockerImage.builder().repository("azul/zulu-openjdk").tag("22-jre-headless").build(),
52+
DockerImage.builder().repository("azul/zulu-openjdk").tag("23-jre-headless").build(),
5353
Set.of(),
5454
Set.of(),
5555
Set.of(),

node/src/main/java/eu/cloudnetservice/node/command/sub/VersionCommand.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public final class VersionCommand {
7272
.column(pair -> pair.first().name())
7373
.column(pair -> pair.second().name())
7474
.column(pair -> pair.second().deprecated())
75-
.column(pair -> pair.second().minJavaVersion().orElse(JavaVersion.JAVA_22).name())
75+
.column(pair -> pair.second().minJavaVersion().orElse(JavaVersion.JAVA_23).name())
7676
.column(pair -> pair.second().maxJavaVersion().map(JavaVersion::name).orElse("No maximum"))
7777
.build();
7878

node/src/main/java/eu/cloudnetservice/node/provider/NodeServiceTaskProvider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ protected void loadServiceTasks() {
241241
task = ServiceTask.builder(task).javaCommand(command).build();
242242
}
243243

244-
// remove all custom java paths that do not support Java 22
244+
// remove all custom java paths that do not support Java 23
245245
var javaVersion = JavaVersionResolver.resolveFromJavaExecutable(task.javaCommand());
246-
if (javaVersion != JavaVersion.JAVA_22) {
246+
if (javaVersion != JavaVersion.JAVA_23) {
247247
task = ServiceTask.builder(task).javaCommand(null).build();
248248
LOGGER.warn(I18n.trans("cloudnet-load-task-unsupported-java-version", taskName));
249249
}

plugins/luckperms/src/main/java/eu/cloudnetservice/plugins/luckperms/FabricLuckPermsPlugin.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@
3030
name = "CloudNet-LuckPerms",
3131
version = "@version@",
3232
dependencies = {
33-
@Dependency(name = "fabricloader", version = ">=0.14.17"),
33+
@Dependency(name = "fabricloader", version = ">=0.16.6"),
3434
@Dependency(name = "minecraft", version = ">=1.20.4"),
35-
@Dependency(name = "java", version = ">=22"),
35+
@Dependency(name = "java", version = ">=23"),
3636
@Dependency(name = "LuckPerms")
3737
},
3838
authors = "CloudNetService",

0 commit comments

Comments
 (0)