Skip to content

Commit

Permalink
upgrade error-prone to 2.7.1 and support checks with Java 11+
Browse files Browse the repository at this point in the history
- upgrade error-prone to 2.7.1
- support running error-prone with Java 11 and above using -Xplugin
  instead of custom compiler
- add compiler arguments to ignore warnings/errors in Java 15/16
- introduce strictCompile property to enable strict profiles since we
  now need multiple strict profiles for Java 8
- properly exclude all generated source files from error-prone
- fix druid-processing overriding annotation processors from parent pom
- fix druid-core disabling most non-default checks
- align plugin and annotation errorprone versions
- fix / suppress additional issues found by error-prone:
  * fix bug in SeekableStreamSupervisor initializing ArrayList size with
    the taskGroupdId
  * fix missing @OverRide annotations
- remove outdated compiler plugin in benchmarks
- remove deleted ParameterPackage error-prone rule
- re-enable checks on benchmark module as well
  • Loading branch information
xvrl committed Jun 14, 2021
1 parent 6b272c8 commit be55323
Show file tree
Hide file tree
Showing 25 changed files with 250 additions and 201 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -114,8 +114,8 @@ jobs:
install: skip
# Strict compilation requires more than 2 GB
script: >
./check_test_suite.py && travis_terminate 0 || MAVEN_OPTS='-Xmx3000m' ${MVN} clean -Pstrict compile test-compile --fail-at-end
-pl '!benchmarks' ${MAVEN_SKIP} ${MAVEN_SKIP_TESTS}
./check_test_suite.py && travis_terminate 0 || MAVEN_OPTS='-Xmx3000m' ${MVN} clean -DstrictCompile compile test-compile --fail-at-end
${MAVEN_SKIP} ${MAVEN_SKIP_TESTS}
- name: "analyze dependencies"
script: |-
Expand Down
10 changes: 0 additions & 10 deletions benchmarks/pom.xml
Expand Up @@ -192,16 +192,6 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<compilerVersion>${javac.target}</compilerVersion>
<source>${javac.target}</source>
<target>${javac.target}</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-assembly-plugin</artifactId>
Expand Down
20 changes: 0 additions & 20 deletions core/pom.xml
Expand Up @@ -429,24 +429,4 @@
</resource>
</resources>
</build>

<profiles>
<profile>
<id>strict</id>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<compilerArgs>
<!-- Antlr-generated classes miss @Override, that is not easy to fix -->
<arg>-Xep:MissingOverride:WARN</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
Expand Up @@ -113,6 +113,7 @@ public byte[] encrypt(byte[] plain)

SecretKey tmp = getKeyFromPassword(passPhrase, salt);
SecretKey secret = new SecretKeySpec(tmp.getEncoded(), cipherAlgName);
@SuppressWarnings("InsecureCryptoUsage")
Cipher ecipher = Cipher.getInstance(transformation);
ecipher.init(Cipher.ENCRYPT_MODE, secret);
return new EncryptedData(
Expand All @@ -133,7 +134,7 @@ public byte[] decrypt(byte[] data)

SecretKey tmp = getKeyFromPassword(passPhrase, encryptedData.getSalt());
SecretKey secret = new SecretKeySpec(tmp.getEncoded(), cipherAlgName);

@SuppressWarnings("InsecureCryptoUsage")
Cipher dcipher = Cipher.getInstance(transformation);
dcipher.init(Cipher.DECRYPT_MODE, secret, new IvParameterSpec(encryptedData.getIv()));
return dcipher.doFinal(encryptedData.getCipher());
Expand Down
Expand Up @@ -27,7 +27,7 @@
import java.util.Objects;

// logical operators live here

@SuppressWarnings("ClassName")
class BinLtExpr extends BinaryEvalOpExprBase
{
BinLtExpr(String op, Expr left, Expr right)
Expand Down Expand Up @@ -84,6 +84,7 @@ public <T> ExprVectorProcessor<T> buildVectorized(VectorInputBindingInspector in
}
}

@SuppressWarnings("ClassName")
class BinLeqExpr extends BinaryEvalOpExprBase
{
BinLeqExpr(String op, Expr left, Expr right)
Expand Down Expand Up @@ -140,6 +141,7 @@ public <T> ExprVectorProcessor<T> buildVectorized(VectorInputBindingInspector in
}
}

@SuppressWarnings("ClassName")
class BinGtExpr extends BinaryEvalOpExprBase
{
BinGtExpr(String op, Expr left, Expr right)
Expand Down Expand Up @@ -195,6 +197,7 @@ public <T> ExprVectorProcessor<T> buildVectorized(VectorInputBindingInspector in
}
}

@SuppressWarnings("ClassName")
class BinGeqExpr extends BinaryEvalOpExprBase
{
BinGeqExpr(String op, Expr left, Expr right)
Expand Down Expand Up @@ -251,6 +254,7 @@ public <T> ExprVectorProcessor<T> buildVectorized(VectorInputBindingInspector in
}
}

@SuppressWarnings("ClassName")
class BinEqExpr extends BinaryEvalOpExprBase
{
BinEqExpr(String op, Expr left, Expr right)
Expand Down Expand Up @@ -306,6 +310,7 @@ public <T> ExprVectorProcessor<T> buildVectorized(VectorInputBindingInspector in
}
}

@SuppressWarnings("ClassName")
class BinNeqExpr extends BinaryEvalOpExprBase
{
BinNeqExpr(String op, Expr left, Expr right)
Expand Down Expand Up @@ -361,6 +366,7 @@ public <T> ExprVectorProcessor<T> buildVectorized(VectorInputBindingInspector in
}
}

@SuppressWarnings("ClassName")
class BinAndExpr extends BinaryOpExprBase
{
BinAndExpr(String op, Expr left, Expr right)
Expand Down
Expand Up @@ -30,6 +30,7 @@

// math operators live here

@SuppressWarnings("ClassName")
final class BinPlusExpr extends BinaryEvalOpExprBase
{
BinPlusExpr(String op, Expr left, Expr right)
Expand Down Expand Up @@ -81,6 +82,7 @@ public <T> ExprVectorProcessor<T> buildVectorized(VectorInputBindingInspector in
}
}

@SuppressWarnings("ClassName")
final class BinMinusExpr extends BinaryEvalOpExprBase
{
BinMinusExpr(String op, Expr left, Expr right)
Expand Down Expand Up @@ -119,6 +121,7 @@ public <T> ExprVectorProcessor<T> buildVectorized(VectorInputBindingInspector in
}
}

@SuppressWarnings("ClassName")
final class BinMulExpr extends BinaryEvalOpExprBase
{
BinMulExpr(String op, Expr left, Expr right)
Expand Down Expand Up @@ -157,6 +160,7 @@ public <T> ExprVectorProcessor<T> buildVectorized(VectorInputBindingInspector in
}
}

@SuppressWarnings("ClassName")
final class BinDivExpr extends BinaryEvalOpExprBase
{
BinDivExpr(String op, Expr left, Expr right)
Expand Down Expand Up @@ -195,6 +199,7 @@ public <T> ExprVectorProcessor<T> buildVectorized(VectorInputBindingInspector in
}
}

@SuppressWarnings("ClassName")
class BinPowExpr extends BinaryEvalOpExprBase
{
BinPowExpr(String op, Expr left, Expr right)
Expand Down Expand Up @@ -233,6 +238,7 @@ public <T> ExprVectorProcessor<T> buildVectorized(VectorInputBindingInspector in
}
}

@SuppressWarnings("ClassName")
class BinModuloExpr extends BinaryEvalOpExprBase
{
BinModuloExpr(String op, Expr left, Expr right)
Expand Down
Expand Up @@ -33,6 +33,7 @@
* Note: all concrete subclass of this should have constructor with the form of <init>(String, Expr, Expr)
* if it's not possible, just be sure Evals.binaryOp() can handle that
*/
@SuppressWarnings("ClassName")
abstract class BinaryOpExprBase implements Expr
{
protected final String op;
Expand Down Expand Up @@ -112,6 +113,7 @@ public int hashCode()
* Base class for numerical binary operators, with additional methods defined to evaluate primitive values directly
* instead of wrapped with {@link ExprEval}
*/
@SuppressWarnings("ClassName")
abstract class BinaryEvalOpExprBase extends BinaryOpExprBase
{
BinaryEvalOpExprBase(String op, Expr left, Expr right)
Expand Down
Expand Up @@ -30,6 +30,7 @@
import java.util.Set;
import java.util.stream.Collectors;

@SuppressWarnings("ClassName")
class LambdaExpr implements Expr
{
private final ImmutableList<IdentifierExpr> args;
Expand Down Expand Up @@ -150,6 +151,7 @@ public int hashCode()
* list of arguments that are passed to the {@link Function} along with the {@link Expr.ObjectBinding} when it is
* evaluated.
*/
@SuppressWarnings("ClassName")
class FunctionExpr implements Expr
{
final Function function;
Expand Down Expand Up @@ -247,6 +249,7 @@ public int hashCode()
* {@link LambdaExpr} and the list of {@link Expr} arguments that are combined with {@link Expr.ObjectBinding} to
* evaluate the {@link LambdaExpr}.
*/
@SuppressWarnings("ClassName")
class ApplyFunctionExpr implements Expr
{
final ApplyFunction function;
Expand Down
Expand Up @@ -32,6 +32,7 @@
/**
* Base type for all single argument operators, with a single {@link Expr} child for the operand.
*/
@SuppressWarnings("ClassName")
abstract class UnaryExpr implements Expr
{
final String op;
Expand Down Expand Up @@ -102,6 +103,7 @@ public String toString()
}
}

@SuppressWarnings("ClassName")
class UnaryMinusExpr extends UnaryExpr
{
UnaryMinusExpr(String op, Expr expr)
Expand Down Expand Up @@ -144,6 +146,7 @@ public <T> ExprVectorProcessor<T> buildVectorized(VectorInputBindingInspector in
}
}

@SuppressWarnings("ClassName")
class UnaryNotExpr extends UnaryExpr
{
UnaryNotExpr(String op, Expr expr)
Expand Down
Expand Up @@ -204,7 +204,7 @@ public void testFormatsForNumberBasedTimestamp()
expectedDt, parser.apply(yearMonth));

// Friday, May 15, 2020 8:20:40 PM GMT
long millis = 1589574040000l;
long millis = 1589574040000L;
expectedDt = DateTimes.of("2020-05-15T20:20:40.000Z");

parser = TimestampParser.createObjectTimestampParser("millis");
Expand All @@ -219,7 +219,7 @@ public void testFormatsForNumberBasedTimestamp()
Assert.assertEquals("Timestamp of format posix not parsed correctly",
expectedDt, parser.apply(posix));

long micro = 1589574040000000l;
long micro = 1589574040000000L;
parser = TimestampParser.createObjectTimestampParser("micro");
Assert.assertEquals("Timestamp of format micro not parsed correctly",
expectedDt, parser.apply(micro));
Expand Down
Expand Up @@ -165,6 +165,7 @@ public List reverseFetchKeys(Object value)
}

@Override
@SuppressWarnings("EqualsHashCode")
public boolean equals(Object obj)
{
return obj instanceof MockDataFetcher;
Expand Down
Expand Up @@ -103,6 +103,7 @@ public List reverseFetchKeys(Object value)
}

@Override
@SuppressWarnings("EqualsHashCode")
public boolean equals(Object obj)
{
return obj instanceof MockDataFetcher;
Expand Down
Expand Up @@ -102,6 +102,7 @@ public List reverseFetchKeys(Object value)
}

@Override
@SuppressWarnings("EqualsHashCode")
public boolean equals(Object obj)
{
return obj instanceof MockDataFetcher;
Expand Down

0 comments on commit be55323

Please sign in to comment.