Apache Lucene open-source search software
Upgrade to Gradle 8.14 and Java 24 minimum (#14533)
Dawid Weiss9c6708805e27
diff --git a/.github/actions/prepare-for-build/action.yml b/.github/actions/prepare-for-build/action.ymlindex 70b045f8901..e2c46c35e10 100644--- a/.github/actions/prepare-for-build/action.yml+++ b/.github/actions/prepare-for-build/action.yml@@ -7,7 +7,7 @@ description: Creates a shared setup for other workflowsinputs:java-version:required: false- default: "23"+ default: "24"description: "The default JDK version to set up."java-distribution:diff --git a/.github/workflows/run-checks-all.yml b/.github/workflows/run-checks-all.ymlindex e67dfe3c40f..809c15b6efc 100644--- a/.github/workflows/run-checks-all.yml+++ b/.github/workflows/run-checks-all.yml@@ -29,7 +29,7 @@ jobs:strategy:matrix:os: [ ubuntu-latest ]- java: [ '23' ]+ java: [ '24' ]runs-on: ${{ matrix.os }}@@ -53,7 +53,7 @@ jobs:matrix:# Operating systems to run on.os: [ ubuntu-latest, windows-latest, macos-latest ]- java: [ '23' ]+ java: [ '24' ]runs-on: ${{ matrix.os }}diff --git a/.github/workflows/run-checks-gradle-upgrade.yml b/.github/workflows/run-checks-gradle-upgrade.ymlindex 0e067ed2639..4e290672a9d 100644--- a/.github/workflows/run-checks-gradle-upgrade.yml+++ b/.github/workflows/run-checks-gradle-upgrade.yml@@ -30,7 +30,7 @@ jobs:strategy:matrix:os: [ ubuntu-latest ]- java-version: [ '23-ea' ]+ java-version: [ '24' ]uses-alt-java: [ true, false ]runs-on: ${{ matrix.os }}diff --git a/.github/workflows/run-nightly-smoketester.yml b/.github/workflows/run-nightly-smoketester.ymlindex aa9f6760592..e0511e2338a 100644--- a/.github/workflows/run-nightly-smoketester.yml+++ b/.github/workflows/run-nightly-smoketester.yml@@ -18,7 +18,7 @@ jobs:strategy:matrix:os: [ ubuntu-latest ]- java-version: [ '23', '24' ]+ java-version: [ '24' ]runs-on: ${{ matrix.os }}@@ -37,7 +37,7 @@ jobs:# This intentionally lists two versions, the last one is used as the system default (for running gradle).java-version: |${{ matrix.java-version }}- 23+ 24- name: Echo diagnostic paths and locationsrun: |diff --git a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.javaindex 3fa0f01436a..0fa2e9584b8 100644--- a/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java+++ b/build-tools/build-infra/src/main/java/org/apache/lucene/gradle/WrapperDownloader.java@@ -60,8 +60,8 @@ public class WrapperDownloader {public static void checkVersion() {int major = Runtime.version().feature();- if (major != 23) {- throw new IllegalStateException("java version must be 23, your version: " + major);+ if (major != 24) {+ throw new IllegalStateException("java version must be 24, your version: " + major);}}diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.tomlindex 1aa5ddc0c98..371128bb47d 100644--- a/gradle/libs.versions.toml+++ b/gradle/libs.versions.toml@@ -5,12 +5,13 @@ asm = "9.6"assertj = "3.27.3"commons-codec = "1.17.2"commons-compress = "1.19"-ecj = "3.40.0"+# @keep This version refers to ECJ batch compiler from p2 repositories ("drops").+ecjP2Drop = "ecj-4.36M1"errorprone = "2.36.0"flexmark = "0.64.8"# @keep This is GJF version for spotless/ tidy.googleJavaFormat = "1.23.0"-groovy = "4.0.22"+groovy = "4.0.26"hamcrest = "2.2"icu4j = "77.1"javacc = "7.0.12"@@ -20,9 +21,9 @@ jmh = "1.37"jts = "1.17.0"junit = "4.13.1"# @keep Minimum gradle version to run the build-minGradle = "8.10"+minGradle = "8.14"# @keep This is the minimum required Java version.-minJava = "23"+minJava = "24"morfologik = "2.1.9"morfologik-ukrainian = "4.9.1"nekohtml = "1.9.17"@@ -43,7 +44,6 @@ asm-core = { module = "org.ow2.asm:asm", version.ref = "asm" }assertj = { module = "org.assertj:assertj-core", version.ref = "assertj" }commons-codec = { module = "commons-codec:commons-codec", version.ref = "commons-codec" }commons-compress = { module = "org.apache.commons:commons-compress", version.ref = "commons-compress" }-ecj = { module = "org.eclipse.jdt:ecj", version.ref = "ecj" }errorprone = { module = "com.google.errorprone:error_prone_core", version.ref = "errorprone" }flexmark-core = { module = "com.vladsch.flexmark:flexmark", version.ref = "flexmark" }flexmark-ext-abbreviation = { module = "com.vladsch.flexmark:flexmark-ext-abbreviation", version.ref = "flexmark" }diff --git a/gradle/validation/ecj-lint.gradle b/gradle/validation/ecj-lint.gradleindex a98bd09e62e..37305399d1f 100644--- a/gradle/validation/ecj-lint.gradle+++ b/gradle/validation/ecj-lint.gradle@@ -18,32 +18,58 @@// This adds 'ecjLint' task.configure(rootProject) {+ apply plugin: deps.plugins.undercouch.download.get().pluginId++ def ecjVersion = deps.versions.ecjP2Drop.get()+ def ecjDropJar = project.layout.buildDirectory.file("ecj-drop/${ecjVersion}.jar")+ def downloadEcjDrop = tasks.register("downloadEcjDrop", Download, {+ src "https://www.eclipse.org/downloads/download.php?r=1&file=/eclipse/downloads/drops4/S-4.36M1-202504031800/${ecjVersion}.jar"+ dest project.layout.buildDirectory.dir("ecj-drop")+ overwrite false+ onlyIf {+ !ecjDropJar.get().asFile.exists()+ }+ })+configurations {- ecjDeps+ ecjDropDeps}- dependencies {- ecjDeps deps.ecj+ artifacts {+ add("ecjDropDeps", ecjDropJar, {+ builtBy downloadEcjDrop+ })}}def resources = scriptResources(buildscript)allprojects {- plugins.withType(JavaPlugin) {+ plugins.withType(JavaPlugin).configureEach {+ configurations {+ ecjDeps+ }++ dependencies {+ ecjDeps project(path: ":", configuration: "ecjDropDeps")+ }++ def ecjConfiguration = configurations.ecjDeps+// Create a [sourceSetName]EcjLint task for each source set// with a non-empty java.srcDirs. These tasks are then// attached to project's "ecjLint" task.- def lintTasks = sourceSets.collect { sourceSet ->+ def lintTasks = sourceSets.collect { SourceSet sourceSet ->def srcDirs = sourceSet.java.sourceDirectories.filter { dir -> dir.exists() }- tasks.create(sourceSet.getTaskName("ecjLint", null), JavaExec, { JavaExec task ->+ tasks.register(sourceSet.getTaskName("ecjLint", null), JavaExec, { JavaExec task ->// This dependency is on a configuration; technically it causes// all dependencies to be resolved before this task executes// (this includes scheduling tasks that compile the// sources from other projects for example).dependsOn sourceSet.compileClasspath+ dependsOn ecjConfiguration// The inputs are all source files from the sourceSet.inputs.files sourceSet.allSource.asFileTree@@ -56,8 +82,8 @@ allprojects {if (sourceSet.name ==~ /main\d+/) {enabled = false}-- classpath = rootProject.configurations.ecjDeps++ classpath = ecjConfigurationmainClass = "org.eclipse.jdt.internal.compiler.batch.Main"// Don't emit any .class files.@@ -133,12 +159,12 @@ allprojects {})}- task ecjLint() {+ def ecjLint = tasks.register("ecjLint", {description "Lint Java sources using ECJ."group "Verification"dependsOn lintTasks- }+ })// Attach ecjLint to check.check.dependsOn ecjLintdiff --git a/gradle/wrapper/gradle-wrapper.jar.sha256 b/gradle/wrapper/gradle-wrapper.jar.sha256index 6d5fdcd3f30..30bde90fc90 100644--- a/gradle/wrapper/gradle-wrapper.jar.sha256+++ b/gradle/wrapper/gradle-wrapper.jar.sha256@@ -1 +1 @@-2db75c40782f5e8ba1fc278a5574bab070adccb2d21ca5a6e5ed840888448046\ No newline at end of file+7d3a4ac4de1c32b59bc6a4eb8ecb8e612ccd0cf1ae1e99f66902da64df296172\ No newline at end of filediff --git a/gradle/wrapper/gradle-wrapper.jar.version b/gradle/wrapper/gradle-wrapper.jar.versionindex 7f6758ef97b..2a5dd0d6389 100644--- a/gradle/wrapper/gradle-wrapper.jar.version+++ b/gradle/wrapper/gradle-wrapper.jar.version@@ -1 +1 @@-8.10.0+8.14.0diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.propertiesindex 9355b415575..ca025c83a7c 100644--- a/gradle/wrapper/gradle-wrapper.properties+++ b/gradle/wrapper/gradle-wrapper.properties@@ -1,6 +1,6 @@distributionBase=GRADLE_USER_HOMEdistributionPath=wrapper/dists-distributionUrl=https\://services.gradle.org/distributions/gradle-8.10-bin.zip+distributionUrl=https\://services.gradle.org/distributions/gradle-8.14-bin.zipnetworkTimeout=10000validateDistributionUrl=truezipStoreBase=GRADLE_USER_HOMEdiff --git a/lucene/analysis/common/src/generated/checksums/generateTlds.json b/lucene/analysis/common/src/generated/checksums/generateTlds.jsonindex 85ae0cd9934..6d4a70184b1 100644--- a/lucene/analysis/common/src/generated/checksums/generateTlds.json+++ b/lucene/analysis/common/src/generated/checksums/generateTlds.json@@ -1,5 +1,5 @@{- "lucene/analysis/common/src/java/org/apache/lucene/analysis/email/ASCIITLD.jflex": "eddfb929c5664b2081a20314ac1a8363c462f27c",- "lucene/analysis/common/src/test/org/apache/lucene/analysis/email/TLDs.txt": "7c5785fda5692269e4a8022d2d08119ace54b54e",+ "lucene/analysis/common/src/java/org/apache/lucene/analysis/email/ASCIITLD.jflex": "796548e0fbf0688225824e65473167dbb478adc4",+ "lucene/analysis/common/src/test/org/apache/lucene/analysis/email/TLDs.txt": "84ccf9a61fb66f1f882fbbeb56efe8e21ba74b41","property:tldZones": "https://data.iana.org/TLD/tlds-alpha-by-domain.txt"}\ No newline at end of filediff --git a/lucene/analysis/common/src/generated/checksums/generateUAX29URLEmailTokenizer.json b/lucene/analysis/common/src/generated/checksums/generateUAX29URLEmailTokenizer.jsonindex 0a59584c5f9..3648beaa15d 100644--- a/lucene/analysis/common/src/generated/checksums/generateUAX29URLEmailTokenizer.json+++ b/lucene/analysis/common/src/generated/checksums/generateUAX29URLEmailTokenizer.json@@ -1,6 +1,6 @@{"gradle/generation/jflex/skeleton.disable.buffer.expansion.txt": "6e43a3a64a9b5eb82ec5b4bc21f95aff5a2a061e",- "lucene/analysis/common/src/java/org/apache/lucene/analysis/email/ASCIITLD.jflex": "eddfb929c5664b2081a20314ac1a8363c462f27c",+ "lucene/analysis/common/src/java/org/apache/lucene/analysis/email/ASCIITLD.jflex": "796548e0fbf0688225824e65473167dbb478adc4","lucene/analysis/common/src/java/org/apache/lucene/analysis/email/UAX29URLEmailTokenizerImpl.java": "ad17a3b0bc254749685ac34c3071bb0881f7b185","lucene/analysis/common/src/java/org/apache/lucene/analysis/email/UAX29URLEmailTokenizerImpl.jflex": "8d7cd1a935443deda6cad73b91f1a45c1c714535"}\ No newline at end of filediff --git a/lucene/analysis/common/src/java/org/apache/lucene/analysis/email/ASCIITLD.jflex b/lucene/analysis/common/src/java/org/apache/lucene/analysis/email/ASCIITLD.jflexindex ab2c95e9d2a..f56c1569217 100644--- a/lucene/analysis/common/src/java/org/apache/lucene/analysis/email/ASCIITLD.jflex+++ b/lucene/analysis/common/src/java/org/apache/lucene/analysis/email/ASCIITLD.jflex@@ -15,7 +15,7 @@* limitations under the License.*/// Generated from IANA TLD Database <https://data.iana.org/TLD/tlds-alpha-by-domain.txt>-// file version from 2024 Mar 28, Thu 07:07:01 Coordinated Universal Time+// file version from 2025 Apr 22, Tue 07:07:01 GMT// generated by org.apache.lucene.analysis.standard.GenerateJflexTLDMacros// LUCENE-8278: None of the TLDs in {ASCIITLD} is a 1-character-shorter prefix of another TLD@@ -285,7 +285,6 @@ ASCIITLD = "." (| [cC][yY][mM][rR][uU]| [cC][yY][oO][uU]| [cC][zZ]- | [dD][aA][bB][uU][rR]| [dD][aA][dD]| [dD][aA][nN][cC][eE]| [dD][aA][tT][aA]@@ -590,7 +589,6 @@ ASCIITLD = "." (| [kK][dD][dD][iI]| [kK][eE]| [kK][eE][rR][rR][yY][hH][oO][tT][eE][lL][sS]- | [kK][eE][rR][rR][yY][lL][oO][gG][iI][sS][tT][iI][cC][sS]| [kK][eE][rR][rR][yY][pP][rR][oO][pP][eE][rR][tT][iI][eE][sS]| [kK][fF][hH]| [kK][gG]@@ -650,7 +648,6 @@ ASCIITLD = "." (| [lL][iI][mM][oO]| [lL][iI][nN][cC][oO][lL][nN]| [lL][iI][nN][kK]- | [lL][iI][pP][sS][yY]| [lL][iI][vV][eE]| [lL][iI][vV][iI][nN][gG]| [lL][kK]@@ -747,7 +744,6 @@ ASCIITLD = "." (| [nN][aA][bB]| [nN][aA][gG][oO][yY][aA]| [nN][aA][mM][eE]- | [nN][aA][tT][uU][rR][aA]| [nN][aA][vV][yY]| [nN][bB][aA]| [nN][cC]@@ -958,7 +954,6 @@ ASCIITLD = "." (| [sS][hH]| [sS][hH][aA][nN][gG][rR][iI][lL][aA]| [sS][hH][aA][rR][pP]- | [sS][hH][aA][wW]| [sS][hH][eE][lL][lL]| [sS][hH][iI][aA]| [sS][hH][iI][kK][sS][hH][aA]diff --git a/lucene/analysis/common/src/test/org/apache/lucene/analysis/email/TLDs.txt b/lucene/analysis/common/src/test/org/apache/lucene/analysis/email/TLDs.txtindex 6d8ae157cf8..10d69730fda 100644--- a/lucene/analysis/common/src/test/org/apache/lucene/analysis/email/TLDs.txt+++ b/lucene/analysis/common/src/test/org/apache/lucene/analysis/email/TLDs.txt@@ -296,7 +296,6 @@ cycymrucyoucz-daburdaddancedata@@ -627,7 +626,6 @@ kaufenkddikekerryhotels-kerrylogisticskerrypropertieskfhkg@@ -691,7 +689,6 @@ limitedlimolincolnlink-lipsylivelivinglk@@ -801,7 +798,6 @@ nanabnagoyaname-naturanavynbanc@@ -1038,7 +1034,6 @@ sgshshangrilasharp-shawshellshiashikshadiff --git a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.javaindex b4ca9bfbf78..d5abc136b9f 100644--- a/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java+++ b/lucene/core/src/java/org/apache/lucene/store/MMapDirectory.java@@ -365,7 +365,9 @@ public class MMapDirectory extends FSDirectory {// access through the lookup:final var constr = lookup.findConstructor(cls, MethodType.methodType(void.class, int.class));try {- return (MMapIndexInputProvider<A>) constr.invoke(maxPermits);+ @SuppressWarnings("unchecked")+ var res = (MMapIndexInputProvider<A>) constr.invoke(maxPermits);+ return res;} catch (RuntimeException | Error e) {throw e;} catch (Throwable th) {