Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Adding support for nullable type upper bounds considering Library models#903

Merged
msridhar merged 8 commits intouber:masterfrom
akulk022:lib_model_nullable_ub_abhijitk
Feb 9, 2024
Merged

Adding support for nullable type upper bounds considering Library models#903
msridhar merged 8 commits intouber:masterfrom
akulk022:lib_model_nullable_ub_abhijitk

Conversation

@akulk022
Copy link
Contributor

@akulk022 akulk022 commented Feb 1, 2024

The below line previously reported an error considering the upperbound of the generic type parameter couldn't be Nullable, adding it into library models to allow it to be Nullable passes the test case.

Function<String,@Nullable String> removeA = a -> a.replace("a","");

We now have library model methods for treating a type as @NullMarked and also for making the upper bound of type variables @Nullable. We use these new methods to model java.util.function.Function as @NullMarked, in JSpecify mode only.

We fixed a related issue with unwanted errors when passing a lambda / method reference to @NullUnmarked code; this was necessary to get NullAway itself to still build with NullAway checking enabled.

(Due to issues with the branch this PR was recreated from the original #893)

@akulk022 akulk022 marked this pull request as ready for review February 1, 2024 00:54
Copy link
Collaborator

@msridhar msridhar left a comment

Choose a reason for hiding this comment

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

Another issue, see below

@codecov
Copy link

codecov bot commented Feb 2, 2024

Codecov Report

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

Comparison is base (3fc9b8a) 86.98% compared to head (d55b045) 87.05%.
Report is 3 commits behind head on master.

Files Patch % Lines
...c/main/java/com/uber/nullaway/NullabilityUtil.java 66.66% 1 Missing and 2 partials ⚠️
...away/src/main/java/com/uber/nullaway/NullAway.java 93.75% 0 Missing and 2 partials ⚠️
...ava/com/uber/nullaway/generics/GenericsChecks.java 88.88% 0 Missing and 2 partials ⚠️
...src/main/java/com/uber/nullaway/LibraryModels.java 66.66% 1 Missing ⚠️
...llaway/dataflow/AccessPathNullnessPropagation.java 85.71% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #903      +/-   ##
============================================
+ Coverage     86.98%   87.05%   +0.07%     
- Complexity     1959     1988      +29     
============================================
  Files            77       77              
  Lines          6330     6414      +84     
  Branches       1223     1245      +22     
============================================
+ Hits           5506     5584      +78     
- Misses          420      422       +2     
- Partials        404      408       +4     

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

@msridhar msridhar enabled auto-merge (squash) February 9, 2024 16:57
@msridhar
Copy link
Collaborator

msridhar commented Feb 9, 2024

Going ahead and merging this one. Thanks again @akulk022!

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

Comments