This is a regression that was introduced in #27497. Although we compile sources with a Java 24 toolchain (targeting Java 17 bytecode), we are still using Java 17 to run the Gradle build.