Skip to content
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

Support isInstanceOf(...) as implying non-null in assertion libraries. #726

Merged
merged 3 commits into from
Feb 1, 2023

Conversation

lazaroclapp
Copy link
Collaborator

Generally speaking, all these libraries implement the assertion by calling Class.isInstance, which
will return false whenever the argument is null. Similar to the instanceof operator:
https://docs.oracle.com/javase/1.5.0/docs/api/java/lang/Class.html#isInstance(java.lang.Object)

Given this, we can avoid some redundant assertions by adding knowledge about these calls directly
in AssertionsHandler.

@coveralls
Copy link

coveralls commented Jan 31, 2023

Pull Request Test Coverage Report for Build #1050

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 1 unchanged line in 1 file lost coverage.
  • Overall coverage increased (+0.04%) to 93.057%

Files with Coverage Reduction New Missed Lines %
../nullaway/src/main/java/com/uber/nullaway/handlers/MethodNameUtil.java 1 98.77%
Totals Coverage Status
Change from base Build #1047: 0.04%
Covered Lines: 5294
Relevant Lines: 5689

💛 - Coveralls

@lazaroclapp lazaroclapp merged commit fc151dc into master Feb 1, 2023
@lazaroclapp lazaroclapp deleted the lazaro_support_assert_isInstanceOf branch February 1, 2023 01:46
msridhar added a commit to msridhar/NullAway that referenced this pull request Jul 18, 2023
msridhar added a commit to msridhar/NullAway that referenced this pull request Jul 18, 2023
msridhar added a commit to msridhar/NullAway that referenced this pull request Jul 19, 2023
msridhar added a commit to msridhar/NullAway that referenced this pull request Jul 19, 2023
msridhar added a commit to msridhar/NullAway that referenced this pull request Jul 19, 2023
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.

3 participants