jspecify-nullness
JSpecify Nullness (Java)
Quick start
- Use
@NullMarkedto make unannotated types non-null by default. - Add
@Nullableonly where null is allowed; use@NonNullsparingly when you must override a nullable type variable use. - Decide type parameter bounds up front:
<T extends @Nullable Object>allows nullable type arguments,<T>does not. - Use
@NullUnmarkedto opt out of@NullMarkedin legacy or incremental areas. - Keep annotations in recognized type-use positions (arrays, nested types, type arguments).
- Read
references/jspecify-nullness.mdfor migration steps, syntax pitfalls, and tooling details.
Workflow
- Confirm tool support and constraints (nullness checker, Kotlin version, annotation processors).
- Add the
org.jspecify:jspecifydependency and expose it to consumers. - Annotate nullable types first, then add
@NullMarkedat class or package scope. - Fix generics: set bounds for type parameters and annotate type-variable uses as needed.
- Run nullness analysis, resolve findings, and repeat for adjacent code.
Rules of thumb
- Treat unannotated types outside
@NullMarkedas unspecified nullness, not non-null.
More from alexandru/skills
cats-effect-io
Scala functional programming with Cats Effect IO and typeclasses. Use for wrapping side effects, modeling purity, choosing Sync/Async/Temporal/Concurrent, handling blocking I/O, and composing resources, fibers, and concurrency safely.
40cats-effect-resource
Scala resource lifecycle management with Cats Effect `Resource` and `IO`. Use when defining safe acquisition/release, composing resources (including parallel acquisition), or designing resource-safe APIs and cancellation behavior for files, streams, pools, clients, and background fibers.
37cats-mtl-typed-errors
Scala typed errors with Cats MTL Raise/Handle and allow/rescue. Use for designing custom domain error types without EitherT, while keeping Cats Effect and ecosystem composition. Covers Scala 2/3 syntax and IO-only or F[_] usage.
24akka-streams
Scala reactive streaming with Akka Streams and Pekko Streams. Use for dataflow and reactive programming patterns, testing stream components, and understanding when NOT to use streams (prefer plain functions for transformations and I/O).
20arrow-typed-errors
Kotlin + Arrow typed error handling using Raise DSL and wrapper types (Either/Option/Ior/Result/nullable), including validation with accumulation, interop with exceptions, and custom error wrappers. Use for designing or refactoring error modeling, converting exception-based flows, building smart constructors, accumulating validation errors, or integrating Outcome/Progress-style wrappers with Arrow.
16kotlin-java-library
Kotlin design for Java libraries and Java consumers. Use when building Kotlin code intended for Java callers, aligning with Java interop, JVM annotations, records, and backward/binary compatibility rules.
15