Treat compile warnings as errors#53
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
@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.).testWrapperExceptionPropagatedrefactored so only the throwing call sits inside theassertThrowslambda — appeasesAssertThrowsMinimizer(introduced by my fix in Fix two error-prone warnings in tests #51).-XepExcludedPaths:.*/target/generated-(test-)?sources/.*. AutoValue's generatedequals()uses pre-pattern-matchinginstanceof, 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