NullAway icon indicating copy to clipboard operation
NullAway copied to clipboard

External Library Models: Adding support for Nullable upper bounds of Generic Type parameters

Open akulk022 opened this issue 1 year ago • 1 comments

With these changes we are able to read and create library models for Nullable upper bounds of generic type parameters from externally annotated source code as shown in the below example.

Externally annotated source code example:

public static class GenericExample<T extends @Nullable Object> {
        public T getNull() {
            return null;
        }
 }
public static class GenericExample<T> {
    public T getNull() {
      return null;
    }
}
static GenericExample<@Nullable Object> genericExample = new GenericExample<@Nullable Object>();
static void test(Object value){}
// BUG: Diagnostic contains: passing @Nullable parameter 'genericExample.getNull()'
test(genericExample.getNull());

akulk022 avatar Apr 13 '24 14:04 akulk022

Codecov Report

Attention: Patch coverage is 66.90647% with 46 lines in your changes missing coverage. Please review.

Project coverage is 85.97%. Comparing base (6cec433) to head (71ce2e2).

:exclamation: Current head 71ce2e2 differs from pull request most recent head 3f4c3e4

Please upload reports for the commit 3f4c3e4 to get more accurate results.

Files Patch % Lines
.../uber/nullaway/libmodel/LibraryModelGenerator.java 0.00% 23 Missing :warning:
...ava/com/uber/nullaway/handlers/StubxCacheUtil.java 81.33% 9 Missing and 5 partials :warning:
...n/java/com/uber/nullaway/libmodel/StubxWriter.java 27.27% 7 Missing and 1 partial :warning:
...er/nullaway/handlers/InferredJARModelsHandler.java 75.00% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff              @@
##             master     #949      +/-   ##
============================================
- Coverage     86.17%   85.97%   -0.20%     
- Complexity     2037     2046       +9     
============================================
  Files            81       82       +1     
  Lines          6691     6760      +69     
  Branches       1290     1301      +11     
============================================
+ Hits           5766     5812      +46     
- Misses          515      536      +21     
- Partials        410      412       +2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

codecov[bot] avatar Apr 13 '24 15:04 codecov[bot]