diff --git a/baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/LogsafeArgName.java b/baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/LogsafeArgName.java index e652e06f5..65078e751 100644 --- a/baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/LogsafeArgName.java +++ b/baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/LogsafeArgName.java @@ -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( @@ -54,6 +55,7 @@ public LogsafeArgName() { this.unsafeParamNames = ImmutableSet.of(); } + @Inject public LogsafeArgName(ErrorProneFlags flags) { this.unsafeParamNames = flags.getList(UNSAFE_ARG_NAMES_FLAG).map(ImmutableSet::copyOf).orElseGet(ImmutableSet::of); diff --git a/baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/safety/SafetyPropagationTransfer.java b/baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/safety/SafetyPropagationTransfer.java index b398ffd83..cb32e074b 100644 --- a/baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/safety/SafetyPropagationTransfer.java +++ b/baseline-error-prone/src/main/java/com/palantir/baseline/errorprone/safety/SafetyPropagationTransfer.java @@ -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 diff --git a/build.gradle b/build.gradle index d559066ff..a5279f236 100644 --- a/build.gradle +++ b/build.gradle @@ -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 } } } diff --git a/versions.lock b/versions.lock index 2083e47b9..544f0a60b 100644 --- a/versions.lock +++ b/versions.lock @@ -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) @@ -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) @@ -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) diff --git a/versions.props b/versions.props index 0378edeb4..ba3f83368 100644 --- a/versions.props +++ b/versions.props @@ -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 @@ -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 @@ -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