diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index ec47cd2c4f..62adc2fd4b 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -21,16 +21,16 @@ jobs: epVersion: 2.10.0 - os: macos-latest java: 11 - epVersion: 2.22.0 + epVersion: 2.23.0 - os: ubuntu-latest java: 11 - epVersion: 2.22.0 + epVersion: 2.23.0 - os: windows-latest java: 11 - epVersion: 2.22.0 + epVersion: 2.23.0 - os: ubuntu-latest java: 17 - epVersion: 2.22.0 + epVersion: 2.23.0 fail-fast: false runs-on: ${{ matrix.os }} steps: @@ -40,7 +40,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: | - 21-ea + 21 17 ${{ matrix.java }} distribution: 'temurin' @@ -63,7 +63,7 @@ jobs: with: arguments: codeCoverageReport continue-on-error: true - if: runner.os == 'Linux' && matrix.java == '11' && matrix.epVersion == '2.22.0' && github.repository == 'uber/NullAway' + if: runner.os == 'Linux' && matrix.java == '11' && matrix.epVersion == '2.23.0' && github.repository == 'uber/NullAway' - name: Upload coverage reports to Codecov uses: codecov/codecov-action@v3 with: @@ -92,7 +92,7 @@ jobs: uses: actions/setup-java@v3 with: java-version: | - 21-ea + 21 11 distribution: 'temurin' - name: 'Publish' diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 0e295a96fb..1af2c45d71 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.10.0" // Latest released Error Prone version that we've tested with -def latestErrorProneVersion = "2.22.0" +def latestErrorProneVersion = "2.23.0" // Default to using latest tested Error Prone version def defaultErrorProneVersion = latestErrorProneVersion def errorProneVersionToCompileAgainst = defaultErrorProneVersion diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 864d6c4751..46671acb6e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,7 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionSha256Sum=591855b517fc635b9e04de1d05d5e76ada3f89f5fc76f87978d1b245b4f69225 -distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip +distributionSha256Sum=3e1af3ae886920c3ac87f7a91f816c0c7c436f276a6eefdb3da152100fef72ae +distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/gradlew b/gradlew index 0adc8e1a53..1aa94a4269 100755 --- a/gradlew +++ b/gradlew @@ -145,7 +145,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then case $MAX_FD in #( max*) # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 MAX_FD=$( ulimit -H -n ) || warn "Could not query maximum file descriptor limit" esac @@ -153,7 +153,7 @@ if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then '' | soft) :;; #( *) # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. - # shellcheck disable=SC3045 + # shellcheck disable=SC2039,SC3045 ulimit -n "$MAX_FD" || warn "Could not set maximum file descriptor limit to $MAX_FD" esac @@ -202,11 +202,11 @@ fi # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' -# Collect all arguments for the java command; -# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of -# shell script including quotes and variable substitutions, so put them in -# double quotes to make sure that they get re-expanded; and -# * put everything else in single quotes, so that it's not re-expanded. +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. set -- \ "-Dorg.gradle.appname=$APP_BASE_NAME" \ diff --git a/jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/BytecodeAnnotator.java b/jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/BytecodeAnnotator.java index 73c2e1d99a..6931199247 100644 --- a/jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/BytecodeAnnotator.java +++ b/jar-infer/jar-infer-lib/src/main/java/com/uber/nullaway/jarinfer/BytecodeAnnotator.java @@ -15,6 +15,8 @@ */ package com.uber.nullaway.jarinfer; +import static java.nio.charset.StandardCharsets.UTF_8; + import com.google.common.collect.ImmutableSet; import com.google.common.collect.Sets; import java.io.BufferedReader; @@ -227,7 +229,7 @@ private static void copyAndAnnotateJarEntry( } else if (entryName.equals("META-INF/MANIFEST.MF")) { // Read full file StringBuilder stringBuilder = new StringBuilder(); - BufferedReader br = new BufferedReader(new InputStreamReader(is, "UTF-8")); + BufferedReader br = new BufferedReader(new InputStreamReader(is, UTF_8)); String currentLine; while ((currentLine = br.readLine()) != null) { stringBuilder.append(currentLine + "\n"); @@ -240,7 +242,7 @@ private static void copyAndAnnotateJarEntry( throw new SignedJarException(SIGNED_JAR_ERROR_MESSAGE); } jarOS.putNextEntry(new ZipEntry(jarEntry.getName())); - jarOS.write(manifestMinusDigests.getBytes("UTF-8")); + jarOS.write(manifestMinusDigests.getBytes(UTF_8)); } else if (entryName.startsWith("META-INF/") && (entryName.endsWith(".DSA") || entryName.endsWith(".RSA") diff --git a/nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathElement.java b/nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathElement.java index 0d804668e5..1111d79e57 100644 --- a/nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathElement.java +++ b/nullaway/src/main/java/com/uber/nullaway/dataflow/AccessPathElement.java @@ -3,6 +3,7 @@ import com.google.common.collect.ImmutableList; import java.util.Arrays; import java.util.List; +import java.util.Objects; import javax.annotation.Nullable; import javax.lang.model.element.Element; @@ -31,18 +32,12 @@ public Element getJavaElement() { return this.javaElement; } - public @Nullable ImmutableList getConstantArguments() { - return this.constantArguments; - } - @Override public boolean equals(Object obj) { if (obj instanceof AccessPathElement) { AccessPathElement otherNode = (AccessPathElement) obj; return this.javaElement.equals(otherNode.javaElement) - && (constantArguments == null - ? otherNode.constantArguments == null - : constantArguments.equals(otherNode.constantArguments)); + && Objects.equals(constantArguments, otherNode.constantArguments); } else { return false; }