Repository navigation
Conversation
Of the 110 annotations 105 hid nothing. 94 named their checks with palantir-baseline's for-rollout: prefix, which plain Error Prone does not take for the check's name: NullAway and the rest reported those lines all along. Others named checks this build does not run (TooManyArguments, ImmutablesStyle), IntelliJ inspections, or javac's unchecked lint, which is off. Without UnicodeEscape's, its one finding shows. The five on Doc's and Level's memoized suppliers stay: Immutable is an error, and the suppliers are mutable caches that the check rightly rejects. They need their own change.
ExecutableTransform's logger, StringWrapper's endLine and the stderr two MainTest tests read after the process had exited were never read. They are gone, and Error Prone now fails the build on the next one.
In PalantirJavaFormatSettings `State` named both IntelliJ's @State annotation and the settings' own State class. The annotation is now written out in full, which leaves the name to the class.
The switch statements in DimensionHelpers.extractDims, CommandLineOptionsParser's two range parsers and SnippetFormatter's snippetWrapper returned from every case. Each is now the switch expression it returns, with yield where a case has statements before its value.
Eight calls in the tests built a message or an expected string by concatenation and handed it to a method that formats one itself: AssertJ's describedAs, hasMessage and isEqualTo(String, Object...) and Guava's checkState. They now pass a format string and its arguments.
The checks that fail the build join excludedPaths in a single block, in alphabetical order. The checks that were only listed as comments for later are gone; the findings still to fix are in the build output.
State also named IntelliJ's @State annotation on the same class, which the previous commit wrote out in full to tell the two apart. The class gets a name of its own and the annotation its import back. The class name is not in .idea/open-java-format.xml: IntelliJ writes the bean's fields into the component element, and PalantirJavaFormatSettingsTest loads files written before.
…fTheRun As a format string the expected comment no longer read like the input it is rewritten from. The concatenation is back, with FormatStringConcatenation suppressed on the test.
…nto abashev/Fix-error-prone-issues
The 21.X.X merge brought in Signature, whose bundled field only went into the serialized signature and carried a suppression. jars() now picks the jars by it: the hash is there exactly when the build declared none of its own, so the step formats with the same jars as before.
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.
Error Prone has run on every compile, but nothing it reported failed the build except two JUnit checks, and the warnings scrolled past. This is the first step towards making it fail the build: the suppressions go, and four checks become errors once their findings are fixed.
@SuppressWarnings. 105 of the 110 are gone. They hid almost nothing. 94 named their checks with palantir-baseline'sfor-rollout:prefix, which plain Error Prone does not take for a check's name, so NullAway and the rest reported those lines all along. Others named checks this build does not run (TooManyArguments,ImmutablesStyle), IntelliJ inspections, or javac'suncheckedlint, which is off. RemovingUnicodeEscape's brings back its one finding.Immutablestays suppressed. The five suppressions onDoc's andLevel's memoized suppliers remain.Immutableis an error by default, and the check is right:Suppliers.memoizecaches its value, soBreak,TokenandNonBreakingSpace, which are@Immutableand extendDoc, are not immutable. Fixing that is a change of its own.UnusedVariable:ExecutableTransform's logger,StringWrapper'sendLine, and the stderr that twoMainTesttests read after the process had exited.SameNameButDifferent: inPalantirJavaFormatSettings,Statenamed both IntelliJ's@Stateand the settings bean. The bean is nowStoredSettings. Its class name is not stored in.idea/open-java-format.xml, andPalantirJavaFormatSettingsTestloads files written before.RefactorSwitch: four switch statements that returned from every case are now the switch expressions they return.FormatStringConcatenation: seven calls in the tests pass a format string and its arguments to AssertJ'sdescribedAs,hasMessageandisEqualToand to Guava'scheckState, instead of a concatenated string. InJavaCommentsHelperTestthe expected comment stays written out like its input, and the check is suppressed on that test.Tests
./gradlew testpasses on JDK 21: 1557 tests, 14 skipped. With an unused local added toCommandLineOptionsParser,:open-java-format:compileJavafails witherror: [UnusedVariable].Not here
166 warnings remain: NullAway 102, CollectorMutability 12, EffectivelyPrivate 12, StringConcatToTextBlock 9, ConstantNaming 5, and 1 to 3 each for 17 more checks. There are also 133 suggestions (StaticImport 86, LexicographicalAnnotationListing 23, and others). Those checks,
Immutableincluded, follow one at a time.