jspecify-nullness

Installation
SKILL.md

JSpecify Nullness (Java)

Quick start

  • Add org.jspecify:jspecify:1.0.0 as a visible API dependency for Java libraries.
  • Prefer @NullMarked at package or class scope; add @Nullable only where null is allowed.
  • Treat unannotated types outside @NullMarked as unspecified nullness, not non-null.
  • Decide generic bounds deliberately: <T extends @Nullable Object> accepts nullable type arguments; <T> does not in a null-marked scope.
  • Keep @Nullable/@NonNull in JSpecify-recognized type-use locations, especially for arrays, nested types, type arguments, and bounds.
  • Read references/jspecify-nullness.md before substantial annotation, migration, or tooling advice.

Workflow

  1. Confirm consumer constraints: nullness checker, Kotlin compiler behavior, and annotation processors.
  2. Add the JSpecify dependency without hiding it from downstream users.
  3. Annotate nullable types first, then add @NullMarked at class or package scope.
  4. Fix generics: choose nullable/non-null bounds and annotate type-variable uses only when the use differs from the type argument.
  5. Compile examples for syntax, then run a JSpecify-aware nullness analyzer and fix findings before expanding scope.
Installs
24
GitHub Stars
49
First Seen
Feb 20, 2026
jspecify-nullness — alexandru/skills