Skip to content

Commit 36eaacd

Browse files
authored
Add a linter flag to suppress warning about incubating vector module. (#14802)
1 parent dd84e6a commit 36eaacd

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

build-tools/build-infra/src/main/groovy/lucene.java.tests-and-randomization.gradle

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,17 @@ if (verboseMode && !verboseModeHookInstalled) {
173173
}
174174
}
175175

176+
Provider<Integer> minMajorVersion = upperJavaFeatureVersionOption.map { ver -> Integer.parseInt(JavaVersion.toVersion(ver).majorVersion) }
177+
JavaVersion runtimeJava = rootProject.ext.runtimeJavaVersion
178+
boolean incubatorJavaVersion = rootProject.ext.vectorIncubatorJavaVersions.contains(runtimeJava)
179+
180+
// if the vector module is in incubator, pass lint flags to suppress excessive warnings.
181+
if (incubatorJavaVersion) {
182+
tasks.withType(JavaCompile).configureEach {
183+
it.options.compilerArgs += ["-Xlint:-incubating"]
184+
}
185+
}
186+
176187
tasks.withType(Test).configureEach {
177188
// Running any test task should first display the root randomization seed.
178189
dependsOn ":showTestsSeed"
@@ -225,9 +236,6 @@ tasks.withType(Test).configureEach {
225236

226237
// Enable the vector incubator module on supported Java versions:
227238

228-
Provider<Integer> minMajorVersion = upperJavaFeatureVersionOption.map { ver -> Integer.parseInt(JavaVersion.toVersion(ver).majorVersion) }
229-
JavaVersion runtimeJava = rootProject.ext.runtimeJavaVersion
230-
boolean incubatorJavaVersion = rootProject.ext.vectorIncubatorJavaVersions.contains(runtimeJava)
231239
boolean manualMinMajorVersion = minMajorVersion.isPresent() &&
232240
Integer.parseInt(runtimeJava.majorVersion) <= minMajorVersion.get()
233241
if (incubatorJavaVersion || manualMinMajorVersion) {

0 commit comments

Comments
 (0)