Update com.google.errorprone:* to 2.31.0#2862
Merged
malliaridis merged 8 commits intoapache:mainfrom Nov 13, 2024
Merged
Conversation
This check is impossible and will always fail with an IllegalArgumentException if algorithmString is invalid. The same IllegalArgumentException is also thrown in the else block, so the output is the same.
This fixes ClassCanBeStatic warnings
qTime is a (primitive) long and is always 0 by default. This could be also fixed by changing qTime type to Long. In the case of fromHumanReadableUnits(), the method will throw an AssertionError or NumberFormatException for invalid types, and cannot return a (primitive) double that is null.
Add new error-prone rules to the list without enabling them.
risdenk
approved these changes
Nov 13, 2024
risdenk
reviewed
Nov 13, 2024
Contributor
risdenk
left a comment
There was a problem hiding this comment.
Added notes going through the new rules. Most can be ignored.
| '-Xep:MathRoundIntLong:ERROR', | ||
| // '-Xep:MislabeledAndroidString:OFF', // we don't use android | ||
| '-Xep:MisplacedScopeAnnotations:ERROR', | ||
| // '-Xep:MissingRuntimeRetention:ERROR', // todo check if useful or comment why not |
Contributor
There was a problem hiding this comment.
We don't use guice so this can be ignored.
| '-Xep:RandomCast:ERROR', | ||
| '-Xep:RandomModInteger:ERROR', | ||
| // '-Xep:RectIntersectReturnValueIgnored:OFF', // we don't use android | ||
| // '-Xep:RedundantSetterCall:ERROR', // todo check if useful or comment why not |
| '-Xep:SelfAssignment:ERROR', | ||
| '-Xep:SelfComparison:ERROR', | ||
| '-Xep:SelfEquals:ERROR', | ||
| // '-Xep:SetUnrecognized:ERROR', // todo check if useful or comment why not |
Contributor
There was a problem hiding this comment.
We don't use proto so can be ignored
| // '-Xep:RequiredModifiers:OFF', // we don't use this annotation | ||
| // '-Xep:RestrictedApiChecker:OFF', // we don't use this annotation | ||
| // '-Xep:ReturnValueIgnored:OFF', // todo there are problems that should be fixed | ||
| // '-Xep:SelfAssertion:ERROR', // todo check if useful or comment why not |
Contributor
There was a problem hiding this comment.
We don't use truth so can be ignored
| '-Xep:AssertionFailureIgnored:WARN', | ||
| '-Xep:AssistedInjectAndInjectOnSameConstructor:WARN', | ||
| '-Xep:AttemptedNegativeZero:WARN', | ||
| // '-Xep:AutoValueBoxedValues:WARN', // todo check if useful or comment why not |
| '-Xep:StringCharset:WARN', | ||
| '-Xep:StringFormatWithLiteral:WARN', | ||
| // '-Xep:StringSplitter:OFF', // todo check if useful or comment why not - might be able to use forbidden-apis for this? | ||
| // '-Xep:SunApi:WARN', // todo check if useful or comment why not |
| '-Xep:StringFormatWithLiteral:WARN', | ||
| // '-Xep:StringSplitter:OFF', // todo check if useful or comment why not - might be able to use forbidden-apis for this? | ||
| // '-Xep:SunApi:WARN', // todo check if useful or comment why not | ||
| // '-Xep:SuperCallToObjectMethod:WARN', // todo check if useful or comment why not |
| '-Xep:SuperEqualsIsObjectEquals:WARN', | ||
| // '-Xep:SwigMemoryLeak:OFF', // we don't use swig | ||
| // '-Xep:SynchronizeOnNonFinalField:OFF', // todo check if useful or comment why not | ||
| // '-Xep:SystemConsoleNull:WARN', // todo check if useful or comment why not |
| // '-Xep:UnicodeEscape:OFF', // can't enable since Lucene/Solr tests use unicode a bunch | ||
| // '-Xep:UnnecessaryAssignment:OFF', // we don't use these annotations | ||
| '-Xep:UnnecessaryAsync:WARN', | ||
| // '-Xep:UnnecessaryBreakInSwitch:WARN', // todo check if useful or comment why not |
Contributor
There was a problem hiding this comment.
Not sure this is useful or just subjective
| // '-Xep:UseBinds:OFF', // we don't use this annotation | ||
| // '-Xep:UseCorrectAssertInTests:OFF', // we inherit from LuceneTestCase which extends Assert | ||
| '-Xep:VariableNameSameAsType:WARN', | ||
| // '-Xep:VoidUsed:WARN', // todo check if useful or comment why not |
Contributor
Author
|
Thanks for the notes @risdenk. I will soon create another PR for applying the rules and see what can be backported as well. We can then address the existing rules as well. Is it fine to do it under the context of SOLR-16427? |
Contributor
|
Yes I think so that jira should probably be closed as "mostly done" by now anyway :D |
7 tasks
malliaridis
added a commit
to malliaridis/solr
that referenced
this pull request
Nov 13, 2024
* Update com.google.errorprone:* to 2.31.0 * Remove impossible null comparison * Suppress wanted method references * Fix ClassCanBeStatic warnings * Remove null checks for primitive data types (cherry picked from commit f6c5af9)
7 tasks
malliaridis
added a commit
that referenced
this pull request
Nov 15, 2024
* Update com.google.errorprone:* to 2.31.0 (#2862) * Update com.google.errorprone:* to 2.31.0 * Remove impossible null comparison * Suppress wanted method references * Fix ClassCanBeStatic warnings * Remove null checks for primitive data types (cherry picked from commit f6c5af9) * Remove unsupported static declaration of inner classes from cherry-pick
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.
Description
This PR updates Google error-prone to 2.31.0.
Solution
In order to avoid blocking #2706 I have updated Google error-prone and added all new checks introduced between 2.23.0 and 2.31.0 without enabling them to
gradle/validation/error-prone.gradle. Enabling the new rules should be handled in a separate PR as this may require further evaluation and compatibility check and would further delay #2706.The selected version 2.31.0 is the last version of error-prone that fully supports JDK 11, so this PR should be backwards compatible. Note that some new rules are not applicable to JDK 11 and should carefully be picked upon activation.
Some of the existing rules seem to have had some changes that caused existing checks to fail. For the affected code, I decided individually wether to suppress the warning or fix the code.
See commit details for additional information about individual changes.
Tests
Some tests were affected by this update and were updated. The updates include assertions that were checking primitive data types for nullability and were therefore removed.
Checklist
Please review the following and check all that apply:
mainbranch../gradlew check.