From b132905faded0d85e5558a431451569860fd725c Mon Sep 17 00:00:00 2001 From: Manu Sridharan Date: Tue, 19 Nov 2024 15:26:31 -0800 Subject: [PATCH] Update to Error Prone 2.36.0 --- .github/workflows/continuous-integration.yml | 8 ++++---- gradle/dependencies.gradle | 2 +- .../main/java/com/uber/nullaway/jmh/NullawayJavac.java | 1 + .../uber/nullaway/handlers/contract/ContractHandler.java | 5 ++--- sample-app/build.gradle | 1 + 5 files changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 486da4d1fc..fcb2fb1602 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -25,13 +25,13 @@ jobs: epVersion: 2.31.0 - os: macos-latest java: 17 - epVersion: 2.35.1 + epVersion: 2.36.0 - os: windows-latest java: 17 - epVersion: 2.35.1 + epVersion: 2.36.0 - os: ubuntu-latest java: 17 - epVersion: 2.35.1 + epVersion: 2.36.0 fail-fast: false runs-on: ${{ matrix.os }} steps: @@ -60,7 +60,7 @@ jobs: ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }} run: ./gradlew codeCoverageReport continue-on-error: true - if: runner.os == 'Linux' && matrix.java == '17' && matrix.epVersion == '2.35.1' && github.repository == 'uber/NullAway' + if: runner.os == 'Linux' && matrix.java == '17' && matrix.epVersion == '2.36.0' && github.repository == 'uber/NullAway' - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v4 with: diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index b74e030fda..81af7d7b6f 100755 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -19,7 +19,7 @@ import org.gradle.util.VersionNumber // The oldest version of Error Prone that we support running on def oldestErrorProneVersion = "2.14.0" // Latest released Error Prone version that we've tested with -def latestErrorProneVersion = "2.35.1" +def latestErrorProneVersion = "2.36.0" // Default to using latest tested Error Prone version def defaultErrorProneVersion = latestErrorProneVersion def errorProneVersionToCompileAgainst = defaultErrorProneVersion diff --git a/jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java b/jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java index 0691af9c62..4c8a752bdf 100644 --- a/jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java +++ b/jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java @@ -186,6 +186,7 @@ private NullawayJavac( "-d", outputDir.toAbsolutePath().toString(), "-XDcompilePolicy=simple", + "--should-stop=ifError=FLOW", "-Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:AnnotatedPackages=" + annotatedPackages + String.join(" ", extraErrorProneArgs))); diff --git a/nullaway/src/main/java/com/uber/nullaway/handlers/contract/ContractHandler.java b/nullaway/src/main/java/com/uber/nullaway/handlers/contract/ContractHandler.java index a1d15c7fc5..27b3b8dd9f 100644 --- a/nullaway/src/main/java/com/uber/nullaway/handlers/contract/ContractHandler.java +++ b/nullaway/src/main/java/com/uber/nullaway/handlers/contract/ContractHandler.java @@ -208,7 +208,7 @@ public NullnessHint onDataflowVisitMethodInvocation( for (int i = 0; i < antecedent.length; ++i) { String valueConstraint = antecedent[i].trim(); if (valueConstraint.equals("_")) { - continue; + // do nothing } else if (valueConstraint.equals("false") || valueConstraint.equals("true")) { // We handle boolean constraints in the case that the boolean argument is the result // of a null or not-null check. For example, @@ -262,8 +262,7 @@ public NullnessHint onDataflowVisitMethodInvocation( } else if (valueConstraint.equals("!null") && inputs.valueOfSubNode(node.getArgument(i)).equals(Nullness.NONNULL)) { // We already know this argument can't be null, so we can treat it as not part of the - // clause for the purpose of deciding the non-nullness of the other arguments. - continue; + // clause for the purpose of deciding the non-nullness of the other arguments; do nothing } else if (valueConstraint.equals("null") || valueConstraint.equals("!null")) { if (arg != null) { // More than one argument involved in the antecedent, ignore this rule diff --git a/sample-app/build.gradle b/sample-app/build.gradle index 0ab1e6f7f0..40c7b1bde5 100644 --- a/sample-app/build.gradle +++ b/sample-app/build.gradle @@ -47,6 +47,7 @@ android { variant.getJavaCompileProvider().configure { options.compilerArgs += [ "-XDcompilePolicy=simple", + "--should-stop=ifError=FLOW", "-Xplugin:ErrorProne -XepOpt:NullAway:AnnotatedPackages=com.uber", ] options.fork = true