extract method object: no need to change signature when nothing was changed by duplicates processing (IDEA-98288)

This commit is contained in:
anna
2012-12-31 13:30:21 +01:00
parent 42a971fa8d
commit e9070ccbc8
2 changed files with 4 additions and 1 deletions
@@ -380,8 +380,9 @@ public final class Match {
}
public void changeSignature(final PsiMethod psiMethod) {
final ArrayList<ParameterInfoImpl> newParameters = patchParams(psiMethod);
final PsiType expressionType = getChangedReturnType(psiMethod);
if (expressionType == null && myChangedParams.isEmpty()) return;
final ArrayList<ParameterInfoImpl> newParameters = patchParams(psiMethod);
final ChangeSignatureProcessor csp = new ChangeSignatureProcessor(psiMethod.getProject(), psiMethod, false, null, psiMethod.getName(),
expressionType != null ? expressionType : psiMethod.getReturnType(),
newParameters.toArray(new ParameterInfoImpl[newParameters.size()]));
@@ -19,6 +19,7 @@ import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.CodeInsightUtil;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiFile;
@@ -677,6 +678,7 @@ public class ExtractMethodTest extends LightCodeInsightTestCase {
final List<Match> duplicates = processor.getDuplicates();
for (final Match match : duplicates) {
if (!match.getMatchStart().isValid() || !match.getMatchEnd().isValid()) continue;
PsiDocumentManager.getInstance(project).commitAllDocuments();
processor.processMatch(match);
}
}