Skip to content

Treat compile warnings as errors#53

Merged
nlativy merged 1 commit into
masterfrom
strict-warnings
Apr 26, 2026
Merged

Treat compile warnings as errors#53
nlativy merged 1 commit into
masterfrom
strict-warnings

Conversation

@nlativy
Copy link
Copy Markdown
Collaborator

@nlativy nlativy commented Apr 26, 2026

Summary

Now that the previous PRs cleared the long tail of error-prone and javadoc warnings, turn on the strict gates so any future regression breaks the build instead of being a silently ignored log line.

  • maven-compiler-plugin: <failOnWarning>true</failOnWarning> (catches javac warnings + error-prone warnings)
  • maven-javadoc-plugin: <failOnWarnings>true</failOnWarnings>

Pre-requisite cleanups bundled in

To get to a clean build first:

  • 5 test fixtures got @SuppressWarnings("unused") with a one-line comment explaining the intent (injection that should fail before the field is read; non-zero-arg constructor that exists only so the test can verify the resulting error message; a method parameter that exists so the method gets filtered out as ineligible; etc.).
  • testWrapperExceptionPropagated refactored so only the throwing call sits inside the assertThrows lambda — appeases AssertThrowsMinimizer (introduced by my fix in Fix two error-prone warnings in tests #51).
  • Error-prone told to skip generated sources via -XepExcludedPaths:.*/target/generated-(test-)?sources/.*. AutoValue's generated equals() uses pre-pattern-matching instanceof, which we can't fix and shouldn't fail builds over.

Test plan

  • mvn -B clean package — 43/43 tests pass, zero warnings, strict mode on

Now that the previous PRs cleared the long tail of error-prone and
javadoc warnings, turn on the strict gates so any future regression
breaks the build instead of being a silently ignored log line.

- maven-compiler-plugin: <failOnWarning>true</failOnWarning>
- maven-javadoc-plugin:  <failOnWarnings>true</failOnWarnings>

To get to a clean build first:

- Add @SuppressWarnings("unused") on five test fixtures whose
  unused-ness is the whole point (an injection that should fail
  before the field is read; a non-zero-arg constructor that exists
  just so the test can verify a useful error message; a method
  parameter that exists so the method gets filtered out as
  ineligible; etc.). Each annotation has a one-line comment
  explaining why.

- Refactor testWrapperExceptionPropagated so only the throwing call
  sits inside the assertThrows lambda — appeases
  AssertThrowsMinimizer, which the previous PR introduced.

- Tell error-prone to skip generated sources via
  -XepExcludedPaths. AutoValue's generated equals() uses pre-
  pattern-matching instanceof, which we can't fix and shouldn't
  fail builds over.
@nlativy nlativy merged commit c8c3e27 into master Apr 26, 2026
3 checks passed
@nlativy nlativy deleted the strict-warnings branch April 26, 2026 22:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant