Suppress incubating module warning to retain -Werror#144798
Suppress incubating module warning to retain -Werror#144798ChrisHegarty merged 7 commits intoelastic:mainfrom
Conversation
Prepend -Xlint:none before -Xlint:all,... in ElasticsearchJavaBasePlugin to suppress the mandatory "using incubating module(s)" warning that javac emits when jdk.incubator.vector is used. On JDK 21 this warning has no named lint category and cannot be individually suppressed (-Xlint:-incubating was added in JDK 22). -Xlint:none clears all warnings including this mandatory one, then -Xlint:all,... re-enables only the named categories. For JDK 22+ compilers, -incubating is also added to the exclusion list to handle JDK 25+ where -Xlint:all re-enables the now-named category. This allows removing the -Werror workarounds from simdvec and swisshash build.gradle files, restoring warnings-as-errors for all source files. Relates elastic#144797 Made-with: Cursor
|
Pinging @elastic/es-search-relevance (Team:Search Relevance) |
|
Pinging @elastic/es-delivery (Team:Delivery) |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (3)
💤 Files with no reviewable changes (2)
📝 WalkthroughWalkthroughThe pull request modifies Java compilation configuration across multiple build files. The Elasticsearch base build plugin's javac lint handling was adjusted to first disable all lint checks, then selectively re-enable specific categories. For compiler major version 22 and above, the incubating warning is additionally excluded from the re-enabled categories, while the ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
Prepend -Xlint:none before -Xlint:all,... in ElasticsearchJavaBasePlugin to suppress the mandatory "using incubating module(s)" warning that javac emits when jdk.incubator.vector is used. On JDK 21 this warning has no named lint category and cannot be individually suppressed (-Xlint:-incubating was added in JDK 22). -Xlint:none clears all warnings including this mandatory one, then -Xlint:all,... re-enables only the named categories. For JDK 22+ compilers, -incubating is also added to the exclusion list to handle JDK 25+ where -Xlint:all re-enables the now-named category. This allows removing the -Werror workarounds from simdvec and swisshash build.gradle files, restoring warnings-as-errors for all source files.
This is step 2 of #144797. I'm merging the `main21` source set into `main` in the simdvec module, eliminating one level of MR-JAR complexity. The `main21` source set existed because it uses `jdk.incubator.vector`, which emitted an unsuppressible warning on JDK 21 that was incompatible with `-Werror`. Now that I've suppressed that warning centrally in #144798, there is no longer a reason to keep these files in a separate source set. Specifically: - I moved all 33 source files from `src/main21/java/` into `src/main/java/`. - I replaced the two stub classes in `main` (`VectorScorerFactoryImpl`, `ESVectorizationProvider`) with their real `main21` implementations. The stubs only existed to satisfy the compiler and threw `UnsupportedOperationException` at runtime. - I moved `IndexInputUtilsTests` from `src/test21/` into `src/test/`. - I deleted the `src/main21/` and `src/test21/` directories entirely. - I updated `build.gradle` to pass `--add-modules` and `--add-reads` to the main `compileJava` task instead of `compileMain21Java`. - I updated the `module-info.java` Javadoc to reflect the simplified layout. I've left the `main22` source set and the MR-JAR plugin in place for now; I'll address those in subsequent steps.
This is step 2 of elastic#144797. I'm merging the `main21` source set into `main` in the simdvec module, eliminating one level of MR-JAR complexity. The `main21` source set existed because it uses `jdk.incubator.vector`, which emitted an unsuppressible warning on JDK 21 that was incompatible with `-Werror`. Now that I've suppressed that warning centrally in elastic#144798, there is no longer a reason to keep these files in a separate source set. Specifically: - I moved all 33 source files from `src/main21/java/` into `src/main/java/`. - I replaced the two stub classes in `main` (`VectorScorerFactoryImpl`, `ESVectorizationProvider`) with their real `main21` implementations. The stubs only existed to satisfy the compiler and threw `UnsupportedOperationException` at runtime. - I moved `IndexInputUtilsTests` from `src/test21/` into `src/test/`. - I deleted the `src/main21/` and `src/test21/` directories entirely. - I updated `build.gradle` to pass `--add-modules` and `--add-reads` to the main `compileJava` task instead of `compileMain21Java`. - I updated the `module-info.java` Javadoc to reflect the simplified layout. I've left the `main22` source set and the MR-JAR plugin in place for now; I'll address those in subsequent steps.
Prepend -Xlint:none before -Xlint:all,... in ElasticsearchJavaBasePlugin to suppress the mandatory "using incubating module(s)" warning that javac emits when jdk.incubator.vector is used. On JDK 21 this warning has no named lint category and cannot be individually suppressed (-Xlint:-incubating was added in JDK 22). -Xlint:none clears all warnings including this mandatory one, then -Xlint:all,... re-enables only the named categories. For JDK 22+ compilers, -incubating is also added to the exclusion list to handle JDK 25+ where -Xlint:all re-enables the now-named category. This allows removing the -Werror workarounds from simdvec and swisshash build.gradle files, restoring warnings-as-errors for all source files.
This is step 2 of elastic#144797. I'm merging the `main21` source set into `main` in the simdvec module, eliminating one level of MR-JAR complexity. The `main21` source set existed because it uses `jdk.incubator.vector`, which emitted an unsuppressible warning on JDK 21 that was incompatible with `-Werror`. Now that I've suppressed that warning centrally in elastic#144798, there is no longer a reason to keep these files in a separate source set. Specifically: - I moved all 33 source files from `src/main21/java/` into `src/main/java/`. - I replaced the two stub classes in `main` (`VectorScorerFactoryImpl`, `ESVectorizationProvider`) with their real `main21` implementations. The stubs only existed to satisfy the compiler and threw `UnsupportedOperationException` at runtime. - I moved `IndexInputUtilsTests` from `src/test21/` into `src/test/`. - I deleted the `src/main21/` and `src/test21/` directories entirely. - I updated `build.gradle` to pass `--add-modules` and `--add-reads` to the main `compileJava` task instead of `compileMain21Java`. - I updated the `module-info.java` Javadoc to reflect the simplified layout. I've left the `main22` source set and the MR-JAR plugin in place for now; I'll address those in subsequent steps.
This is step 2 of elastic#144797. I'm merging the `main21` source set into `main` in the simdvec module, eliminating one level of MR-JAR complexity. The `main21` source set existed because it uses `jdk.incubator.vector`, which emitted an unsuppressible warning on JDK 21 that was incompatible with `-Werror`. Now that I've suppressed that warning centrally in elastic#144798, there is no longer a reason to keep these files in a separate source set. Specifically: - I moved all 33 source files from `src/main21/java/` into `src/main/java/`. - I replaced the two stub classes in `main` (`VectorScorerFactoryImpl`, `ESVectorizationProvider`) with their real `main21` implementations. The stubs only existed to satisfy the compiler and threw `UnsupportedOperationException` at runtime. - I moved `IndexInputUtilsTests` from `src/test21/` into `src/test/`. - I deleted the `src/main21/` and `src/test21/` directories entirely. - I updated `build.gradle` to pass `--add-modules` and `--add-reads` to the main `compileJava` task instead of `compileMain21Java`. - I updated the `module-info.java` Javadoc to reflect the simplified layout. I've left the `main22` source set and the MR-JAR plugin in place for now; I'll address those in subsequent steps.
Summary
The
simdvecandswisshashmodules usejdk.incubator.vector, which causes javac to emit a mandatory warning:On JDK 21 this warning has no named lint category -
-Xlint:-incubatingwas only added in JDK 22. Since the build enforces-Werror, both modules had to remove-Werroras a workaround, meaning 29+ source files compile without warnings-as-errors.This PR restores
-Werrorfor all source files by suppressing the incubating warning centrally inElasticsearchJavaBasePlugin.The
-Xlint:nonetrickOn JDK 21, the incubating warning is a "mandatory" warning outside the named
-Xlintcategory system.-Xlint:nonesuppresses it, and when followed by-Xlint:all,..., javac re-enables only the named categories — the unnamed incubating warning stays suppressed.-Xlint:nonethen-Xlint:all,...allafternoneallFor JDK 25+,
-incubatingmust be added to the-Xlintexclusion list. The fix is version-aware: it always prepends-Xlint:none, and additionally excludes-incubatingwhen the compiler JDK is >= 22.Changes
ElasticsearchJavaBasePlugin.java- Prepend-Xlint:nonebefore-Xlint:all,...to suppress the mandatory incubating warning. Add version-aware-incubatingexclusion for JDK 22+ compilers.simdvec/build.gradle- Removeoptions.compilerArgs -= '-Werror'workaround.swisshash/build.gradle- Removeoptions.compilerArgs -= '-Werror'workaround.Relates #144797
Made with support from AI tooling.