Skip to content

[Feature] Enforce NullAway null-safety checks across all modules from day one #17

@limehee

Description

@limehee

Problem statement

The project uses nullable contracts (@Nullable / JSpecify), but null-safety is not enforced as a compile-time gate. This leaves room for NPE regressions in constructor paths, parser/validator flows, and Spring auto-configuration wiring during refactors or feature work.

Proposed solution

Integrate Error Prone + NullAway and enforce it across target modules immediately (no phased rollout).

  1. Enable Error Prone + NullAway for:
    • jsonrpc-core
    • jsonrpc-spring-webmvc
    • jsonrpc-spring-boot-autoconfigure
    • optionally samples/* under the same policy
  2. Configure AnnotatedPackages:
    • com.limehee.jsonrpc
  3. Make NullAway violations fail the build locally and in CI (check/ci).
  4. Define suppression policy:
    • allow @SuppressWarnings("NullAway") only when necessary
    • require a short justification comment
  5. Document:
    • local setup/run instructions
    • false-positive handling
    • suppression rules with examples

Alternatives considered

  • SpotBugs nullness checks: useful, but weaker as a compile-time enforcement gate.
  • Checker Framework: stronger type system, but higher migration and maintenance cost.
  • Keep current JSpecify-only approach: low friction, but no hard regression gate.

JSON-RPC behavior impact

No protocol-level behavior change. This is a build-time safety/quality enforcement improvement.

Additional context

Acceptance criteria:

  • NullAway enabled across target modules and wired into CI.
  • ./gradlew check fails on NullAway violations.
  • Suppressions are minimal and justified.
  • Relevant docs (README/docs/CONTRIBUTING) updated.

Metadata

Metadata

Assignees

Labels

type: featureNew feature specification and implementation.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions