AbstractExtractDialog (final boolean direct) { setDataFromInputVariables(); myNullability = initNullability(); myArtificialOutputVariable = PsiTypes.voidType().equals(myReturnType) ? getArtificialOutputVariable() : null; final PsiType returnType = myArtificialOutputVariable != null ? myArtificialOutputVariable.getType() : myReturnType; return new ExtractMethodDialog(myProject, myTargetClass, myInputVariables, returnType, getTypeParameterList(), getThrownExceptions(), isStatic(), isCanBeStatic(), myCanBeChainedConstructor, myRefactoringName, myHelpId, myNullability, myElements, this::estimateDuplicatesCount) { @Override protected boolean areTypesDirected() { return direct; } @Override protected String[] suggestMethodNames() { return suggestInitialMethodName(); } @Override protected PsiExpression[] findOccurrences() { return ExtractMethodProcessor.this.findOccurrences(); } @Override protected boolean isOutputVariable(PsiVariable var) { return ExtractMethodProcessor.this.isOutputVariable(var); } @Override protected boolean isVoidReturn() { return myArtificialOutputVariable != null && !(myArtificialOutputVariable instanceof PsiField); } @Override protected void checkMethodConflicts(MultiMap<PsiElement, @NlsContexts.DialogMessage String> conflicts) { super.checkMethodConflicts(conflicts); final VariableData[] parameters = getChosenParameters(); final Map<String, PsiLocalVariable> vars = new HashMap<>(); for (PsiElement element : myElements) { element.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitLocalVariable(@NotNull PsiLocalVariable variable) { super.visitLocalVariable(variable); vars.put(variable.getName(), variable); } @Override public void visitClass(@NotNull PsiClass aClass) {} }); } for (VariableData parameter : parameters) { final String paramName = parameter.name; final PsiLocalVariable variable = vars.get(paramName); if (variable != null) { conflicts.putValue(variable, JavaRefactoringBundle.message("extract.method.conflict.variable", paramName)); } } } @Override protected boolean hasPreviewButton() { return myIsPreviewSupported; } }; }