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

Remove need to use JSpecify's @Nullable annotation #1142

Merged
merged 10 commits into from
Feb 7, 2025
Merged

Conversation

msridhar
Copy link
Collaborator

@msridhar msridhar commented Feb 7, 2025

Fixes #1139. There are real scenarios where projects may not want to ship with a JSpecify dependence; see #1139 (comment). So, we remove any cases where we were specifically checking for or using JSpecify's @Nullable annotation.

Most of the code changes are due to the fact that now, we check if an annotation is a @Nullable annotation using Nullness.hasNullableAnnotation, which requires a Config object as a parameter. So we need to thread a Config object as a parameter through a bunch of methods.

Copy link

codecov bot commented Feb 7, 2025

Codecov Report

Attention: Patch coverage is 93.10345% with 4 lines in your changes missing coverage. Please review.

Project coverage is 88.22%. Comparing base (f064222) to head (3ef0323).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
...ava/com/uber/nullaway/generics/GenericsChecks.java 93.33% 0 Missing and 3 partials ⚠️
...laway/generics/PreservedAnnotationTreeVisitor.java 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master    #1142      +/-   ##
============================================
- Coverage     88.24%   88.22%   -0.02%     
+ Complexity     2263     2260       -3     
============================================
  Files            85       85              
  Lines          7314     7312       -2     
  Branches       1458     1461       +3     
============================================
- Hits           6454     6451       -3     
  Misses          432      432              
- Partials        428      429       +1     

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

@msridhar msridhar marked this pull request as ready for review February 7, 2025 03:35
@@ -103,7 +93,7 @@ public static void checkInstantiationForParameterizedTypedTree(
return;
}
boolean[] typeParamsWithNullableUpperBound =
getTypeParamsWithNullableUpperBound(baseType, config, state, handler);
Copy link
Collaborator

@akshayutture akshayutture Feb 7, 2025

Choose a reason for hiding this comment

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

Why do we no longer need 'state' (VisitorState) here (and in other places in this diff)?

Copy link
Collaborator Author

@msridhar msridhar Feb 7, 2025

Choose a reason for hiding this comment

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

It's because hasNullableAnnotation (https://github.com/uber/NullAway/pull/1142/files#diff-82d66c6ba15b87acc24509d7a3440bbe7606944197b929733d315fbe0a025435L1159-L1171) used to rely on the state object in order to check for the presence of the JSpecify @Nullable annotation. Now we don't do that, so in various places state is no longer needed (but config is).

@msridhar msridhar merged commit 50cb4ab into master Feb 7, 2025
12 checks passed
@msridhar msridhar deleted the issue-1139 branch February 7, 2025 23:17
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.

Invalid override error in JSpecify mode
2 participants