File tree Expand file tree Collapse file tree 5 files changed +15
-14
lines changed
src/main/java/com/example/myapp Expand file tree Collapse file tree 5 files changed +15
-14
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ jobs:
1313
1414 steps :
1515 - uses : actions/checkout@v4
16- - name : Set up JDK 21
16+ - name : Set up JDK 25
1717 uses : actions/setup-java@v4
1818 with :
19- java-version : ' 21 '
19+ java-version : ' 25 '
2020 distribution : ' temurin'
2121 - name : Setup Gradle
2222 uses : gradle/actions/setup-gradle@v4
Original file line number Diff line number Diff line change @@ -10,15 +10,14 @@ This project aims to showcase how to integrate and configure these tools in a Ja
1010``` bash
1111git clone https://github.com/raharrison/java-jspecify-example.git
1212cd java-jspecify-example
13- ./gradlew build
13+ ./gradlew build # by default will pass, directly use nullable object to fail
1414```
1515
1616### Notes
1717
18- - The ` UserRepo ` class is annotated using ` JSpecify `
18+ - The ` UserRepo ` class is annotated using ` JSpecify ` annotations
1919- By default, the build is set up to fail if any ` NullAway ` error is reported
2020- Uncomment the line in ` Main ` to use a nullable object without a check beforehand. This will fail the build
2121- ` NullAway ` will not run on test code
2222- ` NullAway ` is configured to check all files in the specified project package. You can alternatively check only ` NullMarked ` code
23- by annotating each class
24- or through an annotated ` package-info.java ` file
23+ by annotating each class or through an annotated ` package-info.java ` file
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import net.ltgt.gradle.errorprone.errorprone
33plugins {
44 application
55 id(" java" )
6- id(" com.gradleup.shadow" ) version " 8.3.6 "
6+ id(" com.gradleup.shadow" ) version " 9.2.2 "
77 id(" net.ltgt.errorprone" ) version " 4.3.0"
88}
99
@@ -15,12 +15,13 @@ repositories {
1515}
1616
1717dependencies {
18- testImplementation(platform(" org.junit:junit-bom:5.11.4 " ))
18+ testImplementation(platform(" org.junit:junit-bom:6.0.0 " ))
1919 testImplementation(" org.junit.jupiter:junit-jupiter" )
20+ testRuntimeOnly(" org.junit.platform:junit-platform-launcher" )
2021
2122 implementation(" org.jspecify:jspecify:1.0.0" )
22- errorprone(" com.google.errorprone:error_prone_core:2.40 .0" )
23- errorprone(" com.uber.nullaway:nullaway:0.12.7 " )
23+ errorprone(" com.google.errorprone:error_prone_core:2.43 .0" )
24+ errorprone(" com.uber.nullaway:nullaway:0.12.11 " )
2425}
2526
2627tasks.test {
@@ -29,7 +30,7 @@ tasks.test {
2930
3031java {
3132 toolchain {
32- languageVersion = JavaLanguageVersion .of(21 )
33+ languageVersion = JavaLanguageVersion .of(25 )
3334 }
3435}
3536
Original file line number Diff line number Diff line change 11distributionBase =GRADLE_USER_HOME
22distributionPath =wrapper/dists
3- distributionUrl =https\://services.gradle.org/distributions/gradle-8.13 -bin.zip
3+ distributionUrl =https\://services.gradle.org/distributions/gradle-9.2.0 -bin.zip
44zipStoreBase =GRADLE_USER_HOME
55zipStorePath =wrapper/dists
Original file line number Diff line number Diff line change 22
33public class Main {
44
5- public static void main (String [] args ) {
5+ static void main () {
66 var repo = new UserRepo ();
77
88 User user = repo .getUserById ("1" );
9- // System.out.println(user.username()); // possible NPE!
9+ // System.out.println(user.username()); // possible NPE!
10+
1011 if (user != null ) {
1112 System .out .println ("Found user: " + user .username ());
1213 } else {
You can’t perform that action at this time.
0 commit comments