uber / NullAway

A tool to help eliminate NullPointerExceptions (NPEs) in your Java code with low build-time overhead
MIT License
3.63k stars 293 forks source link

JSpecify: handling the return of a diamond operator anonymous object method caller #858

Closed akulk022 closed 11 months ago

akulk022 commented 11 months ago

In reference to the exception mentioned in the discussion for #791 .

Adding the test case to reproduce the same issue:

class Test {
    static class B<T>{
        String build(){return "x";}
    }
    static String testNegative() {
        //We were getting the aforementioned mentioned exception when we tried to do this
        return new B<>().build();
    }
}

All unit tests have passed for the changes that were made for this.

codecov[bot] commented 11 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Comparison is base (0141aca) 86.93% compared to head (35c0cc3) 86.95%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #858 +/- ## ============================================ + Coverage 86.93% 86.95% +0.01% - Complexity 1888 1890 +2 ============================================ Files 74 74 Lines 6215 6216 +1 Branches 1208 1209 +1 ============================================ + Hits 5403 5405 +2 Misses 405 405 + Partials 407 406 -1 ``` | [Files](https://app.codecov.io/gh/uber/NullAway/pull/858?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber) | Coverage Δ | | |---|---|---| | [...rc/main/java/com/uber/nullaway/GenericsChecks.java](https://app.codecov.io/gh/uber/NullAway/pull/858?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber#diff-bnVsbGF3YXkvc3JjL21haW4vamF2YS9jb20vdWJlci9udWxsYXdheS9HZW5lcmljc0NoZWNrcy5qYXZh) | `90.31% <100.00%> (+0.02%)` | :arrow_up: | ... and [1 file with indirect coverage changes](https://app.codecov.io/gh/uber/NullAway/pull/858/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=uber)

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