{"record":{"id":"f7b0cffb0a0c8c77","repo":"apache/iceberg","slug":"the-jmh-benchmarks-must-be-run-with-jdk-17-or-jdk","errorCode":null,"errorMessage":"The JMH benchmarks must be run with JDK 17 or JDK 21","messagePattern":"The JMH benchmarks must be run with JDK 17 or JDK 21","errorType":"console","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"jmh.gradle","lineNumber":21,"sourceCode":" * or more contributor license agreements.  See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership.  The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License.  You may obtain a copy of the License at\n *\n *   http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied.  See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nif (jdkVersion != '17' && jdkVersion != '21') {\n  throw new GradleException(\"The JMH benchmarks must be run with JDK 17 or JDK 21\")\n}\n\ndef flinkVersions = (System.getProperty(\"flinkVersions\") != null ? System.getProperty(\"flinkVersions\") : System.getProperty(\"defaultFlinkVersions\")).split(\",\")\ndef sparkVersions = (System.getProperty(\"sparkVersions\") != null ? System.getProperty(\"sparkVersions\") : System.getProperty(\"defaultSparkVersions\")).split(\",\")\ndef scalaVersion = System.getProperty(\"scalaVersion\") != null ? System.getProperty(\"scalaVersion\") : System.getProperty(\"defaultScalaVersion\")\ndef jmhProjects = [project(\":iceberg-core\"), project(\":iceberg-data\")]\n\nif (flinkVersions.contains(\"1.20\")) {\n  jmhProjects.add(project(\":iceberg-flink:iceberg-flink-1.20\"))\n}\n\nif (flinkVersions.contains(\"2.1\")) {\n    jmhProjects.add(project(\":iceberg-flink:iceberg-flink-2.1\"))\n}\n\nif (flinkVersions.contains(\"2.2\")) {\n    jmhProjects.add(project(\":iceberg-flink:iceberg-flink-2.2\"))\n}","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/apache/iceberg/blob/86d9c8fc543e7c56c9f624eb725f76c9baff9570/jmh.gradle#L3-L39","documentation":"jmh.gradle validates that the JDK used to run JMH benchmarks is 17 or 21. The benchmark harness and its bytecode/toolchain expectations only support these two LTS versions, so any other JDK fails fast with this GradleException before benchmarks are configured.","triggerScenarios":"Running any JMH task (e.g. ./gradlew :iceberg-core:jmh or -Pjmh...) with jdkVersion set to something other than 17 or 21, such as JDK 11 or JDK 8.","commonSituations":"Old CI images with JDK 11 default; local machine with JDK 8 for legacy work; running benchmarks inside a container pinned to an unsupported JDK.","solutions":["Run the benchmark tasks with JDK 17 or JDK 21 by setting JAVA_HOME or org.gradle.java.home accordingly.","If using Gradle toolchains, set the JVM toolchain version to 17 or 21 for the JMH subprojects.","Upgrade or rebuild the container/CI image to one that ships JDK 17 or 21."],"exampleFix":"// before\nJAVA_HOME=jdk-11 ./gradlew :iceberg-data:jmh\n// after\nJAVA_HOME=jdk-21 ./gradlew :iceberg-data:jmh","handlingStrategy":"validation","validationCode":"JAVA_VERSION=$(java -version 2>&1 | head -1); [[ \"$JAVA_VERSION\" == *'\"17.'* || \"$JAVA_VERSION\" == *'\"21.'* ]] || echo 'JMH requires JDK 17 or 21'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use JDK 17 or 21 containers/images for benchmark runs.","Set org.gradle.java.home in your local gradle.properties to a 17/21 JDK.","Verify the JDK before long benchmark sessions to avoid wasted runs."],"tags":["gradle","jdk","jmh","benchmarks","environment"],"backgroundTag":"unsupported-platform","analyzedSha":"86d9c8fc543e7c56c9f624eb725f76c9baff9570","analyzedAt":"2026-09-12T00:46:39.097Z","contentChangedAt":"2026-09-12T00:46:39.097Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}