diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index a8d80cbe20..9bb0d03707 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -21,16 +21,16 @@ jobs: epVersion: 2.4.0 - os: macos-latest java: 11 - epVersion: 2.16 + epVersion: 2.18.0 - os: ubuntu-latest java: 11 - epVersion: 2.16 + epVersion: 2.18.0 - os: windows-latest java: 11 - epVersion: 2.16 + epVersion: 2.18.0 - os: ubuntu-latest java: 17 - epVersion: 2.16 + epVersion: 2.18.0 fail-fast: false runs-on: ${{ matrix.os }} steps: @@ -70,7 +70,7 @@ jobs: with: arguments: coveralls continue-on-error: true - if: runner.os == 'Linux' && matrix.java == '11' && matrix.epVersion == '2.16' && github.repository == 'uber/NullAway' + if: runner.os == 'Linux' && matrix.java == '11' && matrix.epVersion == '2.18.0' && github.repository == 'uber/NullAway' - name: Check that Git tree is clean after build and test run: ./.buildscript/check_git_clean.sh publish_snapshot: diff --git a/build.gradle b/build.gradle index 33d5ff664f..63c05fc004 100644 --- a/build.gradle +++ b/build.gradle @@ -81,6 +81,10 @@ subprojects { project -> 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 diff --git a/gradle/dependencies.gradle b/gradle/dependencies.gradle index ef6765cbf5..528862b5fc 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.4.0" // Latest released Error Prone version that we've tested with -def latestErrorProneVersion = "2.16" +def latestErrorProneVersion = "2.18.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" diff --git a/nullaway/build.gradle b/nullaway/build.gradle index d6c4463dca..3b4f10f379 100644 --- a/nullaway/build.gradle +++ b/nullaway/build.gradle @@ -32,6 +32,7 @@ dependencies { annotationProcessor deps.apt.autoService compileOnly deps.build.jsr305Annotations compileOnly deps.test.jetbrainsAnnotations + compileOnly deps.apt.javaxInject compileOnly deps.build.errorProneCheckApi diff --git a/nullaway/src/main/java/com/uber/nullaway/NullAway.java b/nullaway/src/main/java/com/uber/nullaway/NullAway.java index a9f4dba424..c8744522c7 100644 --- a/nullaway/src/main/java/com/uber/nullaway/NullAway.java +++ b/nullaway/src/main/java/com/uber/nullaway/NullAway.java @@ -104,6 +104,7 @@ import java.util.stream.Collectors; import java.util.stream.StreamSupport; import javax.annotation.Nullable; +import javax.inject.Inject; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; @@ -277,6 +278,7 @@ public NullAway() { moduleElementClass = null; } + @Inject // For future Error Prone versions in which checkers are loaded using Guice public NullAway(ErrorProneFlags flags) { config = new ErrorProneCLIFlagsConfig(flags); handler = Handlers.buildDefault(config); @@ -2453,50 +2455,46 @@ static FieldInitEntities create( ImmutableSet.copyOf(staticInitializerMethods)); } - /** - * @return symbol for class - */ + /** Returns symbol for class. */ abstract Symbol.ClassSymbol classSymbol(); /** - * @return @NonNull instance fields that are not directly initialized at - * declaration + * Returns @NonNull instance fields that are not directly initialized at + * declaration. */ abstract ImmutableSet nonnullInstanceFields(); /** - * @return @NonNull static fields that are not directly initialized at declaration + * Returns @NonNull static fields that are not directly initialized at declaration. */ abstract ImmutableSet nonnullStaticFields(); /** - * @return the list of instance initializer blocks (e.g. blocks of the form `class X { { //Code - * } } ), in the order in which they appear in the class + * Returns the list of instance initializer blocks (e.g. blocks of the form `class X { { //Code + * } } ), in the order in which they appear in the class. */ abstract ImmutableList instanceInitializerBlocks(); /** - * @return the list of static initializer blocks (e.g. blocks of the form `class X { static { - * //Code } } ), in the order in which they appear in the class + * Returns the list of static initializer blocks (e.g. blocks of the form `class X { static { + * //Code } } ), in the order in which they appear in the class. */ abstract ImmutableList staticInitializerBlocks(); - /** - * @return the list of constructor - */ + /** Returns constructors in the class. */ abstract ImmutableSet constructors(); /** - * @return the list of non-static (instance) initializer methods. This includes methods - * annotated @Initializer, as well as those specified by -XepOpt:NullAway:KnownInitializers - * or annotated with annotations passed to -XepOpt:NullAway:CustomInitializerAnnotations + * Returns the list of non-static (instance) initializer methods. This includes methods + * annotated @Initializer, as well as those specified by -XepOpt:NullAway:KnownInitializers or + * annotated with annotations passed to -XepOpt:NullAway:CustomInitializerAnnotations. */ abstract ImmutableSet instanceInitializerMethods(); /** - * @return the list of static initializer methods. This includes static methods - * annotated @Initializer, as well as those specified by -XepOpt:NullAway:KnownInitializers - * or annotated with annotations passed to -XepOpt:NullAway:CustomInitializerAnnotations + * Returns the list of static initializer methods. This includes static methods + * annotated @Initializer, as well as those specified by -XepOpt:NullAway:KnownInitializers or + * annotated with annotations passed to -XepOpt:NullAway:CustomInitializerAnnotations. */ abstract ImmutableSet staticInitializerMethods(); }