Apache Lucene open-source search software
LUCENE-10066: Build does not work with JDK16 as gradle's runtime (#259)
Dawid Weiss39a2fc62d40b
diff --git a/gradle/generation/local-settings.gradle b/gradle/generation/local-settings.gradleindex bc6cbab2503..f41ad031aa9 100644--- a/gradle/generation/local-settings.gradle+++ b/gradle/generation/local-settings.gradle@@ -35,33 +35,48 @@ configure(rootProject) {def testsJvms = (int) Math.max(1d, Math.min(cpus * 0.5d, 12))// Write the defaults for this machine.- rootProject.file("gradle.properties").write(- [- "# These settings have been generated automatically on the first run.",- "# See gradlew :helpLocalSettings for more information.",- "systemProp.file.encoding=UTF-8",- "org.gradle.jvmargs=-Xmx3g", // TODO figure out why "gradlew check" runs out of memory if 2g- "org.gradle.parallel=true",- "org.gradle.priority=normal",- "org.gradle.warning.mode=none", // Silence gradle warnings. We'll deal with them when we upgrade the wrapper.- "",- "# You may disable the background daemon if it consumes too much memory.",- "org.gradle.daemon=true",- "org.gradle.daemon.idletimeout=900000", // timeout after 15 mins.- "",- "# Maximum number of parallel gradle workers.",- "org.gradle.workers.max=${maxWorkers}",- "",- "# Maximum number of test JVMs forked per test task.",- "tests.jvms=${testsJvms}",- "",- "# Disable auto JVM provisioning",- "org.gradle.java.installations.auto-download=false",- "",- "# Set these to enable automatic JVM location discovery.",- "# org.gradle.java.installations.fromEnv=JDK11,JDK12,JDK13,JDK14,JDK15,JDK16,JDK17",- "# org.gradle.java.installations.paths=(custom paths)",- ].join("\n"), "UTF-8")+ rootProject.file("gradle.properties").write("""+# These settings have been generated automatically on the first run.+# See gradlew :helpLocalSettings for more information.+systemProp.file.encoding=UTF-8++# Set up gradle JVM defaults.+# The heap seems huge but gradle runs out of memory on lower values (don't know why).+#+# We also open up internal compiler modules for spotless/ google jaa format.+org.gradle.jvmargs=-Xmx3g \\+ --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \\+ --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \\+ --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \\+ --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \\+ --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED++# Run at normal priority, in parallel+org.gradle.parallel=true+org.gradle.priority=normal++# Silence gradle warnings. We'll deal with them when we upgrade the wrapper.+org.gradle.warning.mode=none++# You may disable the background daemon if it consumes too much memory.+org.gradle.daemon=true+# timeout after 15 mins of inactivity.+org.gradle.daemon.idletimeout=900000++# Maximum number of parallel gradle workers.+org.gradle.workers.max=${maxWorkers}++# Maximum number of test JVMs forked per test task.+tests.jvms=${testsJvms}++# Disable auto JVM provisioning (we don't use toolchains yet but want no surprises).+org.gradle.java.installations.auto-download=false++# Set these to enable automatic JVM location discovery.+org.gradle.java.installations.fromEnv=JDK11,JDK12,JDK13,JDK14,JDK15,JDK16,JDK17+org.gradle.java.installations.paths=(custom paths)++""", "UTF-8")logger.log(LogLevel.WARN, "\nIMPORTANT. This is the first time you ran the build. " +"I wrote some sane defaults (for this machine) to 'gradle.properties', " +diff --git a/gradle/validation/spotless.gradle b/gradle/validation/spotless.gradleindex d0e3574284d..d9198b30240 100644--- a/gradle/validation/spotless.gradle+++ b/gradle/validation/spotless.gradle@@ -37,7 +37,7 @@ configure(project(":lucene").subprojects) { prj ->lineEndings 'UNIX'endWithNewline()- googleJavaFormat('1.9')+ googleJavaFormat('1.11.0')// Apply to all Java sourcestarget "src/**/*.java"diff --git a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/Lucene87RWStoredFieldsFormat.java b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/Lucene87RWStoredFieldsFormat.javaindex 8144469f2b8..2f2b347ff44 100644--- a/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/Lucene87RWStoredFieldsFormat.java+++ b/lucene/backward-codecs/src/test/org/apache/lucene/backward_codecs/lucene87/Lucene87RWStoredFieldsFormat.java@@ -24,8 +24,6 @@ import org.apache.lucene.index.SegmentInfo;import org.apache.lucene.store.Directory;import org.apache.lucene.store.IOContext;-;-/** RW impersonation of Lucene87StoredFieldsFormat. */public class Lucene87RWStoredFieldsFormat extends Lucene87StoredFieldsFormat {diff --git a/lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.java b/lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.javaindex 08b1a02f098..7e4fea6ec8c 100644--- a/lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.java+++ b/lucene/core/src/java/org/apache/lucene/util/fst/PositiveIntOutputs.java@@ -30,7 +30,8 @@ import org.apache.lucene.util.SuppressForbidden;@SuppressForbidden(reason = "Uses a Long instance as a marker")public final class PositiveIntOutputs extends Outputs<Long> {- @SuppressWarnings("deprecation")+ // Ignore the deprecated constructor. We do want a unique object here.+ @SuppressWarnings({"all"})private static final Long NO_OUTPUT = new Long(0);private static final PositiveIntOutputs singleton = new PositiveIntOutputs();diff --git a/lucene/core/src/test/org/apache/lucene/analysis/TestCharArraySet.java b/lucene/core/src/test/org/apache/lucene/analysis/TestCharArraySet.javaindex 3f5238f6c6c..2396d6468e3 100644--- a/lucene/core/src/test/org/apache/lucene/analysis/TestCharArraySet.java+++ b/lucene/core/src/test/org/apache/lucene/analysis/TestCharArraySet.java@@ -57,7 +57,7 @@ public class TestCharArraySet extends LuceneTestCase {public void testObjectContains() {CharArraySet set = new CharArraySet(10, true);Integer val = Integer.valueOf(1);- @SuppressWarnings("deprecation")+ @SuppressWarnings("all")Integer val1 = new Integer(1);// Verify explicitly the case of different Integer instancesassertNotSame(val, val1);diff --git a/lucene/misc/src/java/org/apache/lucene/misc/util/fst/UpToTwoPositiveIntOutputs.java b/lucene/misc/src/java/org/apache/lucene/misc/util/fst/UpToTwoPositiveIntOutputs.javaindex 8c49366d54b..b70c5c87195 100644--- a/lucene/misc/src/java/org/apache/lucene/misc/util/fst/UpToTwoPositiveIntOutputs.java+++ b/lucene/misc/src/java/org/apache/lucene/misc/util/fst/UpToTwoPositiveIntOutputs.java@@ -76,7 +76,8 @@ public final class UpToTwoPositiveIntOutputs extends Outputs<Object> {}}- @SuppressWarnings("deprecation")+ // Ignore the deprecated constructor. We do want a unique object here.+ @SuppressWarnings({"all"})private static final Long NO_OUTPUT = new Long(0);private final boolean doShare;