Menu

#187 Another case where the nullness inference doesn't work

open
nobody
None
5
2007-01-06
2007-01-06
No

This probably isn't really a bug, as it would probably require far more subtlety to catch automatically than is really worth including, but I thought I'd report it more for general interest. The following fails because it can't tell that 'string' can't be null:

package test;

public void testMethod (?String string, boolean isNull) requires ( (string != null) || isNull)
{
if (!isNull)
{
toString(string);
}
}

Discussion


Log in to post a comment.