contract inference: take explicit parameter notnull into account (IDEA-127667)

This commit is contained in:
peter
2014-07-22 12:43:00 +02:00
parent 8851417c87
commit 2eae3c8876
2 changed files with 19 additions and 2 deletions
@@ -272,6 +272,16 @@ class ContractInferenceFromSourceTest extends LightCodeInsightFixtureTestCase {
assert c == ['null, _ -> false', '!null, _ -> true']
}
public void "test take explicit parameter notnull into account"() {
def c = inferContracts("""
final Object foo(@org.jetbrains.annotations.NotNull Object bar) {
if (!(bar instanceof CharSequence)) return null;
return new String("abc");
}
""")
assert c == []
}
private String inferContract(String method) {
return assertOneElement(inferContracts(method))
}