Merge branch 'main' into java_21
diff --git a/.github/workflows/distribution.yml b/.github/workflows/distribution.yml
index 3ed1998..1c2b39c 100644
--- a/.github/workflows/distribution.yml
+++ b/.github/workflows/distribution.yml
@@ -35,7 +35,7 @@
       uses: actions/setup-java@v3
       with:
         distribution: 'temurin'
-        java-version: 17
+        java-version: 21
         java-package: jdk
     - name: Prepare caches
       uses: ./.github/actions/gradle-caches
diff --git a/.github/workflows/gradle-precommit.yml b/.github/workflows/gradle-precommit.yml
index 076fb0e..0e3c2d6 100644
--- a/.github/workflows/gradle-precommit.yml
+++ b/.github/workflows/gradle-precommit.yml
@@ -25,7 +25,7 @@
         # Operating systems to run on.
         os: [ubuntu-latest]
         # Test JVMs.
-        java: [ '17' ]
+        java: [ '21' ]
 
     env:
       GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
@@ -59,7 +59,7 @@
         # macos-latest: a tad slower than ubuntu and pretty much the same (?) so leaving out.
         os: [ubuntu-latest]
         # Test JVMs.
-        java: [ '17' ]
+        java: [ '21' ]
 
     env:
       GRADLE_ENTERPRISE_ACCESS_KEY: ${{ secrets.GE_ACCESS_TOKEN }}
diff --git a/.github/workflows/hunspell.yml b/.github/workflows/hunspell.yml
index ed040ec..f44e2ea 100644
--- a/.github/workflows/hunspell.yml
+++ b/.github/workflows/hunspell.yml
@@ -25,7 +25,7 @@
       uses: actions/setup-java@v3
       with:
         distribution: 'temurin'
-        java-version: 17
+        java-version: 21
         java-package: jdk
 
     - name: Prepare caches
diff --git a/build.gradle b/build.gradle
index f396a77..9c64ab1 100644
--- a/build.gradle
+++ b/build.gradle
@@ -73,7 +73,7 @@
   }
 
   // Minimum Java version required to compile and run Lucene.
-  minJavaVersion = JavaVersion.VERSION_17
+  minJavaVersion = JavaVersion.VERSION_21
 
   // snapshot build marker used in scripts.
   snapshotBuild = version.contains("SNAPSHOT")
@@ -101,6 +101,12 @@
   groovy "org.codehaus.groovy:groovy-all:3.0.12"
 }
 
+repositories {
+  maven {
+    url "https://repo.eclipse.org/content/repositories/eclipse-snapshots/"
+  }
+}
+
 apply from: file('buildSrc/scriptDepVersions.gradle')
 
 // Include smaller chunks configuring dedicated build areas.
diff --git a/buildSrc/scriptDepVersions.gradle b/buildSrc/scriptDepVersions.gradle
index 991ff18..795ce08 100644
--- a/buildSrc/scriptDepVersions.gradle
+++ b/buildSrc/scriptDepVersions.gradle
@@ -24,7 +24,7 @@
       "apache-rat": "0.14",
       "asm": "9.6",
       "commons-codec": "1.13",
-      "ecj": "3.30.0",
+      "ecj": "3.36.0-SNAPSHOT",
       "flexmark": "0.61.24",
       "javacc": "7.0.12",
       "jflex": "1.8.2",
diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java
index 5c34666..72253d3 100644
--- a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java
+++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/PerfRunData.java
@@ -46,6 +46,7 @@
 import org.apache.lucene.store.Directory;
 import org.apache.lucene.store.FSDirectory;
 import org.apache.lucene.util.IOUtils;
+import org.apache.lucene.util.SuppressForbidden;
 
 /**
  * Data maintained by a performance test run.
@@ -204,7 +205,7 @@
     resetInputs();
 
     // release unused stuff
-    System.runFinalization();
+    runFinalization();
     System.gc();
 
     // Re-init clock
@@ -482,4 +483,10 @@
   public Map<String, AnalyzerFactory> getAnalyzerFactories() {
     return analyzerFactories;
   }
+
+  @SuppressWarnings("removal")
+  @SuppressForbidden(reason = "requires to run finalization")
+  private static void runFinalization() {
+    System.runFinalization();
+  }
 }
diff --git a/lucene/core/src/test/org/apache/lucene/util/TestWeakIdentityMap.java b/lucene/core/src/test/org/apache/lucene/util/TestWeakIdentityMap.java
index 3db8540..86098cb 100644
--- a/lucene/core/src/test/org/apache/lucene/util/TestWeakIdentityMap.java
+++ b/lucene/core/src/test/org/apache/lucene/util/TestWeakIdentityMap.java
@@ -119,7 +119,7 @@
     int size = map.size();
     for (int i = 0; size > 0 && i < 10; i++)
       try {
-        System.runFinalization();
+        runFinalization();
         System.gc();
         int newSize = map.size();
         assertTrue("previousSize(" + size + ")>=newSize(" + newSize + ")", size >= newSize);
@@ -232,7 +232,7 @@
     int size = map.size();
     for (int i = 0; size > 0 && i < 10; i++)
       try {
-        System.runFinalization();
+        runFinalization();
         System.gc();
         int newSize = map.size();
         assertTrue("previousSize(" + size + ")>=newSize(" + newSize + ")", size >= newSize);
@@ -252,4 +252,10 @@
           InterruptedException ie) {
       }
   }
+
+  @SuppressWarnings("removal")
+  @SuppressForbidden(reason = "requires to run finalization")
+  private static void runFinalization() {
+    System.runFinalization();
+  }
 }