diff --git a/build.gradle b/build.gradle index f3fdf3233d0..44d081bdf7d 100644 --- a/build.gradle +++ b/build.gradle @@ -24,6 +24,9 @@ plugins { id 'checkstyle' + // Homepage: https://github.com/kelloggm/checkerframework-gradle-plugin + id 'org.checkerframework' version '0.6.40' + id 'project-report' id 'idea' @@ -38,6 +41,8 @@ apply plugin: XjcPlugin apply from: 'eclipse.gradle' +apply plugin: 'org.checkerframework' + group = "org.jabref" version = project.findProperty('projVersion') ?: '100.0.0' @@ -322,6 +327,11 @@ dependencies { rewrite("org.openrewrite.recipe:rewrite-testing-frameworks") rewrite("org.openrewrite.recipe:rewrite-migrate-java") + // checker framework + compileOnly 'org.checkerframework:checker-qual:3.44.0' + testCompileOnly 'org.checkerframework:checker-qual:3.44.0' + checkerFramework 'org.checkerframework:checker:3.44.0' + configurations.checkstyle { resolutionStrategy.capabilitiesResolution.withCapability("com.google.collections:google-collections") { select("com.google.guava:guava:0") @@ -614,6 +624,13 @@ checkstyle { sourceSets = [] } +checkerFramework { + checkers = [ + 'org.checkerframework.checker.nullness.NullnessChecker' + ] + excludeTests = true +} + rewrite { activeRecipe( 'org.jabref.config.rewrite.cleanup' diff --git a/src/main/java/module-info.java b/src/main/java/module-info.java index 352ef69c95b..fa4ceb494ac 100644 --- a/src/main/java/module-info.java +++ b/src/main/java/module-info.java @@ -143,6 +143,7 @@ uses org.eclipse.jgit.lib.GpgSigner; requires transitive org.jspecify; + requires org.checkerframework.checker.qual; // other libraries requires org.antlr.antlr4.runtime; diff --git a/src/main/java/org/jabref/logic/pdf/search/PdfIndexer.java b/src/main/java/org/jabref/logic/pdf/search/PdfIndexer.java index 45750ac5b84..1986c6c109b 100644 --- a/src/main/java/org/jabref/logic/pdf/search/PdfIndexer.java +++ b/src/main/java/org/jabref/logic/pdf/search/PdfIndexer.java @@ -55,8 +55,7 @@ public class PdfIndexer { private final FilePreferences filePreferences; - @Nullable - private final Directory indexDirectory; + private final @Nullable Directory indexDirectory; private IndexReader reader;