-
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
Adds Error Prone to the maven-compiler-plugin
#2308
Changes from 5 commits
a5a5e52
9910d47
61771d0
d14d61f
0be7801
4fa7b35
f1206b7
fa641c0
5faa528
89f6e39
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ public void testEqualsOnEmptyArray() { | |
} | ||
|
||
@Test | ||
@SuppressWarnings("TruthSelfEquals") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be suppressed, see its description.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In #2299, Éamonn said we could use I never use I assume we could use some like: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, right. Personally I think for this PR it would be best to omit these suppressions and change the code to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, sorry, I should have been more explicit. That is exactly what you can write, and alternatively you can have just one test method with all the different kinds of objects in different equality groups. Something like this: new EqualsTester()
.addEqualityGroup(array1, array2) // with equal contents
.addEqualityGroup(array3, array4) // equal to each other but not array1 or array2
.addEqualityGroup(object1, object2)
...
.testEquals();
I think that would be a fine project for a separate PR. |
||
public void testEqualsNonEmptyArray() { | ||
JsonArray a = new JsonArray(); | ||
JsonArray b = new JsonArray(); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,6 +163,7 @@ public void testEqualsOnEmptyObject() { | |
} | ||
|
||
@Test | ||
@SuppressWarnings("TruthSelfEquals") | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be suppressed, see its description. |
||
public void testEqualsNonEmptyObject() { | ||
JsonObject a = new JsonObject(); | ||
JsonObject b = new JsonObject(); | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -94,12 +94,31 @@ | |||||
<configuration> | ||||||
<showWarnings>true</showWarnings> | ||||||
<showDeprecation>true</showDeprecation> | ||||||
<failOnWarning>true</failOnWarning> | ||||||
<fork>true</fork> | ||||||
<compilerArgs> | ||||||
<arg>-XDcompilePolicy=simple</arg> | ||||||
MaicolAntali marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
<arg>-Xplugin:ErrorProne</arg> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should probably suppress warnings for classes generated by
Suggested change
Error Prone's |
||||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED</arg> | ||||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED</arg> | ||||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED</arg> | ||||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED</arg> | ||||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED</arg> | ||||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED</arg> | ||||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED</arg> | ||||||
<arg>-J--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED</arg> | ||||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED</arg> | ||||||
<arg>-J--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED</arg> | ||||||
<!-- Enable all warnings, except for ones which cause issues when building with newer JDKs, see also | ||||||
https://docs.oracle.com/en/java/javase/11/tools/javac.html --> | ||||||
<compilerArg>-Xlint:all,-options</compilerArg> | ||||||
</compilerArgs> | ||||||
<annotationProcessorPaths> | ||||||
<path> | ||||||
<groupId>com.google.errorprone</groupId> | ||||||
<artifactId>error_prone_core</artifactId> | ||||||
<version>2.18.0</version> | ||||||
</path> | ||||||
</annotationProcessorPaths> | ||||||
<jdkToolchain> | ||||||
<version>[11,)</version> | ||||||
</jdkToolchain> | ||||||
|
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.
Maybe for consistency the indentation for the complete file should be fixed? This file is not that long and the previous JUnit changes already caused some inconsistent indentation within this file too.
Or Éamonn would you prefer not to have this as part of this PR?
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 fine either way. If @MaicolAntali prefers to add suppressions in this PR and remove them later by fixing the code in one or more later PRs, that seems like a good approach.