Skip to content

Commit

Permalink
Merge branch 'master' into library_model_nullable_upper_bound
Browse files Browse the repository at this point in the history
  • Loading branch information
akulk022 committed Jun 3, 2024
2 parents c3c37b0 + 0ab6c22 commit 8c48d3c
Show file tree
Hide file tree
Showing 65 changed files with 885 additions and 363 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ jobs:
include:
- os: ubuntu-latest
java: 11
epVersion: 2.10.0
epVersion: 2.14.0
- os: ubuntu-latest
java: 17
epVersion: 2.10.0
epVersion: 2.14.0
- os: macos-latest
java: 11
epVersion: 2.26.1
epVersion: 2.27.1
- os: ubuntu-latest
java: 11
epVersion: 2.26.1
epVersion: 2.27.1
- os: windows-latest
java: 11
epVersion: 2.26.1
epVersion: 2.27.1
- os: ubuntu-latest
java: 17
epVersion: 2.26.1
epVersion: 2.27.1
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
Expand Down Expand Up @@ -63,7 +63,7 @@ jobs:
with:
arguments: codeCoverageReport
continue-on-error: true
if: runner.os == 'Linux' && matrix.java == '11' && matrix.epVersion == '2.26.1' && github.repository == 'uber/NullAway'
if: runner.os == 'Linux' && matrix.java == '11' && matrix.epVersion == '2.27.1' && github.repository == 'uber/NullAway'
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v4
with:
Expand Down
73 changes: 0 additions & 73 deletions .github/workflows/jmh-benchmark.yml

This file was deleted.

17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
Changelog
=========
Version 0.11.0
---------------
IMPORTANT: Support for JDK 8 is dropped and NullAway now requires 2.14.0 or higher.

* Delete OptionalEmptinessHandler method that is no longer needed (#954)
* Refactor PreservedAnnotationTreeVisitor (#955)
* Update to Error Prone 2.27.1 (#957)
* JSpecify subtyping checks for arrays (#956)
* Bump to Checker Framework 3.43.0 (#959)
* Drop Java 8 support (#961)

Version 0.10.26
---------------
* External Library Models Integration (#922)
* Rename test classes (#951)
* Propagate more nullability info to lambdas known to be invoked synchronously (#952)

Version 0.10.25
---------------
* JSpecify: Handle @nullable assignments to @nonnull arrays (#929)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ NullAway is *fast*. It is built as a plugin to [Error Prone](http://errorprone.

### Overview

NullAway requires that you build your code with [Error Prone](http://errorprone.info), version 2.10.0 or higher. See the [Error Prone documentation](http://errorprone.info/docs/installation) for instructions on getting started with Error Prone and integration with your build system. The instructions below assume you are using Gradle; see [the docs](https://github.com/uber/NullAway/wiki/Configuration#other-build-systems) for discussion of other build systems.
NullAway requires that you build your code with [Error Prone](http://errorprone.info), version 2.14.0 or higher. See the [Error Prone documentation](http://errorprone.info/docs/installation) for instructions on getting started with Error Prone and integration with your build system. The instructions below assume you are using Gradle; see [the docs](https://github.com/uber/NullAway/wiki/Configuration#other-build-systems) for discussion of other build systems.

### Gradle

Expand Down
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,11 @@ subprojects { project ->
}
}

// Target JDK 8. We need to use the older sourceCompatibility / targetCompatibility settings to get
// the build to work on JDK 11+. Once we stop supporting JDK 8, switch to using the javac "release" option
// We need to use the older sourceCompatibility / targetCompatibility settings, rather than the newer "release"
// option, since we use internal javac APIs, which "release" doesn't allow
tasks.withType(JavaCompile) {
java.sourceCompatibility = "1.8"
java.targetCompatibility = "1.8"
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11
}

tasks.withType(Test).configureEach {
Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ org.gradle.caching=true
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m

GROUP=com.uber.nullaway
VERSION_NAME=0.10.26-SNAPSHOT
VERSION_NAME=0.11.1-SNAPSHOT

POM_DESCRIPTION=A fast annotation-based null checker for Java

Expand Down
6 changes: 3 additions & 3 deletions gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import org.gradle.util.VersionNumber
*/

// The oldest version of Error Prone that we support running on
def oldestErrorProneVersion = "2.10.0"
def oldestErrorProneVersion = "2.14.0"
// Latest released Error Prone version that we've tested with
def latestErrorProneVersion = "2.26.1"
def latestErrorProneVersion = "2.27.1"
// Default to using latest tested Error Prone version
def defaultErrorProneVersion = latestErrorProneVersion
def errorProneVersionToCompileAgainst = defaultErrorProneVersion
Expand All @@ -40,7 +40,7 @@ if (project.hasProperty("epApiVersion")) {

def versions = [
asm : "9.3",
checkerFramework : "3.40.0",
checkerFramework : "3.43.0",
// for comparisons in other parts of the build
errorProneLatest : latestErrorProneVersion,
// The version of Error Prone used to check NullAway's code.
Expand Down
46 changes: 35 additions & 11 deletions guava-recent-unit-tests/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ plugins {
id 'nullaway.java-test-conventions'
}

configurations {
// A configuration holding the jars for the oldest supported version of Error Prone, to use with tests
errorProneOldest
}

// We need this separate build target to test newer versions of Guava
// (e.g. 31+) than that which NullAway currently depends on.

Expand All @@ -29,29 +34,48 @@ dependencies {
}
testImplementation deps.build.jsr305Annotations
testImplementation "com.google.guava:guava:31.1-jre"
}

// Create a task to test on JDK 8
def jdk8Test = tasks.register("testJdk8", Test) {
onlyIf {
// Only if we are using a version of Error Prone compatible with JDK 8
deps.versions.errorProneApi == "2.10.0"
errorProneOldest deps.build.errorProneCheckApiOld
errorProneOldest(deps.build.errorProneTestHelpersOld) {
exclude group: "junit", module: "junit"
}
}

// Create a task to test with the oldest supported version of Error Prone
// (while still building against the latest supported version)
def epOldestTest = tasks.register("testErrorProneOldest", Test) {

javaLauncher = javaToolchains.launcherFor {
languageVersion = JavaLanguageVersion.of(8)
languageVersion = JavaLanguageVersion.of(11)
}

description = "Runs the test suite on JDK 8"
description = "Runs the test suite using the oldest supported version of Error Prone"
group = LifecycleBasePlugin.VERIFICATION_GROUP

// Copy inputs from normal Test task.
def testTask = tasks.getByName("test")
classpath = testTask.classpath
// A bit of a hack: we add the dependencies of the oldest supported Error Prone version to the _beginning_ of the
// classpath, so that they are used instead of the latest version. This exercises the scenario of building
// NullAway against the latest supported Error Prone version but then running on the oldest supported version.
classpath = configurations.errorProneOldest + testTask.classpath
testClassesDirs = testTask.testClassesDirs
jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}"

jvmArgs += [
"--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.model=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.processing=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED",
"--add-exports=jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.code=ALL-UNNAMED",
"--add-opens=jdk.compiler/com.sun.tools.javac.comp=ALL-UNNAMED",
// Accessed by Lombok tests
"--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED",
]
}

tasks.named('check').configure {
dependsOn(jdk8Test)
dependsOn(epOldestTest)
}
6 changes: 0 additions & 6 deletions jar-infer/jar-infer-cli/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,6 @@ plugins {
id "com.github.johnrengelman.shadow"
}

// JarInfer requires JDK 11+, due to its dependence on WALA
tasks.withType(JavaCompile) {
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11
}

repositories {
mavenCentral()
}
Expand Down
6 changes: 0 additions & 6 deletions jar-infer/jar-infer-lib/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ plugins {
id 'nullaway.java-test-conventions'
}

// JarInfer requires JDK 11+, due to its dependence on WALA
tasks.withType(JavaCompile) {
java.sourceCompatibility = JavaVersion.VERSION_11
java.targetCompatibility = JavaVersion.VERSION_11
}

repositories {
mavenCentral()
// uncomment if you want to use wala.dalvik or wala.scandroid
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

public class NullAwayInstanceOfBindingTests {
public class InstanceOfBindingTests {

@Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

public class NullAwayModuleInfoTests {
public class ModuleInfoTests {

@Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import org.junit.rules.TemporaryFolder;

/** Tests for support of the {@code Optional.isEmpty()} API. This API was introduced in JDK 11. */
public class NullAwayOptionalEmptyTests {
public class OptionalEmptyTests {

@Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
import org.junit.Test;
import org.junit.rules.TemporaryFolder;

public class NullAwayRecordTests {
public class RecordTests {

@Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
import org.junit.rules.TemporaryFolder;

/** NullAway unit tests involving language features available on JDK 17 but not JDK 11. */
public class NullAwaySwitchTests {
public class SwitchTests {

@Rule public final TemporaryFolder temporaryFolder = new TemporaryFolder();

Expand Down
Loading

0 comments on commit 8c48d3c

Please sign in to comment.