Skip to content

docs: Add nullability checks article for JSpecify annotations#5212

Open
mshabarov wants to merge 6 commits intomainfrom
nullability-article
Open

docs: Add nullability checks article for JSpecify annotations#5212
mshabarov wants to merge 6 commits intomainfrom
nullability-article

Conversation

@mshabarov
Copy link
Copy Markdown
Contributor

Add comprehensive documentation for type-parameter-level nullability checks using JSpecify annotations in Vaadin Flow. Covers:

  • Overview of JSpecify and type parameter nullability pattern
  • Benefits of compile-time null safety
  • @NullMarked annotation for class and package levels
  • Static analysis with NullAway
  • Current usage in Signal APIs with examples
  • Working with nullable and non-null signals
  • Custom generic classes with nullable type parameters
  • List and collection type nullability
  • Best practices for null safety

Based on PR vaadin/flow#23630 which introduced type-parameter-level nullability for Signal APIs.

🤖 Generated with Claude Code

Add comprehensive documentation for type-parameter-level nullability checks using JSpecify annotations in Vaadin Flow. Covers:
- Overview of JSpecify and type parameter nullability pattern
- Benefits of compile-time null safety
- @NullMarked annotation for class and package levels
- Static analysis with NullAway
- Current usage in Signal APIs with examples
- Working with nullable and non-null signals
- Custom generic classes with nullable type parameters
- List and collection type nullability
- Best practices for null safety

Based on PR vaadin/flow#23630 which introduced type-parameter-level nullability for Signal APIs.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
@mshabarov
Copy link
Copy Markdown
Contributor Author

I wonder if need to document NullAway plugin and compiler config as the must-have option, see https://github.com/vaadin/signals-cases/blob/45334f4655a895dce48c4260a30af69af15557bf/pom.xml#L101 ?

@Artur-
Copy link
Copy Markdown
Member

Artur- commented Mar 3, 2026

This looks like the specific documentation for generic type nullability, but we have no nullability documentation to base it on as far as i could find. IMO we need docs about nullability annotations, what they are, how you can enable them in your project, and that Vaadin has them currently enabled for signals only. That they are used for generic types is one detail, similar to that they are used for parameter types and return types

@Artur-
Copy link
Copy Markdown
Member

Artur- commented Mar 3, 2026

For projects we should probably suggest the maven/gradle plugin + JDK >= 22 instead of a lot of custom options

@peholmst peholmst added the target/v25.1 Automatically cherry-pick to the v25.1 branch label Mar 25, 2026
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 7, 2026

Preview Deployment

This PR has been deployed for preview.

URL: https://docs-preview-pr-5212.fly.dev

Built from d7222a1

Artur- added 2 commits April 7, 2026 10:45
Rewrite the JSpecify nullability article based on PR review feedback.
The article now covers nullability annotations in general (parameters,
return types, and type arguments) instead of focusing narrowly on
generic type parameter nullability. Adds project setup instructions
using nullability-maven-plugin and gradle-errorprone-plugin with
JDK 22+ requirement. Renames file from type-parameter-nullability.adoc
to nullability.adoc to reflect the broader scope.
@Artur-
Copy link
Copy Markdown
Member

Artur- commented Apr 7, 2026

Expanded the doc to be about nullability in general and not only type parameters

Artur- added 2 commits April 7, 2026 14:19
Frame enabling null checking as: (1) always recommended for checking
Vaadin types, with a concrete SignalExample showing what the compiler
catches, and (2) optional extension to your own code via package-level
@NullMarked. Also removes JSpecify dependency section since it is
included automatically.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

target/v25.1 Automatically cherry-pick to the v25.1 branch

Projects

Status: 🔎Iteration reviews

Development

Successfully merging this pull request may close these issues.

3 participants