@Nullable private Collection<DfaMemoryState> createInitialStates( @NotNull PsiElement psiBlock, @NotNull InstructionVisitor visitor) { PsiElement container = PsiTreeUtil.getParentOfType(psiBlock, PsiClass.class, PsiLambdaExpression.class); if (container != null && (!(container instanceof PsiClass) || PsiUtil.isLocalOrAnonymousClass((PsiClass) container))) { final PsiElement parent = container.getParent(); final PsiCodeBlock block = DfaPsiUtil.getTopmostBlockInSameClass(parent); if (block != null) { final RunnerResult result = analyzeMethod(block, visitor); if (result == RunnerResult.OK) { final Collection<DfaMemoryState> closureStates = myNestedClosures.get(DfaPsiUtil.getTopmostBlockInSameClass(psiBlock)); if (!closureStates.isEmpty()) { return closureStates; } } return null; } } return Collections.singletonList(createMemoryState()); }
@Override protected Nullness create(MethodCallInstruction key) { final PsiCallExpression callExpression = key.getCallExpression(); if (callExpression instanceof PsiNewExpression) { return Nullness.NOT_NULL; } return callExpression != null ? DfaPsiUtil.getElementNullability( key.getResultType(), callExpression.resolveMethod()) : null; }