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

Fix handling of static imports from subclasses #904

Merged
merged 6 commits into from
Feb 7, 2024

Conversation

msridhar
Copy link
Collaborator

@msridhar msridhar commented Feb 1, 2024

Fixes #764

@msridhar msridhar requested a review from yuxincs February 1, 2024 17:46
Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (3fc9b8a) 86.98% compared to head (d615df2) 86.97%.
Report is 2 commits behind head on master.

Files Patch % Lines
...c/main/java/com/uber/nullaway/NullabilityUtil.java 62.50% 1 Missing and 2 partials ⚠️
...away/src/main/java/com/uber/nullaway/NullAway.java 90.00% 0 Missing and 1 partial ⚠️
...llaway/dataflow/AccessPathNullnessPropagation.java 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #904      +/-   ##
============================================
- Coverage     86.98%   86.97%   -0.02%     
- Complexity     1959     1965       +6     
============================================
  Files            77       77              
  Lines          6330     6348      +18     
  Branches       1223     1229       +6     
============================================
+ Hits           5506     5521      +15     
- Misses          420      421       +1     
- Partials        404      406       +2     

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

Copy link
Collaborator

@yuxincs yuxincs left a comment

Choose a reason for hiding this comment

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

Changes LGTM, but I have one clarifying question due to my unfamiliarity with the rest of the codebase.

methodSymbol = baseSymbol;
}
}
return methodSymbol;
Copy link
Collaborator

Choose a reason for hiding this comment

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

question: I'm a bit confused about the previous code. It suggests that we actually want the methodSymbol and we only resolve to baseSymbol under certain conditions (i.e., interface method corresponding to one from java.lang.Object). But it seems with the updated code that we actually always want baseSymbol?

Am I missing something?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes, that's a good question, this was due to my misunderstanding before. Basically, always getting the base symbol is safe, since if there is no different base symbol the baseSymbol() method just returns this. I didn't understand this before; more detail in this comment. In the next EP version the getSymbol overload for MethodInvocationTree will always call baseSymbol(), so in some cases it may get called twice, but that is fine.

@msridhar msridhar enabled auto-merge (squash) February 7, 2024 00:06
@msridhar msridhar merged commit fdd2b55 into uber:master Feb 7, 2024
10 of 12 checks passed
@msridhar msridhar deleted the issue-764 branch February 7, 2024 00:10
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.

Static methods can be accessed from within subclasses, but NullAway doesn't know this
2 participants