biddyweb / checker-framework

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

Assertion expression is type-checked even if -AassumeAssertionsAreDisabled is supplied #417

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
If assertions are disabled, then the Nullness Checker should not issue a 
warning for this code, because if assertions are disabled, it cannot throw a 
NullPointerException.

  void foo(/*@Nullable*/ String s1, /*@Nullable*/ String s2) {

    // If assertions are disabled, then this cannot throw a NullPointerException
    assert s2.equals(s1);

  }

(If issuing a type-checking warning here is the desired behavior, then the 
documentation of the command-line option needs to be clarified.)

A test case is committed to the repository.  To enable it, remove the comment 
markers near the text

  TODO: re-enable this once issue 417 is fixed

in file checker-framework/checker/build.xml.

Original issue reported on code.google.com by michael.ernst@gmail.com on 19 Mar 2015 at 3:58

GoogleCodeExporter commented 9 years ago
Fixed by ignoring asserts when -AassumeAssertionsAreDisabled is provided.

Original comment by wdi...@gmail.com on 25 Mar 2015 at 11:38

GoogleCodeExporter commented 9 years ago

Original comment by jtha...@cs.washington.edu on 18 Apr 2015 at 6:42