Skip to content

Commit

Permalink
Merge branch 'master' into jspecify-array-contents-nullability
Browse files Browse the repository at this point in the history
  • Loading branch information
armughan11 authored Feb 5, 2024
2 parents 08e79e9 + 3fc9b8a commit bdda3ae
Show file tree
Hide file tree
Showing 17 changed files with 432 additions and 126 deletions.
83 changes: 54 additions & 29 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,30 @@
Changelog
=========
Version 0.10.22
---------------
IMPORTANT: The support for JDK 8 is deprecated in this release and will be removed in
an upcoming release.

* Fix bug with implicit equals() methods in interfaces (#898)
* Fix crash with raw types in overrides in JSpecify mode (#899)
* Docs fix: Update instructions for Android and our sample app (#900)

Version 0.10.21
---------------
IMPORTANT: This release fixes a crash when running against <2.24.0 release of
Error Prone (see #894) introduced in NullAway v0.10.20 and another crash related to
Checker Framework (see #895) introduced in NullAway v0.10.19.

* Fix backwards-incompatible calls to ASTHelpers.hasDirectAnnotationWithSimpleName (#894)
* Downgrade to Checker Framework 3.40.0 (#895)

Version 0.10.20
---------------
* Fix JSpecify support on JDK 21 (#869)
* Build / CI tooling upgrades for NullAway itself:
- Update to WALA 1.6.3 (#887)
- Update to Error Prone 2.24.1 (#888)

Version 0.10.19
---------------
* Update to Checker Framework 3.41.0 (#873)
Expand Down Expand Up @@ -110,7 +135,7 @@ Note: This is the first release built with Java 11. In particular, running
- Update to Error Prone 2.20.0 (#772)
- Add tasks to run JDK 8 tests on JDK 11+ (#778)
- Switch to Spotless for formatting Java code (#780)
- Added GCP JMH Benchmark Workflow (#770)
- Added GCP JMH Benchmark Workflow (#770)
- Set concurrency for JMH benchmarking workflow (#784)
- Disable daemon when running benchmarks (#786)
- Update to Gradle 8.2.1 (#781)
Expand Down Expand Up @@ -194,7 +219,7 @@ Version 0.10.6
* Fix logic for @Nullable annotation on type parameter (#702)
* Preserve nullness checks in final fields when propagating nullness into inner contexts (#703)
* NullAwayInfer/Annotator data serialization support [experimental]
- Add source offset and path to reported errors in error serialization. (#704)
- Add source offset and path to reported errors in error serialization. (#704)
* Build / CI tooling for NullAway itself:
- [Jspecify] Update test dep to final JSpecify 0.3.0 release (#700)
= Intermediate PRs: 0.3.0-alpha-3 (#692), 0.3-alpha2 (#691)
Expand Down Expand Up @@ -226,10 +251,10 @@ Version 0.10.3
--------------
* Report an error when casting @Nullable expression to primitive type (#663)
* Fix an NPE in the optional emptiness handler (#678)
* Add support for boolean constraints (about nullness) in Contract annotations (#669)
* Add support for boolean constraints (about nullness) in Contract annotations (#669)
* Support for specific libraries/APIs:
- PreconditionsHandler reflects Guava Preconditions exception types (#668)
- Handle Guava Verify functions (#682)
- Handle Guava Verify functions (#682)
* Dependency Updates:
- checkerframework 3.26.0 (#671)
* Build / CI tooling for NullAway itself:
Expand All @@ -238,7 +263,7 @@ Version 0.10.3

Version 0.10.2
--------------
* Make AbstractConfig collection fields explicity Immutable (#601)
* Make AbstractConfig collection fields explicity Immutable (#601)
* NullAwayInfer/Annotator data serialization support [experimental]
- Fix crash in fixserialization when ClassSymbol.sourcefile is null (#656)

Expand Down Expand Up @@ -302,7 +327,7 @@ Version 0.9.8
- Model for com.google.api.client.util.Strings.isNullOrEmpty (#605)
* Refactoring:
- Cleanups to AccessPath representation and implementation (#603)
- Clean-up: Remove unused fix suggestion code. (#615)
- Clean-up: Remove unused fix suggestion code. (#615)
* Dependency Updates:
- Update to Checker Framework 3.22.2 (#610)
* Build / CI tooling for NullAway itself:
Expand Down Expand Up @@ -354,7 +379,7 @@ Version 0.9.6
* Build / CI tooling for NullAway itself:
- Enable parallel builds (#549) (#555)
- Add dependence from coveralls task to codeCoverageReport (#552)
- Switch to temurin on CI (#553)
- Switch to temurin on CI (#553)
- Separating NullAwayTests into smaller files (#550)
- Require braces for all conditionals and loops (#556)
- Enable build cache (#562)
Expand All @@ -364,7 +389,7 @@ Version 0.9.6
- Update CI jobs (#565)
- Set epApiVersion for jacoco coverage reporting (#566)
- Compile and test against Error Prone 2.11.0 (#567)
- Fix EP version for jacoco coverage step (#571)
- Fix EP version for jacoco coverage step (#571)
- Update to latest Google Java Format (#572)

Version 0.9.5
Expand All @@ -386,7 +411,7 @@ Version 0.9.3
-------------
IMPORTANT: This version introduces EXPERIMENTAL JDK17 support.
There is a known crash on lambdas with switch expressions as body
(see #524). Best current workaround is to
(see #524). Best current workaround is to
`@SuppressWarnings("NullAway")` on the enclosing method
* Improve reporting of multiple parameter errors on a single method call (#503)
* Support compile-time constant field args in method Access Paths (#504)
Expand Down Expand Up @@ -478,13 +503,13 @@ Version 0.8.0

Version 0.7.10
--------------
* Add Java 8 streams nullness-propagation support (#371)
* Add Java 8 streams nullness-propagation support (#371)
* Give line numbers for uninitialized fields when reporting error on an initializer (#380)
* Include outer$inner class name when reporting field init errors (#375)
* Include outer$inner class name when reporting field init errors (#375)
* Update to Gradle 6.1.1 (#381)
* Add @MonotonicNonNull as lazy initialization annotation. (#383)
* Add default library model for CompilationUnitTree.getPackageName() (#384)
* Improve matching of native Map methods (#390)
* Improve matching of native Map methods (#390)
- Fixes an IndexOutOfBoundsException checker crash

Version 0.7.9
Expand All @@ -494,14 +519,14 @@ Version 0.7.9
- WALA to 1.5.4 (#337)
- Checker Dataflow to 3.0.0 (#369)
* Added OPTIONAL_CONTENT synthetic field to track Optional emptiness (#364)
- With this, `-XepOpt:NullAway:CheckOptionalEmptiness` should be
- With this, `-XepOpt:NullAway:CheckOptionalEmptiness` should be
ready for use.
* Handle Nullchk operator (#368)

Version 0.7.8
-------------
* Added NullAway.Optional suppression (#359)
* [JarInfer] Ignore non-public classes when inferring annotations. (#360)
* Added NullAway.Optional suppression (#359)
* [JarInfer] Ignore non-public classes when inferring annotations. (#360)

Version 0.7.7
-------------
Expand Down Expand Up @@ -537,7 +562,7 @@ Version 0.7.4
* Refactor the driver and annotation summary type in JarInfer (#317)
* Minor refactor and cleanup in JarInfer-lib (#319)
* Different approach for param analysis (#320)
* Fix @NullableDecl support (#324)
* Fix @NullableDecl support (#324)
* Treat methods of final classes as final for initialization. (#325)

Version 0.7.3
Expand All @@ -551,7 +576,7 @@ Version 0.7.3

Version 0.7.2
-------------
* Install GJF hook using a gradle task, rather than a gradlew hack (#298).
* Install GJF hook using a gradle task, rather than a gradlew hack (#298).
* Nullable switch expression support (#300).
* Upgrade to Error Prone 2.3.3 (#295).
Update Gradle, Error Prone plugin, and Android Gradle Plugin (#294).
Expand All @@ -572,7 +597,7 @@ Version 0.7.0

Version 0.6.6
---------------
This only adds a minor library fix supporting Guava's Preconditions.checkNotNull with an error message
This only adds a minor library fix supporting Guava's Preconditions.checkNotNull with an error message
argument (#283)

Version 0.6.5
Expand Down Expand Up @@ -602,29 +627,29 @@ Version 0.6.2
Version 0.6.1
-------------
* Enable excluded class annotations to (mostly) work on inner classes (#239)
* Assertion of not equal to null updates the access path (#240)
* Assertion of not equal to null updates the access path (#240)
* Update Gradle examples in README (#244)
* Change how jarinfer finds astubx model jars. (#243)
* Update to Error Prone 2.3.2 (#242)
* Update net.ltgt.errorprone to 0.6, and build updates ((#248)
* Restrictive annotated method overriding (#249)
Note: This can require significant annotation changes if
* Restrictive annotated method overriding (#249)
Note: This can require significant annotation changes if
`-XepOpt:NullAway:AcknowledgeRestrictiveAnnotations=true` is set.
Not a new minor version, since that option is false by default.
* Fix error on checking the initTree2PrevFieldInit cache. (#252)
* Fix error on checking the initTree2PrevFieldInit cache. (#252)
* Add support for renamed android.support packages in models. (#253)

Version 0.6.0
-------------
* Add support for marking library parameters as explicitly @Nullable (#228)
* De-genericize NullnessStore (#231)
* Bump Checker Framework to 2.5.5 (#233)
* Pass nullability info on enclosing locals into dataflow analysis for
* Pass nullability info on enclosing locals into dataflow analysis for
lambdas and anonymous / local classes (#235)

Version 0.5.6
-------------
* Add coverage measurement through coveralls. (#224)
* Add coverage measurement through coveralls. (#224)
* Fix empty comment added when AutoFixSuppressionComment is not set. (#225)
* Make JarInfer generated jars fully deterministic by removing timestamps. (#227)

Expand Down Expand Up @@ -657,7 +682,7 @@ android-jarinfer-models-sdk28 artifacts
Version 0.5.2
-------------
* Fix NPE in Thrift handler on complex receiver expressions (#195)
* Add ExcludedFieldAnnotations unit tests. (#192)
* Add ExcludedFieldAnnotations unit tests. (#192)
* Various crash fixes (#196)
* Fix @NonNull argument detection in RestrictiveAnnotationHandler. (#198)

Expand All @@ -683,7 +708,7 @@ Version 0.4.7
Version 0.4.6
-------------
* Fix a couple of Thrift issues (#164)
* Don't report initialization warnings on fields for @ExternalInit classes with
* Don't report initialization warnings on fields for @ExternalInit classes with
no initializer methods (#166)

Version 0.4.5
Expand Down Expand Up @@ -732,7 +757,7 @@ Version 0.3.6

Version 0.3.5
-------------
* Support for treating `@Generated`-annotated classes as unannotated (#127)
* Support for treating `@Generated`-annotated classes as unannotated (#127)

Version 0.3.4
-------------
Expand Down Expand Up @@ -804,8 +829,8 @@ Version 0.1.5
-------------
* Add finer grained suppressions and auto-fixes (#31). You can
suppress initialization errors specifically now with
`@SuppressWarnings("NullAway.Init")`
* Fix performance issue with lambdas (#29)
`@SuppressWarnings("NullAway.Init")`
* Fix performance issue with lambdas (#29)
* Add lambda support to the RxNullabilityPropagator handler. (#12)

Version 0.1.4
Expand Down
10 changes: 2 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,15 +58,9 @@ Snapshots of the development version are available in [Sonatype's snapshots repo

#### Android

The configuration for an Android project is very similar to the Java case, with one key difference: The `com.google.code.findbugs:jsr305:3.0.2` dependency can be removed; you can use the `android.support.annotation.Nullable` annotation from the Android Support library.
Versions 3.0.0 and later of the Gradle Error Prone Plugin [no longer support Android](https://github.com/tbroyer/gradle-errorprone-plugin/releases/tag/v3.0.0). So if you're using a recent version of this plugin, you'll need to add some further configuration to run Error Prone and NullAway. Our [sample app `build.gradle` file](https://github.com/uber/NullAway/blob/master/sample-app/build.gradle) shows one way to do this, but your Android project may require tweaks. Alternately, 2.x versions of the Gradle Error Prone Plugin still support Android and may still work with your project.

```gradle
dependencies {
errorprone "com.uber.nullaway:nullaway:<NullAway version>"
errorprone "com.google.errorprone:error_prone_core:<Error Prone version>"
}
```
For a more complete example see our [sample app](https://github.com/uber/NullAway/blob/master/sample-app/). (The sample app's [`build.gradle`](https://github.com/uber/NullAway/blob/master/sample-app/) is not suitable for direct copy-pasting, as some configuration is inherited from the top-level `build.gradle`.)
Beyond that, compared to the Java configuration, the `com.google.code.findbugs:jsr305:3.0.2` dependency can be removed; you can use the `android.support.annotation.Nullable` annotation from the Android Support library instead.

#### Annotation Processors / Generated Code

Expand Down
36 changes: 20 additions & 16 deletions buildSrc/src/main/groovy/nullaway.java-test-conventions.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,22 +44,6 @@ configurations.create('transitiveSourcesElements') {
}
}

// Share the coverage data to be aggregated for the whole product
configurations.create('coverageDataElements') {
visible = false
canBeResolved = false
canBeConsumed = true
extendsFrom(configurations.implementation)
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, 'jacoco-coverage-data'))
}
// This will cause the test task to run if the coverage data is requested by the aggregation task
outgoing.artifact(tasks.named("test").map { task ->
task.extensions.getByType(JacocoTaskExtension).destinationFile
})
}

test {
maxHeapSize = "1024m"
Expand Down Expand Up @@ -118,3 +102,23 @@ def testJdk21 = tasks.register("testJdk21", Test) {
tasks.named('check').configure {
dependsOn testJdk21
}


// Share the coverage data to be aggregated for the whole product
configurations.create('coverageDataElements') {
visible = false
canBeResolved = false
canBeConsumed = true
extendsFrom(configurations.implementation)
attributes {
attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage, Usage.JAVA_RUNTIME))
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category, Category.DOCUMENTATION))
attribute(DocsType.DOCS_TYPE_ATTRIBUTE, objects.named(DocsType, 'jacoco-coverage-data'))
}
// This will cause the test tasks to run if the coverage data is requested by the aggregation task
tasks.withType(Test).forEach {task ->
// tasks.named(task.name) is a hack to introduce the right task dependence in Gradle. We will fix this
// correctly when addressing https://github.com/uber/NullAway/issues/871
outgoing.artifact(tasks.named(task.name).map { t -> t.extensions.getByType(JacocoTaskExtension).destinationFile })
}
}
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.20-SNAPSHOT
VERSION_NAME=0.10.23-SNAPSHOT

POM_DESCRIPTION=A fast annotation-based null checker for Java

Expand Down
4 changes: 3 additions & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ if (project.hasProperty("epApiVersion")) {

def versions = [
asm : "9.3",
checkerFramework : "3.41.0",
checkerFramework : "3.40.0",
// for comparisons in other parts of the build
errorProneLatest : latestErrorProneVersion,
// The version of Error Prone used to check NullAway's code.
Expand All @@ -67,10 +67,12 @@ def build = [
asm : "org.ow2.asm:asm:${versions.asm}",
asmTree : "org.ow2.asm:asm-tree:${versions.asm}",
errorProneCheckApi : "com.google.errorprone:error_prone_check_api:${versions.errorProneApi}",
errorProneCheckApiOld : "com.google.errorprone:error_prone_check_api:${oldestErrorProneVersion}",
errorProneCore : "com.google.errorprone:error_prone_core:${versions.errorProne}",
errorProneCoreForApi : "com.google.errorprone:error_prone_core:${versions.errorProneApi}",
errorProneJavac : "com.google.errorprone:javac:9+181-r4173-1",
errorProneTestHelpers : "com.google.errorprone:error_prone_test_helpers:${versions.errorProneApi}",
errorProneTestHelpersOld: "com.google.errorprone:error_prone_test_helpers:${oldestErrorProneVersion}",
checkerDataflow : "org.checkerframework:dataflow-nullaway:${versions.checkerFramework}",
guava : "com.google.guava:guava:30.1-jre",
javaxValidation : "javax.validation:validation-api:2.0.1.Final",
Expand Down
Loading

0 comments on commit bdda3ae

Please sign in to comment.