From 3d92c2671b320078c9ca306939a0ad77bd0f75a6 Mon Sep 17 00:00:00 2001 From: nscuro Date: Thu, 13 Aug 2026 18:28:28 +0200 Subject: [PATCH] feat: enforce null-safety at compile time Adds NullAway to enforce null-safety (which is already declared using JSpecify) at compile time. Had to replace a few `StringUtil#isEmpty` calls with inlined versions to allow NullAway to "see" the null-check. Note that NullAway is only enabled for production code, and explicitly disabled for test code. This is because you usually want to violate null-safety in tests. Signed-off-by: nscuro --- pom.xml | 21 +++++++++++++++++-- .../com/github/packageurl/PackageURL.java | 6 +++--- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 8923361..62cd0cd 100644 --- a/pom.xml +++ b/pom.xml @@ -131,6 +131,7 @@ 2.18.0 2.38.0 + 0.13.8 0.8.13 2.58.0 4.9.3.0 @@ -325,7 +326,11 @@ -XDcompilePolicy=simple --should-stop=ifError=FLOW - -Xplugin:ErrorProne -XepExcludedPaths:.*/generated-test-sources/.* + -Xplugin:ErrorProne + -XepExcludedPaths:.*/generated-test-sources/.* + -Xep:NullAway:ERROR + -XepOpt:NullAway:OnlyNullMarked=true + -XepOpt:NullAway:TreatGeneratedAsUnannotated=true