Skip to content
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

Improvement: Bump errorprone to 2.11.0 #2069

Merged
merged 8 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion baseline-error-prone/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ apply plugin: 'com.palantir.external-publish-jar'

dependencies {
implementation 'com.google.errorprone:error_prone_core'
implementation 'org.mockito:mockito-errorprone'
// bring back mockito-errorprone once it is updated for 2.11.0+
//implementation 'org.mockito:mockito-errorprone'

testImplementation gradleApi()
testImplementation 'com.palantir.tokens:auth-tokens'
Expand Down Expand Up @@ -57,3 +58,19 @@ javaVersion {
target = 11
runtime = 11
}

moduleJvmArgs {
exports = [
'jdk.compiler/com.sun.tools.javac.api',
'jdk.compiler/com.sun.tools.javac.file',
'jdk.compiler/com.sun.tools.javac.code',
'jdk.compiler/com.sun.tools.javac.util',
'jdk.compiler/com.sun.tools.javac.comp',
'jdk.compiler/com.sun.tools.javac.main',
'jdk.compiler/com.sun.tools.javac.model',
'jdk.compiler/com.sun.tools.javac.parser',
'jdk.compiler/com.sun.tools.javac.processing',
'jdk.compiler/com.sun.tools.javac.tree',
'jdk.compiler/com.sun.tools.javac.util'
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "AfterburnerJavaIncompatibility",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "AssertNoArgs",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.WARNING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "AutoCloseableMustBeClosed",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = SeverityLevel.SUGGESTION,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "AvoidNewHashMapInt",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.WARNING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "BadAssert",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = LinkType.CUSTOM,
severity = SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "BugCheckerAutoService",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
summary = "Concrete BugChecker implementations should be annotated "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "CatchBlockLogException",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = LinkType.CUSTOM,
severity = SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "CatchSpecificity",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.WARNING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "ClassInitializationDeadlock",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "CollectionStreamForEach",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.WARNING,
Expand All @@ -51,7 +50,7 @@ public final class CollectionStreamForEach extends BugChecker implements BugChec
private static final Matcher<ExpressionTree> COLLECTION_STREAM = MethodMatchers.instanceMethod()
.onDescendantOf(Collection.class.getName())
.named("stream")
.withParameters();
.withNoParameters();

private static final Matcher<MethodInvocationTree> matcher =
Matchers.allOf(STREAM_FOR_EACH, Matchers.receiverOfInvocation(COLLECTION_STREAM));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "CompileTimeConstantViolatesLiskovSubstitution",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "ConsistentLoggerName",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.WARNING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "ConsistentOverrides",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "DangerousCompletableFutureUsage",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
*/
@AutoService(BugChecker.class)
@BugPattern(
name = "DangerousIdentityKey",
summary = "Key type does not override equals() and hashCode, so comparisons will be done on"
+ " reference equality only. If neither deduplication nor lookup are needed,"
+ " consider using a List instead. Otherwise, use IdentityHashMap/Set,"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "DangerousJsonTypeInfoUsage",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "DangerousParallelStreamUsage",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = SeverityLevel.WARNING,
Expand Down Expand Up @@ -69,7 +68,7 @@ public final class DangerousParallelStreamUsage extends BugChecker implements Bu
private static final Matcher<ExpressionTree> PARALLEL_STREAM_ON_COLLECTION_MATCHER = MethodMatchers.instanceMethod()
.onDescendantOf(Collection.class.getName())
.named("parallelStream")
.withParameters();
.withNoParameters();

private static final Matcher<ExpressionTree> PARALLEL_STREAM_SUPPORT_MATCHER = Matchers.methodInvocation(
MethodMatchers.staticMethod().onClass(StreamSupport.class.getName()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "DangerousStringInternUsage",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = SeverityLevel.WARNING,
Expand Down Expand Up @@ -59,7 +58,7 @@ public final class DangerousStringInternUsage extends BugChecker implements BugC
private static final Matcher<ExpressionTree> STRING_INTERN_METHOD_MATCHER = MethodMatchers.instanceMethod()
.onExactClass(String.class.getName())
.named("intern")
.withParameters();
.withNoParameters();

@Override
public Description matchMethodInvocation(MethodInvocationTree tree, VisitorState state) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "DangerousThreadPoolExecutorUsage",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "DangerousThrowableMessageSafeArg",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = LinkType.CUSTOM,
severity = SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "DeprecatedGuavaObjects",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = LinkType.CUSTOM,
severity = SeverityLevel.WARNING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "DnsLookup",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.WARNING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "ExecutorSubmitRunnableFutureIgnored",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "ExtendsErrorOrThrowable",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "FilterOutputStreamSlowMultibyteWrite",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
summary = "Please also override `void write(byte[], int, int)`, "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "FinalClass",
// Support legacy suppressions from checkstyle
altNames = {"checkstyle:finalclass", "checkstyle:FinalClass"},
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "GradleCacheableArgumentProvider",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "GradleCacheableTaskAction",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "GradleProviderToString",
summary = "Calling toString on a Provider does not render the contained value",
severity = BugPattern.SeverityLevel.ERROR)
public final class GradleProviderToString extends AbstractToString {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "GuavaPreconditionsMessageFormat",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@
*/
@AutoService(BugChecker.class)
@BugPattern(
name = "IllegalSafeLoggingArgument",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
*/
@AutoService(BugChecker.class)
@BugPattern(
name = "ImmutablesBuilderMissingInitialization",
linkType = LinkType.CUSTOM,
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
severity = BugPattern.SeverityLevel.ERROR,
Expand All @@ -87,7 +86,7 @@ public final class ImmutablesBuilderMissingInitialization extends BugChecker imp
private static final Matcher<ExpressionTree> builderMethodMatcher = Matchers.instanceMethod()
.onClass(ImmutablesBuilderMissingInitialization::extendsImmutablesGeneratedClass)
.named("build")
.withParameters();
.withNoParameters();

private static final Supplier<Name> GENERATOR = VisitorState.memoize(state -> state.getName("generator"));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "ImmutablesStyle",
linkType = LinkType.CUSTOM,
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
severity = SeverityLevel.WARNING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "ImplicitPublicBuilderConstructor",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.WARNING,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "IncubatingMethod",
severity = BugPattern.SeverityLevel.ERROR,
summary = "You should avoid using incubating methods where possible, since they have very weak stability"
+ " guarantees. You can explicitly disable this check on a case-by-case basis using"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "InvocationHandlerDelegation",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.WARNING,
Expand Down Expand Up @@ -83,7 +82,7 @@ public final class InvocationHandlerDelegation extends BugChecker implements Bug
private static final Matcher<ExpressionTree> UNWRAP_THROWABLE = MethodMatchers.instanceMethod()
.onDescendantOf(Throwable.class.getName())
.named("getCause")
.withParameters();
.withNoParameters();

private static final Matcher<Tree> CONTAINS_UNWRAP_THROWABLE =
Matchers.contains(ExpressionTree.class, UNWRAP_THROWABLE);
Expand All @@ -106,7 +105,7 @@ public final class InvocationHandlerDelegation extends BugChecker implements Bug
.onClass(TypePredicates.anyOf(IS_ITE_SUBTYPE, IS_ITE_UNION))
// getTargetException is deprecated, but does work correctly.
.namedAnyOf("getCause", "getTargetException")
.withParameters();
.withNoParameters();

private static final Matcher<ExpressionTree> PASS_ITE = Matchers.methodInvocation(
Matchers.anyMethod(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "JUnit5RuleUsage",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.ERROR,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@

@AutoService(BugChecker.class)
@BugPattern(
name = "JUnit5SuiteMisuse",
link = "https://github.com/palantir/gradle-baseline#baseline-error-prone-checks",
linkType = BugPattern.LinkType.CUSTOM,
severity = BugPattern.SeverityLevel.ERROR,
Expand Down
Loading