Set<PsiParameter> (@NotNull ControlFlow controlFlow, @NotNull Collection<? extends PsiParameter> parameters) { final Set<PsiVariable> usedVars = new HashSet<>(ControlFlowUtil.getUsedVariables(controlFlow, 0, controlFlow.getSize())); final Set<PsiParameter> result = new HashSet<>(); for (PsiParameter parameter : parameters) { if (usedVars.contains(parameter)) { result.add(parameter); } } return result; }