List<String> (@NotNull Match match, @NotNull InputVariables inputVariables, @Nullable PsiVariable outputVariable) { Set<PsiLocalVariable> ignoreVariables = Collections.emptySet(); ReturnValue returnValue = match.getOutputVariableValue(outputVariable); if (returnValue instanceof VariableReturnValue) { PsiVariable returnedVariable = ((VariableReturnValue)returnValue).getVariable(); if (returnedVariable instanceof PsiLocalVariable) { ignoreVariables = Collections.singleton((PsiLocalVariable)returnedVariable); } } List<ReusedLocalVariable> reusedLocalVariables = ReusedLocalVariablesFinder.findReusedLocalVariables(match.getMatchStart(), match.getMatchEnd(), ignoreVariables, inputVariables); if (!reusedLocalVariables.isEmpty()) { List<String> result = new ArrayList<>(); for (ReusedLocalVariable variable : reusedLocalVariables) { if (!variable.reuseValue()) { result.add(variable.getDeclarationText()); } } return result; } return Collections.emptyList(); }