Skip to content

Commit

Permalink
Update to Error Prone 2.36.0 (#1077)
Browse files Browse the repository at this point in the history
Required a couple of small code fixes, and adding
`--should-stop=ifError=FLOW` as an argument to `javac` in a couple
places.
  • Loading branch information
msridhar authored Nov 21, 2024
1 parent 5ea8b0c commit 6c498b6
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions jmh/src/main/java/com/uber/nullaway/jmh/NullawayJavac.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions sample-app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6c498b6

Please sign in to comment.