Minor fixes in CFG Stream inlining

1. Initial stream element nullability is derived from type
2. reportNullableArgumentsPassedToNonAnnotated fixed for method references
This commit is contained in:
Tagir Valeev
2017-07-27 12:45:42 +07:00
parent 05bce8d437
commit 3bd8fa6286
2 changed files with 6 additions and 1 deletions
@@ -551,6 +551,11 @@ public class DataFlowInspectionBase extends BaseJavaBatchLocalInspectionTool {
for (PsiElement expr : visitor.getProblems(NullabilityProblem.passingNullableArgumentToNonAnnotatedParameter)) {
if (reportedAnchors.contains(expr)) continue;
if (expr.getParent() instanceof PsiMethodReferenceExpression) {
holder.registerProblem(expr.getParent(), "Method reference argument might be null but passed to non annotated parameter");
continue;
}
final String text = isNullLiteralExpression(expr)
? "Passing <code>null</code> argument to non annotated parameter"
: "Argument <code>#ref</code> #loc might be null but passed to non annotated parameter";
@@ -317,7 +317,7 @@ public class StreamChainInliner implements CallInliner {
.chain(firstStep::before)
.doWhile()
.pushVariable(builder.createTempVariable(inType))
.push(builder.getFactory().createTypeValue(inType, Nullness.UNKNOWN))
.push(builder.getFactory().createTypeValue(inType, DfaPsiUtil.getTypeNullability(inType)))
.assign()
.chain(firstStep::iteration)
.endWhileUnknown();