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 bug with computing direct type use annotations on parameters #864

Merged
merged 3 commits into from
Nov 19, 2023

Conversation

msridhar
Copy link
Collaborator

NullAway was still treating annotations on generic type arguments as being on the top-level type of a parameter itself, which could lead to false positives and potentially also missed bugs.

@msridhar msridhar marked this pull request as draft November 19, 2023 19:18
Copy link

codecov bot commented Nov 19, 2023

Codecov Report

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

Comparison is base (9092438) 87.02% compared to head (ae1cbb4) 87.02%.
Report is 2 commits behind head on master.

Files Patch % Lines
...ava/com/uber/nullaway/generics/GenericsChecks.java 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             master     #864   +/-   ##
=========================================
  Coverage     87.02%   87.02%           
- Complexity     1921     1922    +1     
=========================================
  Files            77       77           
  Lines          6219     6219           
  Branches       1209     1210    +1     
=========================================
  Hits           5412     5412           
  Misses          403      403           
  Partials        404      404           

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

@@ -102,7 +102,7 @@ def test = [
"org.junit.jupiter:junit-jupiter-api:5.0.2",
"org.apiguardian:apiguardian-api:1.0.0"
],
jetbrainsAnnotations : "org.jetbrains:annotations:13.0",
jetbrainsAnnotations : "org.jetbrains:annotations:24.1.0",
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Needed so that @NotNull is a type use annotation

@msridhar msridhar marked this pull request as ready for review November 19, 2023 19:29
@msridhar msridhar requested a review from yuxincs November 19, 2023 19:29
Copy link
Collaborator

@lazaroclapp lazaroclapp left a comment

Choose a reason for hiding this comment

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

LGTM! One quick question above, but this is ready to land either way.

"class TypeArgumentAnnotation {",
" List<@Nullable String> fSafe = new ArrayList<>();",
" @Nullable List<String> fUnsafe = new ArrayList<>();",
" void useParamSafe(List<@Nullable String> list) {",
" list.hashCode();",
" }",
" void unsafeCall() {",
" // BUG: Diagnostic contains: passing @Nullable parameter",
" useParamSafe(null);",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Before this change, this was a false negative? (Either way, great to have the test, but just curious)

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 right, this was a false negative before

@msridhar msridhar merged commit fbd076a into master Nov 19, 2023
10 checks passed
@msridhar msridhar deleted the nullunmarked-restrictive-generics-bug branch November 19, 2023 19:51
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