Add Checker framework, enable format string and interning checkers #1239
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.
This PR adds the Checker framework, a compile-time annotation-based static analyzer. Checker is built from a large assortment of discrete pluggable checkers, including some for nullability and units. This PR only enables the format string checker and the interning checker for now. For the checkers to succeed, a substantial number of annotations needed to be added across the codebase. As a result, there is a lot of noise in the changed files; the most important changes exist in the
pom.xml.template
andRuntimeMeta.java
files.Service.java
also had a bit of code cleanup due to an abnormally high number of warnings in one of the most critical classes. There were also numerous bug fixes across the codebase as the checkers successfully located incorrect equality comparisons and format strings. One or two locations also used reference equality checks as an optimization strategy; errors concerning these were suppressed.Finally, due to how Swing action listeners are implemented, there were many false positives in old GUI code. These have simply been ignored with
@SuppressWarnings("not.interned")
pending the removal of such code.Notes
Checker adds substantial time to the first-time compilation phase, Maven will perform incremental building thereafter and the time used by checker will therefore be usually unnoticeable, but on my Ryzen 5 5600g system the first-time build now takes around 2.5 minutes. This will likely increase further as we add more checkers.