Motivation
ponder-lab/ML#337 removes TENSOR_ITERABLE_SYNTHETIC_FUNCTION_NAME — an unused private static final field in PythonTensorAnalysisEngine that had been orphaned. The constant slipped through despite the project's <compilerArgument>-Xlint</compilerArgument> + <failOnWarning>true</failOnWarning> config.
Spike verified the root cause: javac doesn't detect unused private fields at all, not even under -Xlint:all. Repo-wide compile under -Xlint:all,-options with failOnWarning=false emits 0 warnings. The "unused private field" detection is outside javac's native lint surface — it requires a separate static-analysis tool.
This is a systemic blind spot. The single orphan caught here was visible only because it surfaced during a CLAUDE.md rewrite that referenced it; other unused-private fields could be lurking unflagged.
Proposed Direction
Adopt one of:
- ErrorProne (https://errorprone.info) — javac plugin, integrates as a maven-compiler-plugin annotation processor. The
UnusedVariable check covers unused fields/locals/parameters. Many other checks come along (EqualsHashCode, MissingOverride, etc.). The standard choice for Google-style javac integration.
- SpotBugs — separate maven plugin, bytecode-level.
UUF_UNUSED_FIELD covers this case. Different category of tool; runs after compile rather than during.
- PMD — source-level, narrower coverage; less commonly used.
Recommendation: ErrorProne, since it's the closest match to "javac warnings the project already runs" — same compile-time triggering, just more aggressive checks.
One-Time Cleanup Cost
Adopting any of these will surface existing warnings that need fixing in one pass before failOnWarning can be re-enabled. Pre-adoption spike (run the tool with warnings-only, no fail) gives a count.
Related
- ponder-lab/ML#337 — the single-orphan removal that surfaced the gap.
- The project's existing maven-compiler-plugin config at
pom.xml:159-160.
Motivation
ponder-lab/ML#337 removes
TENSOR_ITERABLE_SYNTHETIC_FUNCTION_NAME— an unusedprivate static finalfield inPythonTensorAnalysisEnginethat had been orphaned. The constant slipped through despite the project's<compilerArgument>-Xlint</compilerArgument>+<failOnWarning>true</failOnWarning>config.Spike verified the root cause: javac doesn't detect unused private fields at all, not even under
-Xlint:all. Repo-wide compile under-Xlint:all,-optionswithfailOnWarning=falseemits 0 warnings. The "unused private field" detection is outside javac's native lint surface — it requires a separate static-analysis tool.This is a systemic blind spot. The single orphan caught here was visible only because it surfaced during a CLAUDE.md rewrite that referenced it; other unused-private fields could be lurking unflagged.
Proposed Direction
Adopt one of:
UnusedVariablecheck covers unused fields/locals/parameters. Many other checks come along (EqualsHashCode,MissingOverride, etc.). The standard choice for Google-style javac integration.UUF_UNUSED_FIELDcovers this case. Different category of tool; runs after compile rather than during.Recommendation: ErrorProne, since it's the closest match to "javac warnings the project already runs" — same compile-time triggering, just more aggressive checks.
One-Time Cleanup Cost
Adopting any of these will surface existing warnings that need fixing in one pass before
failOnWarningcan be re-enabled. Pre-adoption spike (run the tool with warnings-only, no fail) gives a count.Related
pom.xml:159-160.