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

Upgrade error_prone to 2.18.0 (from 2.16) #2472

Merged
merged 3 commits into from
Mar 6, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import com.sun.tools.javac.tree.JCTree;
import java.util.List;
import java.util.Set;
import javax.inject.Inject;

@AutoService(BugChecker.class)
@BugPattern(
Expand All @@ -54,6 +55,7 @@ public LogsafeArgName() {
this.unsafeParamNames = ImmutableSet.of();
}

@Inject
public LogsafeArgName(ErrorProneFlags flags) {
Comment on lines +58 to 59
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caught by InjectOnBugCheckers in 2.18.0.

this.unsafeParamNames =
flags.getList(UNSAFE_ARG_NAMES_FLAG).map(ImmutableSet::copyOf).orElseGet(ImmutableSet::of);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -922,11 +922,8 @@ private static UnderlyingAST createAst(TreePath path) {
}

private static boolean hasNonNullConstantValue(LocalVariableNode node) {
if (node.getElement() instanceof VariableElement) {
VariableElement element = (VariableElement) node.getElement();
return (element.getConstantValue() != null);
}
return false;
VariableElement element = node.getElement();
return element != null && element.getConstantValue() != null;
}

@Override
Expand Down
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ allprojects {
check("PreferSafeLogger", CheckSeverity.OFF)
check("PreferSafeLoggingPreconditions", CheckSeverity.OFF)
check("PreconditionsConstantMessage", CheckSeverity.OFF)
// temporarily opt out of error-prone in order to upgrade checkerframework.
// This should be removed as soon as baseline is next upgraded within this repo.
enabled = false
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've compiled this using a snapshot of itself, things seem good, the problem is upgrading dependencies makes our existing baseline classes (applied to this project) incompatible with the upgraded checkerframework.

Copy link
Contributor Author

@carterkozak carterkozak Mar 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}
}
}
Expand Down
24 changes: 12 additions & 12 deletions versions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ com.google.auto.service:auto-service-annotations:1.0.1 (3 constraints: 2a3379a0)
com.google.auto.value:auto-value:1.7.4 (1 constraints: 1f1221fb)
com.google.auto.value:auto-value-annotations:1.9 (3 constraints: 802d5ac8)
com.google.code.findbugs:jsr305:3.0.2 (6 constraints: 66626968)
com.google.errorprone:error_prone_annotation:2.16 (3 constraints: ad370ed6)
com.google.errorprone:error_prone_annotations:2.16 (12 constraints: 12bcb42c)
com.google.errorprone:error_prone_check_api:2.16 (2 constraints: f8242c7e)
com.google.errorprone:error_prone_core:2.16 (2 constraints: 5717731a)
com.google.errorprone:error_prone_refaster:2.16 (1 constraints: dd04fb30)
com.google.errorprone:error_prone_test_helpers:2.16 (1 constraints: dd04fb30)
com.google.errorprone:error_prone_type_annotations:2.16 (1 constraints: c81038a7)
com.google.errorprone:error_prone_annotation:2.18.0 (3 constraints: cd3893ef)
com.google.errorprone:error_prone_annotations:2.18.0 (12 constraints: 32bda724)
com.google.errorprone:error_prone_check_api:2.18.0 (2 constraints: b825d0ff)
com.google.errorprone:error_prone_core:2.18.0 (2 constraints: 17187f67)
com.google.errorprone:error_prone_refaster:2.18.0 (1 constraints: 3d05473b)
com.google.errorprone:error_prone_test_helpers:2.18.0 (1 constraints: 3d05473b)
com.google.errorprone:error_prone_type_annotations:2.18.0 (1 constraints: 28115ac9)
com.google.googlejavaformat:google-java-format:1.13.0 (1 constraints: 8b149d75)
com.google.guava:failureaccess:1.0.1 (1 constraints: 140ae1b4)
com.google.guava:guava:31.1-jre (14 constraints: d6e9749b)
Expand All @@ -40,13 +40,13 @@ com.palantir.javaformat:palantir-java-format-spi:1.1.0 (1 constraints: 711560be)
com.palantir.safe-logging:preconditions:3.2.0 (6 constraints: 1457bcb5)
com.palantir.safe-logging:safe-logging:3.2.0 (8 constraints: 5f77a6d7)
com.palantir.tritium:tritium-registry:0.61.0 (1 constraints: 39053a3b)
com.uber.nullaway:nullaway:0.10.8 (1 constraints: 3b052b3b)
com.uber.nullaway:nullaway:0.10.9 (1 constraints: 3c052c3b)
commons-io:commons-io:2.11.0 (1 constraints: 57119bcb)
commons-lang:commons-lang:2.6 (1 constraints: ac04232c)
io.dropwizard.metrics:metrics-core:4.1.1 (1 constraints: 901088a5)
io.github.java-diff-utils:java-diff-utils:4.0 (1 constraints: 811205f6)
javax.annotation:javax.annotation-api:1.3.2 (2 constraints: cd204f35)
javax.inject:javax.inject:1 (8 constraints: b476ecf8)
javax.inject:javax.inject:1 (9 constraints: e5867a2e)
junit:junit:4.13.2 (8 constraints: 1d727319)
net.bytebuddy:byte-buddy:1.12.22 (2 constraints: ee168c66)
net.bytebuddy:byte-buddy-agent:1.12.22 (1 constraints: 720bace9)
Expand All @@ -69,9 +69,9 @@ org.apache.maven.resolver:maven-resolver-util:1.6.3 (3 constraints: 5930fd65)
org.apache.maven.shared:maven-dependency-analyzer:1.13.0 (1 constraints: 3705323b)
org.apache.maven.shared:maven-shared-utils:3.3.4 (1 constraints: e60b61f3)
org.assertj:assertj-core:3.24.2 (3 constraints: e62ace9f)
org.checkerframework:checker-qual:3.25.0 (3 constraints: 08256088)
org.checkerframework:dataflow-errorprone:3.25.0 (4 constraints: 023e005f)
org.checkerframework:dataflow-nullaway:3.26.0 (2 constraints: 6c11e5f1)
org.checkerframework:checker-qual:3.32.0 (3 constraints: 08256088)
org.checkerframework:dataflow-errorprone:3.32.0 (4 constraints: 093ebc5f)
org.checkerframework:dataflow-nullaway:3.32.0 (2 constraints: 691171f1)
org.codehaus.groovy:groovy:3.0.10 (3 constraints: e32879d6)
org.codehaus.groovy:groovy-xml:3.0.10 (1 constraints: 791161da)
org.codehaus.plexus:plexus-cipher:2.0 (1 constraints: 641174c7)
Expand Down
9 changes: 3 additions & 6 deletions versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ org.jooq:jooq = 3.17.7
org.slf4j:* = 1.7.36
org.immutables:* = 2.9.3
org.ow2.asm:asm = 9.4
com.google.errorprone:error_prone_* = 2.16
com.google.errorprone:error_prone_* = 2.18.0
com.googlecode.java-diff-utils:diffutils = 1.3.0
com.puppycrawl.tools:checkstyle = 10.6.0
com.palantir.gradle.utils:* = 0.1.0
com.uber.nullaway:nullaway = 0.10.8
com.uber.nullaway:nullaway = 0.10.9

# test deps
com.fasterxml.jackson.*:* = 2.14.2
Expand All @@ -32,6 +32,7 @@ net.ltgt.gradle:gradle-errorprone-plugin = 3.0.1
one.util:streamex = 0.8.1
org.apache.commons:commons-lang3 = 3.12.0
org.assertj:assertj-core = 3.24.2
org.checkerframework:* = 3.32.0
org.hamcrest:hamcrest-core = 2.2
org.junit.jupiter:* = 5.9.2
org.junit.vintage:* = 5.9.2
Expand All @@ -46,8 +47,4 @@ com.palantir.javaformat:gradle-palantir-java-format = 1.1.0
com.diffplug.spotless:spotless-plugin-gradle = 6.6.0
# Groovy versions must be compatible with gradle
org.codehaus.groovy:* = 3.0.10
# error-prone isn't compatible with checkerframework 3.26.0 yet
org.checkerframework:* = 3.25.0
# Allow nullaway to specify its own checkerframework release
org.checkerframework:dataflow-nullaway = 3.26.0
# dependency-upgrader:ON