-
Notifications
You must be signed in to change notification settings - Fork 322
Add tests for gh-1246 #1247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add tests for gh-1246 #1247
Conversation
Demos that nullable super invocations fail
WalkthroughAdds two ignored JSpecify generics nullability tests to GenericsTests.java, covering passing null to a super constructor and a super method via generic types. No production code changes. Changes
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~3 minutes Suggested reviewers
Tip 🔌 Remote MCP (Model Context Protocol) integration is now available!Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats. ✨ Finishing Touches
🧪 Generate 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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (1)
nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java (1)
2367-2387: Make the super call explicit to match the test intentGiven the test name nullableSuperMethodArg and the PR objective (super invocation behavior), consider calling the super implementation explicitly to ensure we’re covering the super method invocation path rather than relying on method resolution through this.
Apply this diff inside the .addSourceLines() snippet:
- " void test() {", - " m(null);", + " void test() {", + " super.m(null);",Optionally, add a negative companion scenario elsewhere (non-blocking) to assert an error for a non-null instantiation, e.g., extend A and invoke super.m(null) with a “BUG: Diagnostic contains …” assertion.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java(1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: msridhar
PR: uber/NullAway#1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.094Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.
📚 Learning: 2025-08-14T18:50:06.094Z
Learnt from: msridhar
PR: uber/NullAway#1245
File: guava-recent-unit-tests/src/test/java/com/uber/nullaway/guava/NullAwayGuavaParametricNullnessTests.java:101-102
Timestamp: 2025-08-14T18:50:06.094Z
Learning: In NullAway JSpecify tests, when JDK version requirements exist due to bytecode annotation reading capabilities, prefer failing tests over skipping them on unsupported versions to ensure CI catches regressions and enforces proper JDK version usage for developers.
Applied to files:
nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java
🔇 Additional comments (2)
nullaway/src/test/java/com/uber/nullaway/jspecify/GenericsTests.java (2)
2345-2365: LGTM: Good coverage for the super-constructor nullability caseAdding an ignored test that exercises passing null to a generic super constructor where T extends @nullable Object is valuable. This should be allowed once the referenced issue is fixed.
2345-2365: Align issue reference: tests reference issue 1246 but PR mentions 1446Repository search shows only references to issues/1246; there are no occurrences of 1446. Please confirm which issue is intended and update either the @ignore annotation(s) or the PR description to match.
This adds (Ignored) tests for the failures for nullable super invocations described in gh-1246
Thank you for contributing to NullAway!
Please note that once you click "Create Pull Request" you will be asked to sign our Uber Contributor License Agreement via CLA assistant.
Before pressing the "Create Pull Request" button, please provide the following:
A description about what and why you are contributing, even if it's trivial.
The issue number(s) or PR number(s) in the description if you are contributing in response to those.
If applicable, unit tests.
Summary by CodeRabbit