upgrade Error Prone to 2.11 (requires Java 11) (#12306)

The latest version of Error Prone now requires Java 11. Upgrading means we can
remove a lot of the maven profile complexity required to run checks with Java 8.
This also requires switching our strict build to use Java 11.

* update error-prone to 2.11
* remove need for specific maven profiles for Java 8 and Java 15
* fix additional Error Prone warnings with Java 11
* update strict build to use Java 11
This commit is contained in:
Xavier Léauté 2022-03-14 19:40:48 -07:00 committed by GitHub
parent b5195c5095
commit 5d02a91faa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 19 additions and 63 deletions

View File

@ -110,8 +110,10 @@ jobs:
# who watches the watchers? # who watches the watchers?
script: ./check_test_suite_test.py script: ./check_test_suite_test.py
- name: "(openjdk8) strict compilation" - name: "(openjdk11) strict compilation"
install: skip install: skip
# errorprone requires JDK 11
jdk: openjdk11
# Strict compilation requires more than 2 GB # Strict compilation requires more than 2 GB
script: > script: >
./check_test_suite.py && travis_terminate 0 || MAVEN_OPTS='-Xmx3000m' ${MVN} clean -DstrictCompile compile test-compile --fail-at-end ./check_test_suite.py && travis_terminate 0 || MAVEN_OPTS='-Xmx3000m' ${MVN} clean -DstrictCompile compile test-compile --fail-at-end

View File

@ -235,6 +235,7 @@ public class JsonConfigurator
} }
@VisibleForTesting @VisibleForTesting
@SuppressWarnings("ReturnValueIgnored")
public static <T> void verifyClazzIsConfigurable( public static <T> void verifyClazzIsConfigurable(
ObjectMapper mapper, ObjectMapper mapper,
Class<T> clazz, Class<T> clazz,

View File

@ -74,6 +74,7 @@ public class ThriftInputRowParser implements InputRowParser<Object>
this.dimensions = parseSpec.getDimensionsSpec().getDimensionNames(); this.dimensions = parseSpec.getDimensionsSpec().getDimensionNames();
} }
@SuppressWarnings("ReturnValueIgnored")
public Class<TBase> getThriftClass() public Class<TBase> getThriftClass()
throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException throws IOException, ClassNotFoundException, IllegalAccessException, InstantiationException
{ {

View File

@ -343,7 +343,7 @@ name: Error Prone Annotations
license_category: binary license_category: binary
module: java-core module: java-core
license_name: Apache License version 2.0 license_name: Apache License version 2.0
version: 2.8.0 version: 2.11.0
libraries: libraries:
- com.google.errorprone: error_prone_annotations - com.google.errorprone: error_prone_annotations

74
pom.xml
View File

@ -88,7 +88,7 @@
<datasketches.memory.version>2.0.0</datasketches.memory.version> <datasketches.memory.version>2.0.0</datasketches.memory.version>
<derby.version>10.14.2.0</derby.version> <derby.version>10.14.2.0</derby.version>
<dropwizard.metrics.version>4.0.0</dropwizard.metrics.version> <dropwizard.metrics.version>4.0.0</dropwizard.metrics.version>
<errorprone.version>2.8.0</errorprone.version> <errorprone.version>2.11.0</errorprone.version>
<fastutil.version>8.5.4</fastutil.version> <fastutil.version>8.5.4</fastutil.version>
<guava.version>16.0.1</guava.version> <guava.version>16.0.1</guava.version>
<guice.version>4.1.0</guice.version> <guice.version>4.1.0</guice.version>
@ -1665,12 +1665,22 @@
<fork>true</fork> <fork>true</fork>
<meminitial>1024m</meminitial> <meminitial>1024m</meminitial>
<maxmem>3000m</maxmem> <maxmem>3000m</maxmem>
<source>${maven.compiler.source}</source> <release>${java.version}</release>
<target>${maven.compiler.target}</target>
<showWarnings>false</showWarnings> <showWarnings>false</showWarnings>
<compilerArgs> <compilerArgs>
<arg>-XDcompilePolicy=simple</arg> <arg>-XDcompilePolicy=simple</arg>
<arg>-Xplugin:ErrorProne -XepExcludedPaths:.*/target/generated-(test-)?sources/.* -XepDisableWarningsInGeneratedCode -Xep:ClassCanBeStatic:ERROR -Xep:PreconditionsInvalidPlaceholder:ERROR -Xep:MissingOverride:ERROR -Xep:DefaultCharset:ERROR -Xep:QualifierOrScopeOnInjectMethod:ERROR -Xep:AssistedInjectAndInjectOnSameConstructor -Xep:AutoFactoryAtInject -Xep:ClassName -Xep:ComparisonContractViolated -Xep:DepAnn -Xep:DivZero -Xep:EmptyIf -Xep:InjectInvalidTargetingOnScopingAnnotation -Xep:InjectMoreThanOneQualifier -Xep:InjectScopeAnnotationOnInterfaceOrAbstractClass -Xep:InjectScopeOrQualifierAnnotationRetention -Xep:InjectedConstructorAnnotations -Xep:InsecureCryptoUsage -Xep:JMockTestWithoutRunWithOrRuleAnnotation -Xep:JavaxInjectOnFinalField -Xep:LockMethodChecker -Xep:LongLiteralLowerCaseSuffix -Xep:NoAllocation -Xep:NonRuntimeAnnotation -Xep:NumericEquality -Xep:ProtoStringFieldReferenceEquality -Xep:UnlockMethod</arg> <arg>-Xplugin:ErrorProne -XepExcludedPaths:.*/target/generated-(test-)?sources/.* -XepDisableWarningsInGeneratedCode -Xep:ClassCanBeStatic:ERROR -Xep:PreconditionsInvalidPlaceholder:ERROR -Xep:MissingOverride:ERROR -Xep:DefaultCharset:ERROR -Xep:QualifierOrScopeOnInjectMethod:ERROR -Xep:AssistedInjectAndInjectOnSameConstructor -Xep:AutoFactoryAtInject -Xep:ClassName -Xep:ComparisonContractViolated -Xep:DepAnn -Xep:DivZero -Xep:EmptyIf -Xep:InjectInvalidTargetingOnScopingAnnotation -Xep:InjectMoreThanOneQualifier -Xep:InjectScopeAnnotationOnInterfaceOrAbstractClass -Xep:InjectScopeOrQualifierAnnotationRetention -Xep:InjectedConstructorAnnotations -Xep:InsecureCryptoUsage -Xep:JMockTestWithoutRunWithOrRuleAnnotation -Xep:JavaxInjectOnFinalField -Xep:LockMethodChecker -Xep:LongLiteralLowerCaseSuffix -Xep:NoAllocation -Xep:NonRuntimeAnnotation -Xep:NumericEquality -Xep:ProtoStringFieldReferenceEquality -Xep:UnlockMethod</arg>
<!-- Error Prone requires exemptions for Java >= 16, see https://errorprone.info/docs/installation#maven -->
<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>
</compilerArgs> </compilerArgs>
<annotationProcessorPaths> <annotationProcessorPaths>
<path> <path>
@ -1684,64 +1694,6 @@
</plugins> </plugins>
</build> </build>
</profile> </profile>
<profile>
<id>strict-java-15+</id>
<activation>
<jdk>[15,)</jdk>
<property>
<name>strictCompile</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<release>${java.version}</release>
<compilerArgs combine.children="append">
<!-- Error Prone requires exemptions for Java 16, see https://errorprone.info/docs/installation#jdk-16 -->
<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>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<!-- using github.com/google/error-prone-javac is required when running on JDK 8
see https://errorprone.info/docs/installation#jdk-8 -->
<profile>
<id>strict-java-8</id>
<activation>
<jdk>1.8</jdk>
<property>
<name>strictCompile</name>
</property>
</activation>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<fork>true</fork>
<compilerArgs combine.children="append">
<arg>-J-Xbootclasspath/p:${settings.localRepository}/com/google/errorprone/javac/9+181-r4173-1/javac-9+181-r4173-1.jar</arg>
</compilerArgs>
</configuration>
</plugin>
</plugins>
</build>
</profile>
<profile> <profile>
<id>parallel-test</id> <id>parallel-test</id>
<activation> <activation>