mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-08-26 15:27:45 +07:00
contract inference: take explicit parameter notnull into account (IDEA-127667)
This commit is contained in:
+10
@@ -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))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user