Add simple null safety checker with JSpecify annotations #7
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Overview
Implements the simplest possible null safety checking system for the Bee project, addressing the question raised in the issue about adding null safety tooling inspired by enola-dev/enola#845.
What's Included
This PR adds a minimal, lightweight null safety system using JSpecify annotations that provides compile-time validation without requiring complex tooling:
1. Build System & Tooling
pom.xml
: Maven configuration with JSpecify 1.0.0 dependency and Java 21 targetcheck-nulls.sh
: Executable script for one-command null safety validation.gitignore
: Excludes Maven build artifacts2. Null Safety Annotations
Added
@Nullable
annotations to document and enforce nullability throughout the codebase:Task.java
ExecTask.java
LongIncrementingTask.java
3. Documentation
NULL_CHECKER.md
: Comprehensive guide covering usage, examples, and future enhancement optionsREADME.md
: Updated with build instructions and null checker referenceUsage
Output:
Benefits
Bug Fix
Also fixed an existing compilation bug in
Status.java
whereTIMED_OUT
was referenced in the switch statement but not declared as an enum constant.Future Enhancements
While this is the simplest possible implementation, the system can be extended with:
References
Original prompt
💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.