Skip to content

Document that a nullImpliesNull model applies to overriding methods - #1771

Merged
msridhar merged 2 commits into
apache:masterfrom
vlsi:docs-model-inheritance
Aug 28, 2026
Merged

msridhar merged 2 commits into
apache:masterfrom
vlsi:docs-model-inheritance

Conversation

@vlsi

@vlsi vlsi commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Why

#1758 routed nullImpliesNullParameters through the override-aware lookup, so a nullImpliesNull model now reaches an overriding method whether or not that method is declared in annotated code. Two comments still state the older exact-signature rule: the lookup-policy comment in LibraryModelsHandler, twelve lines above the call that no longer follows it, and the LibraryModels#nullImpliesNullParameters javadoc, which says nothing about overriders at all. Both cost me an investigation in #1769.

What

The handler comment gives the rule for each kind of model separately, so it no longer reads as a claim about both. It also names the reason #445 carried, instead of sending the reader to the URL for it: covering the issue number in the old comment left for why this is needed, which states nothing.

The LibraryModels javadoc states the inheritance rule, and records that NullAway does not check an override against the contract (#803). LibraryModels is a published SPI, so an implementer reading the generated page cannot look at the lookup code to discover either fact.

Six @return lines described a MethodRef key as a method name, which is its own trap in a file where MethodRef.methodName is a separate field. This file already spells the same thing correctly for ensuresNonNullIfTrueMethodCalls and methodTypeVariablesWithNullableUpperBounds, so the six now match those. This was not part of the drift, and it is easy to drop from the branch if you would rather keep the two changes apart.

How to verify

./gradlew :nullaway:javadoc :nullaway:test

971 tests, 0 failures. Every changed line is a comment line, so no behavior changes.

Summary by CodeRabbit

  • Documentation
    • Clarified library model documentation for nullness contracts and parameter behavior.
    • Documented how models apply to overriding methods and annotated implementations.
    • Improved explanations of conditional nullness contracts.

Since apache#1758 nullImpliesNullParameters uses the override-aware lookup, so
the model reaches an overriding method whether or not that method is
declared in annotated code. Two comments still stated the older rule.

The lookup-policy comment in LibraryModelsHandler now gives the rule for
each kind of model separately, and names the reason issue apache#445 carried
rather than pointing at the URL for it. The LibraryModels SPI javadoc
states the inheritance rule, since an implementer reading the published
page cannot see the lookup code, and records that NullAway does not check
an override against the contract (apache#803).

Six @return lines described a MethodRef key as a method name. This file
already spells the same thing correctly for ensuresNonNullIfTrueMethodCalls
and methodTypeVariablesWithNullableUpperBounds, so they now match.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@coderabbitai

coderabbitai Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 18434dac-7ff8-4bc6-92c0-dd263da6290a

📥 Commits

Reviewing files that changed from the base of the PR and between cc156e4 and c6ba3ff.

📒 Files selected for processing (2)
  • nullaway/src/main/java/com/uber/nullaway/LibraryModels.java
  • nullaway/src/main/java/com/uber/nullaway/handlers/LibraryModelsHandler.java

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.


Walkthrough

Updated LibraryModels Javadocs to describe returned method-to-argument mappings. Added documentation for override applicability and contract verification for nullImpliesNullParameters(). Clarified LibraryModelsHandler comments about exact-signature matching, unannotated overrides, and conditional nullImpliesNull models. No method signatures or runtime behavior changed.

Suggested reviewers: msridhar

Merge Risk: ⚪ Minimal · up to c6ba3

This PR clarifies existing override behavior and corrects documentation wording without changing executable behavior, APIs, dependencies, or deployment characteristics; no actionable merge-blocking risk remains beyond normal checks and review.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description check ✅ Passed The description directly explains the documentation changes, their relation to override-aware nullImpliesNull models, the corrected MethodRef terminology, and the verification results.
Title check ✅ Passed The title clearly summarizes the primary change: documenting that nullImpliesNull models apply to overriding methods.
Docstring Coverage ✅ Passed Docstring coverage is 80.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 5 functions across 2 files.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@vlsi

vlsi commented Aug 28, 2026

Copy link
Copy Markdown
Contributor Author

Hope you don't mind @return cleanup. I can back it out if you will.

@msridhar
msridhar enabled auto-merge (squash) August 28, 2026 21:37

@msridhar msridhar left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@codecov

codecov Bot commented Aug 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.63%. Comparing base (cc156e4) to head (ed8f0c0).

Additional details and impacted files
@@            Coverage Diff            @@
##             master    #1771   +/-   ##
=========================================
  Coverage     87.63%   87.63%           
  Complexity     3273     3273           
=========================================
  Files           109      109           
  Lines         11031    11031           
  Branches       2233     2233           
=========================================
  Hits           9667     9667           
  Misses          641      641           
  Partials        723      723           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@msridhar
msridhar merged commit 17d7ca7 into apache:master Aug 28, 2026
6 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants