Repository navigation
Complete the nullable annotations - #1162
Merged
drewnoakes merged 8 commits intoMay 25, 2026
Merged
Conversation
drewnoakes
force-pushed
the
nullable-annotations-100-percent
branch
from
May 24, 2026 12:35
5e5f07b to
684fffd
Compare
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove the JetBrains.Annotations package reference from Directory.Build.props and all project-level version overrides. Strip [CanBeNull], [NotNull], and [UsedImplicitly] attributes from all source files, along with their using directives. No other JetBrains annotation types were in use. The five files that still have #nullable disable will get proper native nullable annotations in subsequent commits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
These attributes were introduced in .NET 5 but are needed for the netstandard2.1 and net472 targets. They will be used when annotating late-initialized fields in subsequent commits. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove #nullable disable and annotate the generic linked-chunk queue: - Chunk.Next and Chunk.Previous are now Chunk? (nullable linked-list links) - Use null-forgiving operator at linked-list navigation points where queue invariants guarantee non-null (Pop, Push, Unpush) - Replace default(T) with default! for slot clearing - Remove redundant Debug.Assert(Values != null) after array construction Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove #nullable disable and annotate all nullable types: - m_next is now Trie?[]? (nullable array of nullable elements) - TrieDelegate data/arg parameters are nullable - Use null-forgiving operator where trie invariants guarantee non-null - Fix downstream XSub.cs warning from nullable delegate arg - Remove unused using and redundant Debug.Assert Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove #nullable disable and annotate all nullable types: - m_pipes is now HashSet<Pipe>? (null when no subscriptions) - m_next is now MultiTrie?[]? (nullable array of nullable elements) - MultiTrieDelegate data/arg parameters are nullable - Remove bogus Debug.Assert(prefix != null) for Span<byte> (fixes CA2265) - Use null-forgiving operator where trie invariants guarantee non-null - Fix downstream XPub.cs warnings from nullable delegate arg Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove #nullable disable and annotate all nullable types: - m_reaper is now Reaper? (late-initialized in CreateSocket) - m_slots is now IMailbox?[]? (late-initialized, elements nullable) - ChooseIOThread returns IOThread? (already matched by ZObject wrapper) - Use null-forgiving operator where lifecycle invariants guarantee non-null - Remove redundant Debug.Assert(addr != null) on non-nullable parameter Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Remove #nullable disable and annotate all nullable types: - m_handle, m_session, m_socket, m_ioObject are lifecycle-nullable - m_encoder, m_decoder, m_mechanism are nullable until handshake - m_inpos, m_outpos are nullable buffer positions - Use null-forgiving operator where state machine invariants guarantee non-null (post-Plug, post-handshake, post-V3-handshake) - Remove redundant null assignments in constructor for nullable fields This is the file that motivated the nullable annotation effort (PR zeromq#1160). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
drewnoakes
force-pushed
the
nullable-annotations-100-percent
branch
from
May 24, 2026 12:42
684fffd to
5ee2b20
Compare
This was referenced Aug 3, 2026
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.
This gets all the code null annotated. There are several places where the design makes it hard to avoid null forgiveness operators, so they have been added where needed. In future we may pay those off.
Motivated by the error reported in #1159 and fixed in #1160.