-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix error prone warnings #2316
Fix error prone warnings #2316
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for doing this!
extras/src/main/java/com/google/gson/graph/GraphAdapterBuilder.java
Outdated
Show resolved
Hide resolved
@@ -98,7 +98,7 @@ | |||
<compilerArgs> | |||
<!-- Args related to Error Prone, see: https://errorprone.info/docs/installation#maven --> | |||
<arg>-XDcompilePolicy=simple</arg> | |||
<arg>-Xplugin:ErrorProne</arg> | |||
<arg>-Xplugin:ErrorProne -XepExcludedPaths:.*gson/src/test.*|.*extras/src/test.*|.*proto.*</arg> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eventually we might want to have the tests pass Error Prone too, but I agree that is a much lower priority.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry to bring this up again, but would you mind fixing (respectively removing) the incorrect @SuppressWarnings("TruthSelfEquals")
suppressions as mentioned in https://github.com/google/gson/pull/2308/files#r1096471723 (simply change it to a.equals(a)
for now)? The warnings are true-positives; regardless of whether guava-testlib
will be added in the future, the current test code on master
is incorrect and the @SuppressWarnings
hide that, suggesting the code is correct.
My concern is that we forget about this, or for whatever reason guava-testlib
is not integrated, and in that case the incorrect code remains unnoticed.
@@ -98,7 +98,7 @@ | |||
<compilerArgs> | |||
<!-- Args related to Error Prone, see: https://errorprone.info/docs/installation#maven --> | |||
<arg>-XDcompilePolicy=simple</arg> | |||
<arg>-Xplugin:ErrorProne</arg> | |||
<arg>-Xplugin:ErrorProne -XepExcludedPaths:.*gson/src/test.*|.*extras/src/test.*|.*proto.*</arg> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it intended that you disable warnings for the complete proto
module? Maybe it would be better to only disable warnings for the generated source code, as suggested in #2308 (comment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to go ahead and merge this anyway, but we could indeed consider refining the pattern here.
This reverts commit 387746c.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm merging this snapshot under the assumption that if there are further changes in the pipeline they can just be applied in a followup PR.
@@ -98,7 +98,7 @@ | |||
<compilerArgs> | |||
<!-- Args related to Error Prone, see: https://errorprone.info/docs/installation#maven --> | |||
<arg>-XDcompilePolicy=simple</arg> | |||
<arg>-Xplugin:ErrorProne</arg> | |||
<arg>-Xplugin:ErrorProne -XepExcludedPaths:.*gson/src/test.*|.*extras/src/test.*|.*proto.*</arg> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to go ahead and merge this anyway, but we could indeed consider refining the pattern here.
* Fix `OperatorPrecedence` warn in `JsonWriter#close` * Fix `ReferenceEquality` warn in `LinkedTreeMap#replaceInParent` * Fix `UnnecessaryParentheses` warn in `LinkedTreeMap#replaceInParent` * Fix `ReferenceEquality` warn in `LinkedTreeMap#hasNext` * Fix `ReferenceEquality` warn in `LinkedTreeMap#nextNode` * Adds `error_prone_annotations` to the `pom.xml` of `gson` * Fix `InlineMeSuggester` warns in `JsonParser` * Fix `UnnecessaryParentheses` warns in `ConstructorConstructor#newDefaultImplementationConstructor` * Fix `ThreadLocalUsage` warn in `Gson` * Fix `JdkObsolete` warn in `GsonBuilder` * Fix `ReferenceEquality` warn in `LazilyParsedNumber#equals` * Fix `OperatorPrecedence` warn in `TreeTypeAdapter#create` * Fix `OperatorPrecedence` warn in `ArrayTypeAdapter` * Fix `UnnecessaryParentheses` warn in `TypeAdapters` * Adds `-XepExcludedPaths` flag to ErrorProne plugin to exclude tests and proto path * Fix `ClassNewInstance` warn in `InterceptorAdapter` * Fix `ThreadLocalUsage` warn in `GraphAdapterBuilder` * Fix `JdkObsolete` warn in `GraphAdapterBuilder` * Revert "Adds `error_prone_annotations` to the `pom.xml` of `gson`" This reverts commit 14af14d. * Revert "Fix `InlineMeSuggester` warns in `JsonParser`" This reverts commit 095bfd5. * Adds `@SuppressWarnings("ThreadLocalUsage")` * Fix `OperatorPrecedence` in `JsonWriter` * Revert "Fix `ReferenceEquality` warn in `LinkedTreeMap#nextNode`" This reverts commit 387746c. * Adds `@SuppressWarnings("ReferenceEquality")` * Adds `guava-testlib` to the gson `pom.xml` * `@SuppressWarnings("TruthSelfEquals")` removed to use `EqualsTester()`
In this PR I have fixed some ErrorProne warns.
I have also add the flag
-XepExcludedPaths:
to the ErrorProne plugin to exclude tests and proto path