LUCENE-10066: Build does not work with JDK16 as gradle's runtime (#259)

This commit is contained in:
Dawid Weiss 2021-08-26 10:08:37 +02:00 committed by GitHub
parent 2d7590a355
commit 39a2fc62d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 48 additions and 33 deletions

View File

@ -35,33 +35,48 @@ configure(rootProject) {
def testsJvms = (int) Math.max(1d, Math.min(cpus * 0.5d, 12)) def testsJvms = (int) Math.max(1d, Math.min(cpus * 0.5d, 12))
// Write the defaults for this machine. // Write the defaults for this machine.
rootProject.file("gradle.properties").write( rootProject.file("gradle.properties").write("""
[ # These settings have been generated automatically on the first run.
"# These settings have been generated automatically on the first run.", # See gradlew :helpLocalSettings for more information.
"# See gradlew :helpLocalSettings for more information.", systemProp.file.encoding=UTF-8
"systemProp.file.encoding=UTF-8",
"org.gradle.jvmargs=-Xmx3g", // TODO figure out why "gradlew check" runs out of memory if 2g # Set up gradle JVM defaults.
"org.gradle.parallel=true", # The heap seems huge but gradle runs out of memory on lower values (don't know why).
"org.gradle.priority=normal", #
"org.gradle.warning.mode=none", // Silence gradle warnings. We'll deal with them when we upgrade the wrapper. # We also open up internal compiler modules for spotless/ google jaa format.
"", org.gradle.jvmargs=-Xmx3g \\
"# You may disable the background daemon if it consumes too much memory.", --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \\
"org.gradle.daemon=true", --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \\
"org.gradle.daemon.idletimeout=900000", // timeout after 15 mins. --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \\
"", --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \\
"# Maximum number of parallel gradle workers.", --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED
"org.gradle.workers.max=${maxWorkers}",
"", # Run at normal priority, in parallel
"# Maximum number of test JVMs forked per test task.", org.gradle.parallel=true
"tests.jvms=${testsJvms}", org.gradle.priority=normal
"",
"# Disable auto JVM provisioning", # Silence gradle warnings. We'll deal with them when we upgrade the wrapper.
"org.gradle.java.installations.auto-download=false", org.gradle.warning.mode=none
"",
"# Set these to enable automatic JVM location discovery.", # You may disable the background daemon if it consumes too much memory.
"# org.gradle.java.installations.fromEnv=JDK11,JDK12,JDK13,JDK14,JDK15,JDK16,JDK17", org.gradle.daemon=true
"# org.gradle.java.installations.paths=(custom paths)", # timeout after 15 mins of inactivity.
].join("\n"), "UTF-8") 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. " + 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', " + "I wrote some sane defaults (for this machine) to 'gradle.properties', " +

View File

@ -37,7 +37,7 @@ configure(project(":lucene").subprojects) { prj ->
lineEndings 'UNIX' lineEndings 'UNIX'
endWithNewline() endWithNewline()
googleJavaFormat('1.9') googleJavaFormat('1.11.0')
// Apply to all Java sources // Apply to all Java sources
target "src/**/*.java" target "src/**/*.java"

View File

@ -24,8 +24,6 @@ import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.store.Directory; import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext; import org.apache.lucene.store.IOContext;
;
/** RW impersonation of Lucene87StoredFieldsFormat. */ /** RW impersonation of Lucene87StoredFieldsFormat. */
public class Lucene87RWStoredFieldsFormat extends Lucene87StoredFieldsFormat { public class Lucene87RWStoredFieldsFormat extends Lucene87StoredFieldsFormat {

View File

@ -30,7 +30,8 @@ import org.apache.lucene.util.SuppressForbidden;
@SuppressForbidden(reason = "Uses a Long instance as a marker") @SuppressForbidden(reason = "Uses a Long instance as a marker")
public final class PositiveIntOutputs extends Outputs<Long> { 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 Long NO_OUTPUT = new Long(0);
private static final PositiveIntOutputs singleton = new PositiveIntOutputs(); private static final PositiveIntOutputs singleton = new PositiveIntOutputs();

View File

@ -57,7 +57,7 @@ public class TestCharArraySet extends LuceneTestCase {
public void testObjectContains() { public void testObjectContains() {
CharArraySet set = new CharArraySet(10, true); CharArraySet set = new CharArraySet(10, true);
Integer val = Integer.valueOf(1); Integer val = Integer.valueOf(1);
@SuppressWarnings("deprecation") @SuppressWarnings("all")
Integer val1 = new Integer(1); Integer val1 = new Integer(1);
// Verify explicitly the case of different Integer instances // Verify explicitly the case of different Integer instances
assertNotSame(val, val1); assertNotSame(val, val1);

View File

@ -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 static final Long NO_OUTPUT = new Long(0);
private final boolean doShare; private final boolean doShare;