private static void reportOptionalOfNullableImprovements( ProblemsHolder holder, Set<PsiElement> reportedAnchors, Instruction[] instructions) { for (Instruction instruction : instructions) { if (instruction instanceof MethodCallInstruction) { final PsiExpression[] args = ((MethodCallInstruction) instruction).getArgs(); if (args.length != 1) continue; final PsiExpression expr = args[0]; if (((MethodCallInstruction) instruction).isOptionalAlwaysNullProblem()) { if (!reportedAnchors.add(expr)) continue; holder.registerProblem( expr, "Passing <code>null</code> argument to <code>Optional</code>", DfaOptionalSupport.createReplaceOptionalOfNullableWithEmptyFix(expr)); } else if (((MethodCallInstruction) instruction).isOptionalAlwaysNotNullProblem()) { if (!reportedAnchors.add(expr)) continue; holder.registerProblem( expr, "Passing a non-null argument to <code>Optional</code>", DfaOptionalSupport.createReplaceOptionalOfNullableWithOfFix()); } } } }