Replace JetBrains nullness annotations with JSpecify - #680
Open
koppor wants to merge 1 commit into
Open
Conversation
JSpecify is the vendor-neutral nullness standard understood by IntelliJ, Eclipse, NullAway, Kotlin and Error Prone, so annotating with it makes the API contract usable by every consumer rather than only by JetBrains tooling. Every package under src/main is now @NullMarked, which makes non-null the default and lets ~730 @NotNull annotations be deleted outright; @nullable is kept where a value may be absent. flexmark-util-sequence and flexmark-util-experimental keep the JetBrains jar for @contract and @testonly, which have no JSpecify equivalent. JSpecify's @nullable is TYPE_USE only, so a few declarations had to move the annotation into the type position: `byte @nullable []` for a nullable array and `Map.@nullable Entry` for a nested type. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01PnkbonPy2LuAic9fPP9Xpi
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
🤖 Nullness is currently expressed with
org.jetbrains:annotations, which only JetBrains tooling treats as authoritative; JSpecify is the vendor-neutral standard that IntelliJ, Eclipse, NullAway, Error Prone and Kotlin all understand, so switching makes the API contract usable by every consumer (addresses #418). Everysrc/mainpackage is now@NullMarked— non-null becomes the default, which lets ~730@NotNullannotations be deleted outright — and@Nullableis swapped toorg.jspecify;flexmark-util-sequenceandflexmark-util-experimentalkeep the JetBrains jar for@Contractand@TestOnly, which JSpecify has no equivalent for. No behaviour changes: the annotations carryCLASSretention and are not read at runtime.Test steps:
mvn test -Dsurefire.useFile=false— all modules pass.flexmark-profile-pegdownerrors on JDK 17 (parboiledcannot generateorg.pegdown.Parser$$parboiled); this reproduces identically on unmodifiedmasterand is unrelated to this change.🤖 Generated with Claude Code
https://claude.ai/code/session_01PnkbonPy2LuAic9fPP9Xpi