null argument checker: accept ephemeral memory states to analysis IDEA-162184

This commit is contained in:
Dmitry Batkovich
2016-10-10 13:12:51 +03:00
parent 27dac83794
commit 1153b60414
3 changed files with 23 additions and 4 deletions
@@ -0,0 +1,17 @@
class NullLiteralAndInferredMethodContract {
{
initExpressionConstraints(<warning descr="Passing 'null' argument to non annotated parameter">null</warning>);
}
public void initExpressionConstraints(Object parent) {
String currentProperties = getCurrentProperties(parent);
System.out.println(currentProperties != null ? currentProperties : "");
}
private String getCurrentProperties(Object parent) {
if (parent instanceof String) {
return ((String) parent).substring(1);
}
return <warning descr="'null' is returned by the method which is not declared as @Nullable">null</warning>;
}
}