lovubuntu / checker-framework

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

String concatenation compound assigment #357

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Running the Nullness Checker on the following code (full test case attached):

 public static void testCompoundAssignWithNullAndMethodCall() {
        String s = null;
        s += getNonNullString();
        s.toString();
    }

Produces the flowing error: 

FlowCompoundConcatenation.java:9: error: [dereference.of.nullable] dereference 
of possibly-null reference s
        s.toString();
        ^
1 error

After the compound assignment, s should have type @NonNull, but it is @Nullable 
instead.  This only happens if the RHS of the compound assignment includes a 
method call.

Original issue reported on code.google.com by smil...@cs.washington.edu on 19 Sep 2014 at 11:12

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 36b9ec8a38c2.

Original comment by Suzanne....@gmail.com on 26 Sep 2014 at 4:25

GoogleCodeExporter commented 9 years ago

Original comment by Suzanne....@gmail.com on 26 Sep 2014 at 4:26

GoogleCodeExporter commented 9 years ago
Fixed in release 1.8.7

Original comment by Jonathan...@gmail.com on 30 Oct 2014 at 11:12