Set<PsiVariable> () { Set<PsiVariable> effectivelyLocal = new LinkedHashSet<>(); List<PsiVariable> usedVariables = myControlFlowWrapper.getUsedVariablesInBody(ControlFlowUtil.findCodeFragment(myElements[0]), myOutputVariables); for (PsiVariable variable : usedVariables) { boolean toDeclare = !isDeclaredInside(variable) && myInputVariables.toDeclareInsideBody(variable); if (toDeclare) { effectivelyLocal.add(variable); } } if (myArtificialOutputVariable instanceof PsiField && !myIsChainedConstructor) { effectivelyLocal.add(myArtificialOutputVariable); } return effectivelyLocal; }