Skip to content

Commit

Permalink
Upgrade Error Prone to 2.12.0
Browse files Browse the repository at this point in the history
`DoubleBraceInitialization` got upgraded to ERROR by default, so we can
remove it from the list of checks upgraded explicitly.

There is a bunch of spurious warnings about unread fields, which are
used in tests in a declarative way. Also, two comparison of `Boolean`
values using identity comparison, which should be OK (`Boolean` is
always interned), but let's make unboxing explicit.
  • Loading branch information
ksobolew authored and kokosing committed Apr 25, 2022
1 parent 6f4b4c5 commit e0b24a1
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,8 @@ public void testBinaryOperatorsBoolean()
assertExecute("nullif(cast(null as boolean), true)", BOOLEAN, null);
for (Boolean left : booleanValues) {
for (Boolean right : booleanValues) {
assertExecute(generateExpression("%s = %s", left, right), BOOLEAN, left == null || right == null ? null : left == right);
assertExecute(generateExpression("%s <> %s", left, right), BOOLEAN, left == null || right == null ? null : left != right);
assertExecute(generateExpression("%s = %s", left, right), BOOLEAN, left == null || right == null ? null : left.equals(right));
assertExecute(generateExpression("%s <> %s", left, right), BOOLEAN, left == null || right == null ? null : !left.equals(right));

assertExecute(generateExpression("nullif(%s, %s)", left, right), BOOLEAN, nullIf(left, right));
assertExecute(generateExpression("%s is distinct from %s", left, right), BOOLEAN, !Objects.equals(left, right));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,11 +75,13 @@ public class TestSerDeUtils
{
private final BlockEncodingSerde blockEncodingSerde = new TestingBlockEncodingSerde();

@SuppressWarnings("UnusedVariable") // these fields are serialized to a Block and verified there
private static class ListHolder
{
List<InnerStruct> array;
}

@SuppressWarnings("UnusedVariable") // these fields are serialized to a Block and verified there
private static class InnerStruct
{
public InnerStruct(Integer intVal, Long longVal)
Expand All @@ -92,6 +94,7 @@ public InnerStruct(Integer intVal, Long longVal)
Long longVal;
}

@SuppressWarnings("UnusedVariable") // these fields are serialized to a Block and verified there
private static class OuterStruct
{
Byte byteVal;
Expand Down
3 changes: 1 addition & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<dep.scribejava.version>6.9.0</dep.scribejava.version>
<dep.tempto.version>187</dep.tempto.version>
<dep.gcs.version>2.0.0</dep.gcs.version>
<dep.errorprone.version>2.11.0</dep.errorprone.version>
<dep.errorprone.version>2.12.0</dep.errorprone.version>
<dep.testcontainers.version>1.16.3</dep.testcontainers.version>
<dep.duct-tape.version>1.0.8</dep.duct-tape.version>
<dep.docker-java.version>3.2.12</dep.docker-java.version>
Expand Down Expand Up @@ -1880,7 +1880,6 @@
-Xep:BoxedPrimitiveConstructor:ERROR \
-Xep:ClassCanBeStatic:ERROR \
-Xep:CompareToZero:ERROR \
-Xep:DoubleBraceInitialization:ERROR \
-Xep:EqualsGetClass:OFF <!-- we would rather want the opposite check --> \
-Xep:EqualsIncompatibleType:ERROR \
-Xep:FallThrough:ERROR \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ public void shouldFormatOptionalValues()
assertThat(OptionsPrinter.format(new OptionalFields(null))).isEqualTo("");
}

@SuppressWarnings("UnusedVariable") // these fields are used for validation testing
private static class Options
{
@Option(names = "--value", paramLabel = "<value>", description = "Test value")
Expand All @@ -94,6 +95,7 @@ public Options(String value, boolean valueBoolean, List<String> arguments)
}
}

@SuppressWarnings("UnusedVariable") // these fields are used for validation testing
private static class NegatableOptions
{
@Option(names = "--no-negatable", paramLabel = "<boolean>", description = "Test value boolean", negatable = true)
Expand All @@ -105,6 +107,7 @@ public NegatableOptions(boolean valueBoolean)
}
}

@SuppressWarnings("UnusedVariable") // these fields are used for validation testing
private static class OptionalFields
{
@Option(names = "--value", paramLabel = "<value>", description = "Test optional value")
Expand Down

0 comments on commit e0b24a1

Please sign in to comment.