diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 9e83f401e0..517ebe3c5e 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -13,9 +13,6 @@ jobs: strategy: matrix: include: - - os: ubuntu-latest - java: 8 - epVersion: 2.4.0 - os: ubuntu-latest java: 11 epVersion: 2.4.0 @@ -47,13 +44,6 @@ jobs: with: java-version: ${{ matrix.java }} distribution: 'temurin' - - name: Build and test using Java 8 and Error Prone ${{ matrix.epVersion }} - env: - ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }} - uses: gradle/gradle-build-action@v2 - with: - arguments: build - if: matrix.java == '8' - name: Build and test using Java 11 and Error Prone ${{ matrix.epVersion }} env: ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }} @@ -66,7 +56,7 @@ jobs: ORG_GRADLE_PROJECT_epApiVersion: ${{ matrix.epVersion }} uses: gradle/gradle-build-action@v2 with: - arguments: build -x :jar-infer:jar-infer-lib:build -x :jar-infer:nullaway-integration-test:build -x :jar-infer:test-java-lib-jarinfer:build + arguments: build if: matrix.java == '17' - name: Report jacoco coverage uses: gradle/gradle-build-action@v2 @@ -84,7 +74,7 @@ jobs: uses: gradle/gradle-build-action@v2 with: arguments: publishToMavenLocal -x signMavenPublication -x signShadowPublication - if: matrix.java == '8' + if: matrix.java == '11' - name: Check that Git tree is clean after build and test run: ./.buildscript/check_git_clean.sh publish_snapshot: @@ -95,10 +85,10 @@ jobs: steps: - name: 'Check out repository' uses: actions/checkout@v3 - - name: 'Set up JDK 8' + - name: 'Set up JDK 11' uses: actions/setup-java@v3 with: - java-version: 8 + java-version: 11 distribution: 'temurin' - name: 'Publish' uses: gradle/gradle-build-action@v2 diff --git a/annotations/build.gradle b/annotations/build.gradle index 8c88c7bed2..55e960775b 100644 --- a/annotations/build.gradle +++ b/annotations/build.gradle @@ -25,25 +25,21 @@ dependencies { test { maxHeapSize = "1024m" - if (!JavaVersion.current().java9Compatible) { - jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}" - } else { - // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer - 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", - ] - } + // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer + 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", + ] } apply plugin: 'com.vanniktech.maven.publish' diff --git a/build.gradle b/build.gradle index 07198f9b0c..e5edbcdb97 100644 --- a/build.gradle +++ b/build.gradle @@ -57,42 +57,33 @@ subprojects { project -> } project.tasks.withType(JavaCompile) { dependsOn(installGitHooks) - if (JavaVersion.current().isJava9Compatible()) { - options.compilerArgs += [ - "-Xlint:deprecation", - "-Xlint:rawtypes", - "-Xlint:unchecked", - "-Werror" - ] - options.errorprone { - // disable warnings in generated code; AutoValue code fails UnnecessaryParentheses check - disableWarningsInGeneratedCode = true - // this check is too noisy - check("StringSplitter", CheckSeverity.OFF) - // https://github.com/google/error-prone/issues/3366 - check("CanIgnoreReturnValueSuggester", CheckSeverity.OFF) - // turn up various checks - check("WildcardImport", CheckSeverity.ERROR) - check("MissingBraces", CheckSeverity.ERROR) - check("TypeToString", CheckSeverity.ERROR) - check("SymbolToString", CheckSeverity.ERROR) - check("MultipleTopLevelClasses", CheckSeverity.ERROR) - check("ClassName", CheckSeverity.ERROR) - check("PackageLocation", CheckSeverity.ERROR) - check("UnnecessaryAnonymousClass", CheckSeverity.ERROR) - check("UnusedException", CheckSeverity.ERROR) - // To enable auto-patching, uncomment the line below, replace [CheckerName] with - // the checker(s) you want to apply patches for (comma-separated), and above, disable - // "-Werror" + options.compilerArgs += [ + "-Xlint:deprecation", + "-Xlint:rawtypes", + "-Xlint:unchecked", + "-Werror" + ] + options.errorprone { + // disable warnings in generated code; AutoValue code fails UnnecessaryParentheses check + disableWarningsInGeneratedCode = true + // this check is too noisy + check("StringSplitter", CheckSeverity.OFF) + // https://github.com/google/error-prone/issues/3366 + check("CanIgnoreReturnValueSuggester", CheckSeverity.OFF) + // turn up various checks + check("WildcardImport", CheckSeverity.ERROR) + check("MissingBraces", CheckSeverity.ERROR) + check("TypeToString", CheckSeverity.ERROR) + check("SymbolToString", CheckSeverity.ERROR) + check("MultipleTopLevelClasses", CheckSeverity.ERROR) + check("ClassName", CheckSeverity.ERROR) + check("PackageLocation", CheckSeverity.ERROR) + check("UnnecessaryAnonymousClass", CheckSeverity.ERROR) + check("UnusedException", CheckSeverity.ERROR) + // To enable auto-patching, uncomment the line below, replace [CheckerName] with + // the checker(s) you want to apply patches for (comma-separated), and above, disable + // "-Werror" // errorproneArgs.addAll("-XepPatchChecks:[CheckerName]", "-XepPatchLocation:IN_PLACE") - } - } else { - // Disable Error Prone checks on JDK 8, as more recent Error Prone versions don't run on JDK 8 - // NOTE: we use disableAllChecks rather than the enabled flag because we still want to use the - // JDK 9 javac packaged with Error Prone, to work around the following bug with JDK 8 javac - // and use of the @NullMarked / @NullUnmarked annotations from jspecify: - // https://github.com/jspecify/jspecify/issues/302 - options.errorprone.disableAllChecks = true } } @@ -103,13 +94,6 @@ subprojects { project -> java.targetCompatibility = "1.8" } - // Ensure we are running on Java 8 whenever publishing to remote repos - tasks.withType(PublishToMavenRepository) { - doFirst { - assert JavaVersion.current() == JavaVersion.VERSION_1_8 : "Only publish to remote repos on JDK 1.8" - } - } - tasks.withType(Test).configureEach { maxParallelForks = Runtime.runtime.availableProcessors().intdiv(2) ?: 1 } diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index 961df9b844..2194d2c9d1 100755 --- a/gradle/dependencies.gradle +++ b/gradle/dependencies.gradle @@ -20,9 +20,8 @@ import org.gradle.util.VersionNumber def oldestErrorProneVersion = "2.4.0" // Latest released Error Prone version that we've tested with def latestErrorProneVersion = "2.20.0" -// Default to using latest tested Error Prone version, except on Java 8, where 2.10.0 is the last version -// that works -def defaultErrorProneVersion = JavaVersion.current() >= JavaVersion.VERSION_11 ? latestErrorProneVersion : "2.10.0" +// Default to using latest tested Error Prone version +def defaultErrorProneVersion = latestErrorProneVersion def errorProneVersionToCompileAgainst = defaultErrorProneVersion // If the epApiVersion project property is set, compile and test against that version of Error Prone @@ -49,7 +48,7 @@ def versions = [ // The version of Error Prone that NullAway is compiled and tested against errorProneApi : errorProneVersionToCompileAgainst, support : "27.1.1", - wala : "1.5.8", + wala : "1.6.1", commonscli : "1.4", autoValue : "1.9", autoService : "1.0.1", diff --git a/guava-recent-unit-tests/build.gradle b/guava-recent-unit-tests/build.gradle index 24dbdfe76b..8efb6d0815 100644 --- a/guava-recent-unit-tests/build.gradle +++ b/guava-recent-unit-tests/build.gradle @@ -33,50 +33,44 @@ dependencies { test { maxHeapSize = "1024m" - if (!JavaVersion.current().java9Compatible) { - jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}" - } else { - // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer - 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", - ] - } + // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer + 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", + ] } -if (JavaVersion.current() >= JavaVersion.VERSION_11) { - // 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.4.0" - } +// 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.4.0" + } - javaLauncher = javaToolchains.launcherFor { - languageVersion = JavaLanguageVersion.of(8) - } + javaLauncher = javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(8) + } - description = "Runs the test suite on JDK 8" - group = LifecycleBasePlugin.VERIFICATION_GROUP + description = "Runs the test suite on JDK 8" + group = LifecycleBasePlugin.VERIFICATION_GROUP - // Copy inputs from normal Test task. - def testTask = tasks.getByName("test") - classpath = testTask.classpath - testClassesDirs = testTask.testClassesDirs - jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}" - } + // Copy inputs from normal Test task. + def testTask = tasks.getByName("test") + classpath = testTask.classpath + testClassesDirs = testTask.testClassesDirs + jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}" +} - tasks.named('check').configure { - dependsOn(jdk8Test) - } +tasks.named('check').configure { + dependsOn(jdk8Test) } diff --git a/jar-infer/jar-infer-cli/build.gradle b/jar-infer/jar-infer-cli/build.gradle index e0a5090876..ac05e287a2 100644 --- a/jar-infer/jar-infer-cli/build.gradle +++ b/jar-infer/jar-infer-cli/build.gradle @@ -4,6 +4,10 @@ plugins { id "com.github.johnrengelman.shadow" } +// JarInfer requires JDK 11+, due to its dependence on WALA +sourceCompatibility JavaVersion.VERSION_11 +targetCompatibility JavaVersion.VERSION_11 + repositories { mavenCentral() } diff --git a/jar-infer/jar-infer-lib/build.gradle b/jar-infer/jar-infer-lib/build.gradle index 1bcf4ae9ff..70b00ecced 100644 --- a/jar-infer/jar-infer-lib/build.gradle +++ b/jar-infer/jar-infer-lib/build.gradle @@ -18,6 +18,10 @@ plugins { id 'nullaway.jacoco-conventions' } +// JarInfer requires JDK 11+, due to its dependence on WALA +sourceCompatibility JavaVersion.VERSION_11 +targetCompatibility JavaVersion.VERSION_11 + repositories { mavenCentral() // uncomment if you want to use wala.dalvik or wala.scandroid @@ -43,28 +47,26 @@ dependencies { test { maxHeapSize = "1024m" - if (!JavaVersion.current().java9Compatible) { - jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}" - } else { - // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer - 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", - ] - } - if (JavaVersion.current() >= JavaVersion.VERSION_11) { - dependsOn ':jar-infer:test-android-lib-jarinfer:bundleReleaseAar' - } + // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer + 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", + ] + dependsOn ':jar-infer:test-android-lib-jarinfer:bundleReleaseAar' +} + +tasks.withType(JavaCompile).configureEach { + options.compilerArgs += "--add-exports=jdk.compiler/com.sun.tools.javac.main=ALL-UNNAMED" } apply plugin: 'com.vanniktech.maven.publish' diff --git a/jar-infer/nullaway-integration-test/build.gradle b/jar-infer/nullaway-integration-test/build.gradle index 100e2d81ae..543b0c60bb 100644 --- a/jar-infer/nullaway-integration-test/build.gradle +++ b/jar-infer/nullaway-integration-test/build.gradle @@ -31,21 +31,17 @@ dependencies { test { maxHeapSize = "1024m" - if (!JavaVersion.current().java9Compatible) { - jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}" - } else { - // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer - 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", - ] - } + // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer + 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", + ] } diff --git a/jmh/build.gradle b/jmh/build.gradle index edc2679494..2481e23461 100644 --- a/jmh/build.gradle +++ b/jmh/build.gradle @@ -130,7 +130,6 @@ jmh { // don't run test task on pre-JDK-11 VMs tasks.named('test') { - onlyIf { JavaVersion.current() >= JavaVersion.VERSION_11 } // pass the extra JVM args so we can compile benchmarks in unit tests jvmArgs extraJVMArgs // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer diff --git a/nullaway/build.gradle b/nullaway/build.gradle index a4df4148e7..8e3f3ce54e 100644 --- a/nullaway/build.gradle +++ b/nullaway/build.gradle @@ -76,10 +76,7 @@ javadoc { test { - maxHeapSize = "1024m" - if (!JavaVersion.current().java9Compatible) { - jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}" - } else { + maxHeapSize = "1024m" // to expose necessary JDK types on JDK 16+; see https://errorprone.info/docs/installation#java-9-and-newer jvmArgs += [ "--add-exports=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED", @@ -95,12 +92,10 @@ test { // Accessed by Lombok tests "--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED", ] - } } apply plugin: 'com.vanniktech.maven.publish' -if (JavaVersion.current() >= JavaVersion.VERSION_11) { // These --add-exports arguments are required when targeting JDK 11+ since Error Prone and NullAway access a bunch of // JDK-internal APIs that are not exposed otherwise. Since we currently target JDK 8, we do not need to pass the // arguments, as encapsulation of JDK internals is not enforced on JDK 8. In fact, the arguments cause a compiler error @@ -121,68 +116,66 @@ if (JavaVersion.current() >= JavaVersion.VERSION_11) { // ] // } - // 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.4.0" - } +// 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.4.0" + } - javaLauncher = javaToolchains.launcherFor { - languageVersion = JavaLanguageVersion.of(8) - } + javaLauncher = javaToolchains.launcherFor { + languageVersion = JavaLanguageVersion.of(8) + } - description = "Runs the test suite on JDK 8" - group = LifecycleBasePlugin.VERIFICATION_GROUP + description = "Runs the test suite on JDK 8" + group = LifecycleBasePlugin.VERIFICATION_GROUP - // Copy inputs from normal Test task. - def testTask = tasks.getByName("test") - classpath = testTask.classpath - testClassesDirs = testTask.testClassesDirs - jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}" - } + // Copy inputs from normal Test task. + def testTask = tasks.getByName("test") + classpath = testTask.classpath + testClassesDirs = testTask.testClassesDirs + jvmArgs "-Xbootclasspath/p:${configurations.errorproneJavac.asPath}" +} - tasks.named('check').configure { - dependsOn(jdk8Test) - } +tasks.named('check').configure { + dependsOn(jdk8Test) +} - // Create a task to build NullAway with NullAway checking enabled - // (For some reason, this doesn't work on Java 8) - tasks.register('buildWithNullAway', JavaCompile) { - onlyIf { - // We only do NullAway checks when compiling against the latest - // version of Error Prone (as nullability annotations on the APIs - // can change between versions) - deps.versions.errorProneApi == deps.versions.errorProneLatest - } - // Configure compilation to run with Error Prone and NullAway - source = sourceSets.main.java - classpath = sourceSets.main.compileClasspath - destinationDirectory = file("$buildDir/ignoredClasses") - def nullawayDeps = configurations.nullawayJar.asCollection() - options.annotationProcessorPath = files( - configurations.errorprone.asCollection(), - sourceSets.main.annotationProcessorPath, - nullawayDeps) - options.errorprone.enabled = true - options.errorprone { - option("NullAway:AnnotatedPackages", "com.uber,org.checkerframework.nullaway") - option("NullAway:CastToNonNullMethod", "com.uber.nullaway.NullabilityUtil.castToNonNull") - option("NullAway:CheckOptionalEmptiness") - option("NullAway:AcknowledgeRestrictiveAnnotations") - } - // Make sure the jar has already been built - dependsOn 'jar' - // Check that the NullAway jar actually exists (without this, - // Gradle will run the compilation even if the jar doesn't exist) - doFirst { - nullawayDeps.forEach { f -> - assert f.exists() - } +// Create a task to build NullAway with NullAway checking enabled +tasks.register('buildWithNullAway', JavaCompile) { + onlyIf { + // We only do NullAway checks when compiling against the latest + // version of Error Prone (as nullability annotations on the APIs + // can change between versions) + deps.versions.errorProneApi == deps.versions.errorProneLatest + } + // Configure compilation to run with Error Prone and NullAway + source = sourceSets.main.java + classpath = sourceSets.main.compileClasspath + destinationDirectory = file("$buildDir/ignoredClasses") + def nullawayDeps = configurations.nullawayJar.asCollection() + options.annotationProcessorPath = files( + configurations.errorprone.asCollection(), + sourceSets.main.annotationProcessorPath, + nullawayDeps) + options.errorprone.enabled = true + options.errorprone { + option("NullAway:AnnotatedPackages", "com.uber,org.checkerframework.nullaway") + option("NullAway:CastToNonNullMethod", "com.uber.nullaway.NullabilityUtil.castToNonNull") + option("NullAway:CheckOptionalEmptiness") + option("NullAway:AcknowledgeRestrictiveAnnotations") + } + // Make sure the jar has already been built + dependsOn 'jar' + // Check that the NullAway jar actually exists (without this, + // Gradle will run the compilation even if the jar doesn't exist) + doFirst { + nullawayDeps.forEach { f -> + assert f.exists() } } +} - project.tasks.named('check').configure { - dependsOn 'buildWithNullAway' - } +project.tasks.named('check').configure { + dependsOn 'buildWithNullAway' } diff --git a/settings.gradle b/settings.gradle index 4683c7b94c..3f7ee39b83 100644 --- a/settings.gradle +++ b/settings.gradle @@ -25,10 +25,6 @@ include ':jar-infer:nullaway-integration-test' include ':jmh' include ':guava-recent-unit-tests' include ':jdk17-unit-tests' - -// The following modules require JDK 11 and fail during Gradle configuration on JDK 8 -if (JavaVersion.current() >= JavaVersion.VERSION_11) { - include ':code-coverage-report' - include ':sample-app' - include ':jar-infer:test-android-lib-jarinfer' -} +include ':code-coverage-report' +include ':sample-app' +include ':jar-infer:test-android-lib-jarinfer' diff --git a/test-java-lib-lombok/build.gradle b/test-java-lib-lombok/build.gradle index 2065f7cdcc..011a1b9013 100644 --- a/test-java-lib-lombok/build.gradle +++ b/test-java-lib-lombok/build.gradle @@ -36,16 +36,9 @@ tasks.withType(JavaCompile) { check("NullAway", CheckSeverity.ERROR) option("NullAway:AnnotatedPackages", "com.uber") option("NullAway:UnannotatedSubPackages", "com.uber.lib.unannotated") - if (JavaVersion.current() == JavaVersion.VERSION_1_8) { - // false positive warnings, only on Java 8 - check("MissingSummary", CheckSeverity.OFF) - check("SameNameButDifferent", CheckSeverity.OFF) - } } } - if (JavaVersion.current().java9Compatible) { - // We need to fork on JDK 16+ since Lombok accesses internal compiler APIs - options.fork = true - options.forkOptions.jvmArgs += ["--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED"] - } + // We need to fork on JDK 16+ since Lombok accesses internal compiler APIs + options.fork = true + options.forkOptions.jvmArgs += ["--add-opens=jdk.compiler/com.sun.tools.javac.jvm=ALL-UNNAMED"] }