diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b3d52f0..456d31b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,6 +1,6 @@ name: SmallRye Build env: - MAVEN_VERSION: 3.8.3 + MAVEN_VERSION: 3.9.9 IO_TAKARI_MAVEN_WRAPPER_VERSION: 0.7.7 on: @@ -42,13 +42,14 @@ jobs: java-version: | 17 21 + 23 cache: 'maven' cache-dependency-path: '**/pom.xml' - name: build with maven run: | mvn -q -N "io.takari:maven:${{env.IO_TAKARI_MAVEN_WRAPPER_VERSION}}:wrapper" "-Dmaven=${{env.MAVEN_VERSION}}" - ./mvnw -B -ntp formatter:validate verify javadoc:javadoc --file pom.xml "-Dexpected-cpu=x64,aarch64" "-Djava17.home=${{env.JAVA_HOME_17_X64}}${{env.JAVA_HOME_17_ARM64}}" + ./mvnw -B -ntp formatter:validate verify javadoc:javadoc --file pom.xml "-Dexpected-cpu=x64,aarch64" "-Djava17.home=${{env.JAVA_HOME_17_X64}}${{env.JAVA_HOME_17_ARM64}}" "-Djava21.home=${{env.JAVA_HOME_21_X64}}${{env.JAVA_HOME_21_ARM64}}" quality: needs: [ build ] @@ -62,7 +63,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: temurin - java-version: 17 + java-version: 21 cache: 'maven' cache-dependency-path: '**/pom.xml' @@ -74,7 +75,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 17 + java-version: 21 - name: sonar run: ./mvnw -B -ntp sonar:sonar -Dsonar.projectKey=smallrye_smallrye-common -Dsonar.token=${{secrets.SONAR_TOKEN}} diff --git a/cpu/build-test-java21 b/cpu/build-test-java21 new file mode 100644 index 0000000..e69de29 diff --git a/cpu/pom.xml b/cpu/pom.xml index 00d9ea3..6c667fe 100644 --- a/cpu/pom.xml +++ b/cpu/pom.xml @@ -34,6 +34,19 @@ + + net.revelc.code + impsort-maven-plugin + + + sort-imports-java22 + + sort + + none + + + diff --git a/cpu/src/main/java/io/smallrye/common/cpu/CPU.java b/cpu/src/main/java/io/smallrye/common/cpu/CPU.java index 1fca2f1..8ccbd73 100644 --- a/cpu/src/main/java/io/smallrye/common/cpu/CPU.java +++ b/cpu/src/main/java/io/smallrye/common/cpu/CPU.java @@ -10,8 +10,6 @@ import java.util.stream.Collectors; import java.util.stream.Stream; -import sun.misc.Unsafe; - /** * Enumerated type for CPU types. */ @@ -185,8 +183,7 @@ public static CPU host() { private static CPU check(CPU cpu) { ByteOrder no = ByteOrder.nativeOrder(); - // todo: in 22+, bytes = (int) ValueLayout.ADDRESS.byteSize(); - int bytes = Unsafe.ADDRESS_SIZE; + int bytes = JDK22Specific.ADDRESS_SIZE; if (cpu.pointerSizeBytes() == bytes && cpu.nativeByteOrder() == no) { // OK return cpu; diff --git a/cpu/src/main/java/io/smallrye/common/cpu/JDK22Specific.java b/cpu/src/main/java/io/smallrye/common/cpu/JDK22Specific.java new file mode 100644 index 0000000..30a41ce --- /dev/null +++ b/cpu/src/main/java/io/smallrye/common/cpu/JDK22Specific.java @@ -0,0 +1,7 @@ +package io.smallrye.common.cpu; + +import sun.misc.Unsafe; + +final class JDK22Specific { + static final int ADDRESS_SIZE = Unsafe.ADDRESS_SIZE; +} diff --git a/cpu/src/main/java22/io/smallrye/common/cpu/JDK22Specific.java b/cpu/src/main/java22/io/smallrye/common/cpu/JDK22Specific.java new file mode 100644 index 0000000..3f28f71 --- /dev/null +++ b/cpu/src/main/java22/io/smallrye/common/cpu/JDK22Specific.java @@ -0,0 +1,7 @@ +package io.smallrye.common.cpu; + +import java.lang.foreign.ValueLayout; + +final class JDK22Specific { + static final int ADDRESS_SIZE = (int) ValueLayout.ADDRESS.byteSize(); +} diff --git a/cpu/src/main/java22/module-info.java b/cpu/src/main/java22/module-info.java new file mode 100644 index 0000000..2ac176d --- /dev/null +++ b/cpu/src/main/java22/module-info.java @@ -0,0 +1,3 @@ +module io.smallrye.common.cpu { + exports io.smallrye.common.cpu; +} \ No newline at end of file diff --git a/pom.xml b/pom.xml index ad7cd85..c662b0c 100644 --- a/pom.xml +++ b/pom.xml @@ -169,6 +169,18 @@ + + org.apache.maven.plugins + maven-enforcer-plugin + 3.5.0 + + + + 22 + + + + io.sundr sundr-maven-plugin