Aa minimal Java project demonstrating the usage of JSpecify annotations, NullAway, and Error Prone static analysis tools.
This project aims to showcase how to integrate and configure these tools in a Java project using Gradle.
git clone https://github.com/raharrison/java-jspecify-example.git
cd java-jspecify-example
./gradlew build # by default will pass, directly use nullable object to fail- The
UserRepoclass is annotated usingJSpecifyannotations - By default, the build is set up to fail if any
NullAwayerror is reported - Uncomment the line in
Mainto use a nullable object without a check beforehand. This will fail the build NullAwaywill not run on test codeNullAwayis configured to check all files in the specified project package. You can alternatively check onlyNullMarkedcode by annotating each class or through an annotatedpackage-info.javafile