lovubuntu / checker-framework

Automatically exported from code.google.com/p/checker-framework
0 stars 0 forks source link

castNonNull() statement no longer works for suppressing warnings #298

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
A call to NullnessUtils.castNonNull() no longer seems to suppress warnings, 
e.g. in the example from the manual:

    castNonNull(possiblyNull3);
    possiblyNull3.toString();

it no longer suppresses the warning "dereference of possibly-null reference 
possiblyNull3".

I think NullnessUtils.castNonNull() needs @EnsuresNonNull("#1")?

I'm using Checker Framework 1.7.1. Thanks.

Original issue reported on code.google.com by trask.st...@gmail.com on 29 Dec 2013 at 5:28

GoogleCodeExporter commented 9 years ago

Original comment by wdi...@gmail.com on 1 Jan 2014 at 9:06

GoogleCodeExporter commented 9 years ago
Thanks for noticing this mis-match!
I've expanded a test case for this usage in:

tests/nullness/flow/TestNullnessUtils.java

As you suggested the fix is to add @EnsuresNonNull annotations.

Original comment by wdi...@gmail.com on 2 Jan 2014 at 1:26

GoogleCodeExporter commented 9 years ago

Original comment by Jonathan...@gmail.com on 6 Jan 2014 at 6:53