[
https://issues.apache.org/jira/browse/SOLR-18705?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Eric Pugh updated SOLR-18705:
-----------------------------
Description:
The build compiles with {{-Werror}}, so every lint category that is turned on
is already at zero. But several categories are turned off in
{{gradle/java/javac.gradle}}, and they hide about 2,000 warnings (attached
report, generated on main 2026-12-02):
||Category||Count||Plan||
|deprecation|733 (+490 legacy numerics)|Fix per module; enforce via
{{deprecationLintProjects}}|
|this-escape|264|Fix per module; then enable {{-Xlint:this-escape}}|
|lossy-conversions|2|Fix; enable {{-Xlint:lossy-conversions}}|
|serial|893|Out of scope (see below)|
*Approach (ratchet):* each sub-task clears one module or category to zero and,
where possible, switches on enforcement in the same PR, so the warning cannot
come back.
*Out of scope (decisions, no sub-tasks):*
* *Legacy/Trie numerics* (490 deprecation warnings): uses of
{{org.apache.solr.legacy}}, {{Trie*Field}}, {{LEGACY_*}} parsers. Too
entangled; they go away when legacy numerics are removed. Until then
{{solr/core}} cannot join {{deprecationLintProjects}} without
{{@SuppressWarnings("deprecation")}} on those classes.
* *CLI deprecations* (~140: {{Tool.getName/getUsage/getHeader}},
{{ToolBase.runImpl/getConnectionOptions}}, {{SolrCLI.processCommandLineArgs}},
{{CLIUtils.normalizeSolrUrl}}): only used by the commons-cli parser and
disappear as tools move to picocli.
* *serial*: almost all are inherited-{{Serializable}} classes (exceptions,
generated SolrJ models). Solr does not rely on Java serialization;
{{-Xlint:-serial}} stays.
* *solr/benchmark*: main code is compiled with {{-Xlint:none}} on purpose. Its
JDK 25 warning noise is tracked in SOLR-18704.
* *Deprecations owned by other issues:* {{waitForFinalState}} (SOLR-17712) and
{{SolrQuery.setRequestHandler}} / {{qt}} (SOLR-18332).
*Related issues:*
* SOLR-17931 (remove deprecated code from Solr 10): before fixing call sites of
a deprecated API, check whether it is already scheduled for removal there.
* SOLR-17604: open question on the future of
{{CloudSolrClient.getClusterState()}}; blocks sub-tasks 5-6 (SOLR-18710,
SOLR-18711).
* SOLR-18272: {{CollectorManager}} rework of {{SolrIndexSearcher}}; coordinate
with sub-task 8 (SOLR-18713).
* SOLR-16222: earlier effort on IntelliJ warnings in test code.
*How to reproduce the report:* save this as {{all-warnings.init.gradle}}:
{code:groovy}
allprojects {
tasks.withType(JavaCompile).configureEach {
doFirst {
options.compilerArgs.removeAll { it.startsWith("-Xlint:") || it ==
"-Werror" }
options.compilerArgs += ["-Xlint:all", "-Xmaxwarns", "100000"]
}
}
}
{code}
then run:
{code}
./gradlew -I all-warnings.init.gradle -Pjavac.failOnWarnings=false compileJava
compileTestJava --rerun-tasks 2>&1 | tee warnings.log
grep -o "warning: \[[a-z-]*\]" warnings.log | sort | uniq -c | sort -rn
{code}
Scope to one module with e.g. {{:solr:solrj-streaming:compileJava
:solr:solrj-streaming:compileTestJava}}.
*Per-PR checklist:* before/after warning counts in the PR description;
{{gradlew check -x test}} passes; one module or one API per PR.
was:
The build compiles with {{-Werror}}, so every lint category that is turned on
is already at zero. But several categories are turned off in
{{gradle/java/javac.gradle}}, and they hide about 2,000 warnings (attached
report, generated on main 2026-12-02):
||Category||Count||Plan||
|deprecation|733 (+490 legacy numerics)|Fix per module; enforce via
{{deprecationLintProjects}}|
|this-escape|264|Fix per module; then enable {{-Xlint:this-escape}}|
|lossy-conversions|2|Fix; enable {{-Xlint:lossy-conversions}}|
|serial|893|Out of scope (see below)|
*Approach (ratchet):* each sub-task clears one module or category to zero and,
where possible, switches on enforcement in the same PR, so the warning cannot
come back.
*Out of scope (decisions, no sub-tasks):*
* *Legacy/Trie numerics* (490 deprecation warnings): uses of
{{org.apache.solr.legacy}}, {{Trie*Field}}, {{LEGACY_*}} parsers. Too
entangled; they go away when legacy numerics are removed. Until then
{{solr/core}} cannot join {{deprecationLintProjects}} without
{{@SuppressWarnings("deprecation")}} on those classes.
* *CLI deprecations* (~140: {{Tool.getName/getUsage/getHeader}},
{{ToolBase.runImpl/getConnectionOptions}}, {{SolrCLI.processCommandLineArgs}},
{{CLIUtils.normalizeSolrUrl}}): only used by the commons-cli parser and
disappear as tools move to picocli.
* *serial*: almost all are inherited-{{Serializable}} classes (exceptions,
generated SolrJ models). Solr does not rely on Java serialization;
{{-Xlint:-serial}} stays.
* *solr/benchmark*: main code is compiled with {{-Xlint:none}} on purpose. Its
JDK 25 warning noise is tracked in SOLR-18704.
* *Deprecations owned by other issues:* {{waitForFinalState}} (SOLR-17712) and
{{SolrQuery.setRequestHandler}} / {{qt}} (SOLR-18332).
*Related issues:*
* SOLR-17931 (remove deprecated code from Solr 10): before fixing call sites of
a deprecated API, check whether it is already scheduled for removal there.
* SOLR-17604: open question on the future of
{{CloudSolrClient.getClusterState()}}; blocks sub-tasks 5-6.
* SOLR-18272: {{CollectorManager}} rework of {{SolrIndexSearcher}}; coordinate
with sub-task 8.
* SOLR-16222: earlier effort on IntelliJ warnings in test code.
*How to reproduce the report:* save this as {{all-warnings.init.gradle}}:
{code:groovy}
allprojects {
tasks.withType(JavaCompile).configureEach {
doFirst {
options.compilerArgs.removeAll { it.startsWith("-Xlint:") || it ==
"-Werror" }
options.compilerArgs += ["-Xlint:all", "-Xmaxwarns", "100000"]
}
}
}
{code}
then run:
{code}
./gradlew -I all-warnings.init.gradle -Pjavac.failOnWarnings=false compileJava
compileTestJava --rerun-tasks 2>&1 | tee warnings.log
grep -o "warning: \[[a-z-]*\]" warnings.log | sort | uniq -c | sort -rn
{code}
Scope to one module with e.g. {{:solr:solrj-streaming:compileJava
:solr:solrj-streaming:compileTestJava}}.
*Per-PR checklist:* before/after warning counts in the PR description;
{{gradlew check -x test}} passes; one module or one API per PR.
> Clean up javac lint warnings and enforce them with -Werror
> ----------------------------------------------------------
>
> Key: SOLR-18705
> URL: https://issues.apache.org/jira/browse/SOLR-18705
> Project: Solr
> Issue Type: Improvement
> Components: Build
> Reporter: Eric Pugh
> Priority: Major
>
> The build compiles with {{-Werror}}, so every lint category that is turned on
> is already at zero. But several categories are turned off in
> {{gradle/java/javac.gradle}}, and they hide about 2,000 warnings (attached
> report, generated on main 2026-12-02):
> ||Category||Count||Plan||
> |deprecation|733 (+490 legacy numerics)|Fix per module; enforce via
> {{deprecationLintProjects}}|
> |this-escape|264|Fix per module; then enable {{-Xlint:this-escape}}|
> |lossy-conversions|2|Fix; enable {{-Xlint:lossy-conversions}}|
> |serial|893|Out of scope (see below)|
> *Approach (ratchet):* each sub-task clears one module or category to zero
> and, where possible, switches on enforcement in the same PR, so the warning
> cannot come back.
> *Out of scope (decisions, no sub-tasks):*
> * *Legacy/Trie numerics* (490 deprecation warnings): uses of
> {{org.apache.solr.legacy}}, {{Trie*Field}}, {{LEGACY_*}} parsers. Too
> entangled; they go away when legacy numerics are removed. Until then
> {{solr/core}} cannot join {{deprecationLintProjects}} without
> {{@SuppressWarnings("deprecation")}} on those classes.
> * *CLI deprecations* (~140: {{Tool.getName/getUsage/getHeader}},
> {{ToolBase.runImpl/getConnectionOptions}},
> {{SolrCLI.processCommandLineArgs}}, {{CLIUtils.normalizeSolrUrl}}): only used
> by the commons-cli parser and disappear as tools move to picocli.
> * *serial*: almost all are inherited-{{Serializable}} classes (exceptions,
> generated SolrJ models). Solr does not rely on Java serialization;
> {{-Xlint:-serial}} stays.
> * *solr/benchmark*: main code is compiled with {{-Xlint:none}} on purpose.
> Its JDK 25 warning noise is tracked in SOLR-18704.
> * *Deprecations owned by other issues:* {{waitForFinalState}} (SOLR-17712)
> and {{SolrQuery.setRequestHandler}} / {{qt}} (SOLR-18332).
> *Related issues:*
> * SOLR-17931 (remove deprecated code from Solr 10): before fixing call sites
> of a deprecated API, check whether it is already scheduled for removal there.
> * SOLR-17604: open question on the future of
> {{CloudSolrClient.getClusterState()}}; blocks sub-tasks 5-6 (SOLR-18710,
> SOLR-18711).
> * SOLR-18272: {{CollectorManager}} rework of {{SolrIndexSearcher}};
> coordinate with sub-task 8 (SOLR-18713).
> * SOLR-16222: earlier effort on IntelliJ warnings in test code.
> *How to reproduce the report:* save this as {{all-warnings.init.gradle}}:
> {code:groovy}
> allprojects {
> tasks.withType(JavaCompile).configureEach {
> doFirst {
> options.compilerArgs.removeAll { it.startsWith("-Xlint:") || it ==
> "-Werror" }
> options.compilerArgs += ["-Xlint:all", "-Xmaxwarns", "100000"]
> }
> }
> }
> {code}
> then run:
> {code}
> ./gradlew -I all-warnings.init.gradle -Pjavac.failOnWarnings=false
> compileJava compileTestJava --rerun-tasks 2>&1 | tee warnings.log
> grep -o "warning: \[[a-z-]*\]" warnings.log | sort | uniq -c | sort -rn
> {code}
> Scope to one module with e.g. {{:solr:solrj-streaming:compileJava
> :solr:solrj-streaming:compileTestJava}}.
> *Per-PR checklist:* before/after warning counts in the PR description;
> {{gradlew check -x test}} passes; one module or one API per PR.
--
This message was sent by Atlassian Jira
(v10.3.26#10030026)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]