ParametrizedDuplicates (@NotNull ExtractMethodProcessor originalProcessor, @NotNull DuplicatesFinder.MatchType matchType, @Nullable Set<? extends TextRange> textRanges) { DuplicatesFinder finder = createDuplicatesFinder(originalProcessor, matchType, textRanges); if (finder == null) { return null; } List<Match> matches = finder.findDuplicates(originalProcessor.myTargetClass); matches = filterNestedSubexpressions(matches); if (matches.isEmpty()) { return null; } Map<PsiExpression, String> predefinedNames = foldParameters(originalProcessor, matches); PsiElement[] pattern = originalProcessor.myElements; ParametrizedDuplicates duplicates = new ParametrizedDuplicates(pattern, originalProcessor); if (!duplicates.initMatches(pattern, matches)) { return null; } if (!duplicates.extract(originalProcessor, predefinedNames)) { return null; } return duplicates; }