diff --git a/.bazelrc b/.bazelrc index fa7505564e..5adb1b78af 100644 --- a/.bazelrc +++ b/.bazelrc @@ -10,10 +10,10 @@ common --enable_workspace build --experimental_cc_static_library build --experimental_cc_shared_library -build --java_language_version=17 -build --java_runtime_version=roboriojdk_17 -build --tool_java_language_version=17 -build --tool_java_runtime_version=remotejdk_17 +build --java_language_version=21 +build --java_runtime_version=remotejdk_21 +build --tool_java_language_version=21 +build --tool_java_runtime_version=remotejdk_21 test --test_output=errors test --test_verbose_timeout_warnings diff --git a/.github/workflows/bazel.yml b/.github/workflows/bazel.yml index 9b70d7af15..2f2806a68b 100644 --- a/.github/workflows/bazel.yml +++ b/.github/workflows/bazel.yml @@ -22,8 +22,8 @@ jobs: with: { fetch-depth: 0 } - uses: actions/setup-java@v4 with: - distribution: 'zulu' - java-version: 17 + distribution: 'temurin' + java-version: 21 architecture: x64 - id: Setup_build_buddy @@ -42,6 +42,11 @@ jobs: - uses: actions/checkout@v4 with: { fetch-depth: 0 } + - uses: actions/setup-java@v4 + with: + distribution: 'temurin' + java-version: 21 + - id: Setup_build_buddy uses: ./.github/actions/setup-build-buddy with: @@ -56,7 +61,7 @@ jobs: fail-fast: false matrix: include: - - { name: "Linux", os: ubuntu-24.04, container: "wpilib/ubuntu-base:24.04", action: "test", config: "", } + - { name: "Linux", os: ubuntu-24.04, container: "wpilib/systemcore-cross-ubuntu:2027-24.04", action: "test", config: "", } name: "${{ matrix.name }}" runs-on: ${{ matrix.os }} container: ${{ matrix.container }} diff --git a/.github/workflows/cmake-android.yml b/.github/workflows/cmake-android.yml index 770a194d14..0652b01fa4 100644 --- a/.github/workflows/cmake-android.yml +++ b/.github/workflows/cmake-android.yml @@ -36,7 +36,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 17 + java-version: 21 - name: Install sccache uses: mozilla-actions/sccache-action@v0.0.9 diff --git a/.github/workflows/cmake.yml b/.github/workflows/cmake.yml index 1939e9ee8f..d55c42c3d9 100644 --- a/.github/workflows/cmake.yml +++ b/.github/workflows/cmake.yml @@ -18,7 +18,7 @@ jobs: include: - os: ubuntu-24.04 name: Linux - container: wpilib/roborio-cross-ubuntu:2025-24.04 + container: wpilib/systemcore-cross-ubuntu:2027-24.04 flags: "--preset with-java-and-sccache -DCMAKE_BUILD_TYPE=Release -DWITH_EXAMPLES=ON" - os: macOS-14 name: macOS diff --git a/.github/workflows/documentation.yml b/.github/workflows/documentation.yml index a566592c10..77e12a0281 100644 --- a/.github/workflows/documentation.yml +++ b/.github/workflows/documentation.yml @@ -24,7 +24,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 17 + java-version: 21 - name: Set environment variables (Development) run: | echo "BRANCH=development" >> $GITHUB_ENV diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 113361373f..0d2172aee4 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -19,16 +19,16 @@ jobs: fail-fast: false matrix: include: - - container: wpilib/systemcore-cross-ubuntu:2025-24.04 + - container: wpilib/systemcore-cross-ubuntu:2027-24.04 artifact-name: SystemCore build-options: "-Ponlylinuxsystemcore" - - container: wpilib/raspbian-cross-ubuntu:bookworm-24.04 + - container: wpilib/raspbian-cross-ubuntu:2027-bookworm-24.04 artifact-name: Arm32 build-options: "-Ponlylinuxarm32" - - container: wpilib/aarch64-cross-ubuntu:bookworm-24.04 + - container: wpilib/aarch64-cross-ubuntu:2027-bookworm-24.04 artifact-name: Arm64 build-options: "-Ponlylinuxarm64" - - container: wpilib/ubuntu-base:24.04 + - container: wpilib/systemcore-cross-ubuntu:2027-24.04 artifact-name: Linux build-options: "-Ponlylinuxx86-64" name: "Build - ${{ matrix.artifact-name }}" @@ -119,7 +119,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 17 + java-version: 21 architecture: ${{ matrix.architecture }} - name: Import Developer ID Certificate uses: wpilibsuite/import-signing-certificate@v2 @@ -189,7 +189,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 17 + java-version: 21 - name: Set release environment variable run: echo "EXTRA_GRADLE_ARGS=-PreleaseMode" >> $GITHUB_ENV if: startsWith(github.ref, 'refs/tags/v2027') @@ -251,7 +251,7 @@ jobs: (github.ref == 'refs/heads/2027' || startsWith(github.ref, 'refs/tags/v2027')) with: distribution: 'temurin' - java-version: 17 + java-version: 21 - name: Combine (2027) if: | github.repository == 'wpilibsuite/allwpilib' && diff --git a/.github/workflows/lint-format.yml b/.github/workflows/lint-format.yml index c70288f351..d7b295d1b5 100644 --- a/.github/workflows/lint-format.yml +++ b/.github/workflows/lint-format.yml @@ -94,7 +94,7 @@ jobs: name: "Java format" runs-on: ubuntu-24.04 needs: [validation] - container: wpilib/ubuntu-base:24.04 + container: wpilib/systemcore-cross-ubuntu:2027-24.04 steps: - uses: actions/checkout@v4 with: diff --git a/.github/workflows/sentinel-build.yml b/.github/workflows/sentinel-build.yml index 5acb014ed1..22122a5d74 100644 --- a/.github/workflows/sentinel-build.yml +++ b/.github/workflows/sentinel-build.yml @@ -23,16 +23,16 @@ jobs: fail-fast: false matrix: include: - - container: wpilib/roborio-cross-ubuntu:2025-24.04 - artifact-name: Athena - build-options: "-Ponlylinuxathena" - - container: wpilib/raspbian-cross-ubuntu:bookworm-24.04 + - container: wpilib/systemcore-cross-ubuntu:2027-24.04 + artifact-name: SystemCore + build-options: "-Ponlylinuxsystemcore" + - container: wpilib/raspbian-cross-ubuntu:2027-bookworm-24.04 artifact-name: Arm32 build-options: "-Ponlylinuxarm32" - - container: wpilib/aarch64-cross-ubuntu:bookworm-24.04 + - container: wpilib/aarch64-cross-ubuntu:2027-bookworm-24.04 artifact-name: Arm64 build-options: "-Ponlylinuxarm64" - - container: wpilib/ubuntu-base:24.04 + - container: wpilib/systemcore-cross-ubuntu:2027-24.04 artifact-name: Linux build-options: "-Ponlylinuxx86-64" name: "Build - ${{ matrix.artifact-name }}" @@ -112,7 +112,7 @@ jobs: - uses: actions/setup-java@v4 with: distribution: 'temurin' - java-version: 17 + java-version: 21 architecture: ${{ matrix.architecture }} - name: Import Developer ID Certificate uses: wpilibsuite/import-signing-certificate@v2 diff --git a/README-CMake.md b/README-CMake.md index 7f42ad75c2..f9f6c568ba 100644 --- a/README-CMake.md +++ b/README-CMake.md @@ -35,7 +35,7 @@ The protobuf library and compiler are needed for protobuf generation. OpenCV needs to be findable by CMake. On systems like the Jetson, this is installed by default. Otherwise, you will need to build OpenCV from source and install it. -If you want JNI and Java, you will need a JDK of at least version 17 installed. In addition, you need a `JAVA_HOME` environment variable set properly and set to the JDK directory. +If you want JNI and Java, you will need a JDK of at least version 21 installed. In addition, you need a `JAVA_HOME` environment variable set properly and set to the JDK directory. If you are building with unit tests or simulation modules, you will also need an Internet connection for the initial setup process, as CMake will clone google-test and imgui from GitHub. diff --git a/README.md b/README.md index 565623105f..a1a8692d4a 100644 --- a/README.md +++ b/README.md @@ -42,11 +42,11 @@ Using Gradle makes building WPILib very straightforward. It only has a few depen ## Requirements -- [JDK 17](https://adoptium.net/temurin/releases/?version=17) +- [JDK 21](https://adoptium.net/temurin/releases/?version=21) - Note that the JRE is insufficient; the full JDK is required - - On Ubuntu, run `sudo apt install openjdk-17-jdk` - - On Windows, install the JDK 17 .msi from the link above - - On macOS, install the JDK 17 .pkg from the link above + - On Ubuntu, run `sudo apt install openjdk-21-jdk` + - On Windows, install the JDK 21 .msi from the link above + - On macOS, install the JDK 21 .pkg from the link above - C++ compiler - On Linux, install GCC 11 or greater - On Windows, install [Visual Studio Community 2022](https://visualstudio.microsoft.com/vs/community/) and select the C++ programming language during installation (Gradle can't use the build tools for Visual Studio) diff --git a/build.gradle b/build.gradle index 69586fdff7..52af95aa35 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ plugins { id 'net.ltgt.errorprone' version '3.1.0' apply false id 'com.gradleup.shadow' version '8.3.4' apply false id 'com.diffplug.spotless' version '6.20.0' apply false - id 'com.github.spotbugs' version '6.0.2' apply false + id 'com.github.spotbugs' version '6.1.13' apply false } wpilibVersioning.buildServerMode = project.hasProperty('buildServer') @@ -111,8 +111,8 @@ subprojects { plugins.withType(JavaPlugin) { java { - sourceCompatibility = 17 - targetCompatibility = 17 + sourceCompatibility = 21 + targetCompatibility = 21 } } diff --git a/cameraserver/src/main/java/edu/wpi/first/vision/VisionRunner.java b/cameraserver/src/main/java/edu/wpi/first/vision/VisionRunner.java index b9459cb00c..bb8dc9ff8d 100644 --- a/cameraserver/src/main/java/edu/wpi/first/vision/VisionRunner.java +++ b/cameraserver/src/main/java/edu/wpi/first/vision/VisionRunner.java @@ -73,7 +73,7 @@ public class VisionRunner

{ public void runOnce() { Long id = CameraServerSharedStore.getCameraServerShared().getRobotMainThreadId(); - if (id != null && Thread.currentThread().getId() == id) { + if (id != null && Thread.currentThread().threadId() == id) { throw new IllegalStateException( "VisionRunner.runOnce() cannot be called from the main robot thread"); } @@ -106,7 +106,7 @@ public class VisionRunner

{ public void runForever() { Long id = CameraServerSharedStore.getCameraServerShared().getRobotMainThreadId(); - if (id != null && Thread.currentThread().getId() == id) { + if (id != null && Thread.currentThread().threadId() == id) { throw new IllegalStateException( "VisionRunner.runForever() cannot be called from the main robot thread"); } diff --git a/docs/build.gradle b/docs/build.gradle index e8c78c49ab..9786cd28d8 100644 --- a/docs/build.gradle +++ b/docs/build.gradle @@ -181,7 +181,7 @@ configurations { task generateJavaDocs(type: Javadoc) { classpath += project(":wpilibj").sourceSets.main.compileClasspath - options.links("https://docs.oracle.com/en/java/javase/17/docs/api/") + options.links("https://docs.oracle.com/en/java/javase/21/docs/api/") options.links("https://docs.opencv.org/4.x/javadoc/") options.addStringOption("tag", "pre:a:Pre-Condition") options.addBooleanOption("Xdoclint/package:" + diff --git a/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/AnnotationProcessor.java b/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/AnnotationProcessor.java index 398569702e..5dc6ad5b69 100644 --- a/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/AnnotationProcessor.java +++ b/epilogue-processor/src/main/java/edu/wpi/first/epilogue/processor/AnnotationProcessor.java @@ -40,7 +40,7 @@ import javax.tools.Diagnostic; "edu.wpi.first.epilogue.CustomLoggerFor", "edu.wpi.first.epilogue.Logged" }) -@SupportedSourceVersion(SourceVersion.RELEASE_17) +@SupportedSourceVersion(SourceVersion.RELEASE_21) public class AnnotationProcessor extends AbstractProcessor { private static final String kCustomLoggerFqn = "edu.wpi.first.epilogue.CustomLoggerFor"; private static final String kClassSpecificLoggerFqn = diff --git a/shared/java/javacommon.gradle b/shared/java/javacommon.gradle index f9ba25bea2..b62a61a9f9 100644 --- a/shared/java/javacommon.gradle +++ b/shared/java/javacommon.gradle @@ -103,7 +103,7 @@ configurations { tasks.withType(JavaCompile).configureEach { options.compilerArgs = [ '--release', - '17', + '21', '-encoding', 'UTF8', "-Werror", diff --git a/shared/java/javastyle.gradle b/shared/java/javastyle.gradle index e2b713e7e6..337a302596 100644 --- a/shared/java/javastyle.gradle +++ b/shared/java/javastyle.gradle @@ -5,7 +5,7 @@ if (project.hasProperty('skipJavaFormat')) { apply plugin: 'checkstyle' checkstyle { - toolVersion = "10.12.2" + toolVersion = "10.26.1" configDirectory = file("${project.rootDir}/styleguide") config = resources.text.fromFile(new File(configDirectory.get().getAsFile(), "checkstyle.xml")) } diff --git a/styleguide/checkstyle-suppressions.xml b/styleguide/checkstyle-suppressions.xml index 2bfd414d59..0ff41a1b98 100644 --- a/styleguide/checkstyle-suppressions.xml +++ b/styleguide/checkstyle-suppressions.xml @@ -16,4 +16,6 @@ suppressions PUBLIC "-//Puppy Crawl//DTD Suppressions 1.1//EN" checks="MethodName" /> + diff --git a/styleguide/spotbugs-exclude.xml b/styleguide/spotbugs-exclude.xml index 401b227ffe..35ff5c8302 100644 --- a/styleguide/spotbugs-exclude.xml +++ b/styleguide/spotbugs-exclude.xml @@ -37,20 +37,12 @@ - - - - - - - - @@ -156,4 +148,12 @@ + + + + + + + + diff --git a/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java b/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java index 2263aaed77..61c96bd6a6 100644 --- a/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java +++ b/wpilibj/src/main/java/edu/wpi/first/wpilibj/RobotBase.java @@ -93,7 +93,7 @@ public abstract class RobotBase implements AutoCloseable { */ protected RobotBase() { final NetworkTableInstance inst = NetworkTableInstance.getDefault(); - m_threadId = Thread.currentThread().getId(); + m_threadId = Thread.currentThread().threadId(); setupCameraServerShared(); setupMathShared(); // subscribe to "" to force persistent values to propagate to local diff --git a/wpiutil/src/main/java/edu/wpi/first/util/struct/StructGenerator.java b/wpiutil/src/main/java/edu/wpi/first/util/struct/StructGenerator.java index 24b2541e1c..e883d9da76 100644 --- a/wpiutil/src/main/java/edu/wpi/first/util/struct/StructGenerator.java +++ b/wpiutil/src/main/java/edu/wpi/first/util/struct/StructGenerator.java @@ -435,7 +435,6 @@ public final class StructGenerator { } int size = 0; - boolean failed = false; for (final E constant : enumVariants) { final String name = constant.name(); @@ -452,6 +451,8 @@ public final class StructGenerator { .filter(f -> !f.isEnumConstant() && !Modifier.isStatic(f.getModifiers())) .toList(); + boolean failed = false; + for (final Field field : enumFields) { final Class type = field.getType(); final String name = field.getName();