mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
change signature: show conflicts if delegated method has same erasure as initial one (IDEA-157672)
This commit is contained in:
+2
-2
@@ -1002,7 +1002,7 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
checkContract(conflictDescriptions, myChangeInfo.getMethod());
|
||||
|
||||
for (UsageInfo usageInfo : usagesSet) {
|
||||
@@ -1104,7 +1104,7 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
|
||||
prototype.getParameterList().add(param);
|
||||
}
|
||||
|
||||
ConflictsUtil.checkMethodConflicts(method.getContainingClass(), method, prototype, conflicts);
|
||||
ConflictsUtil.checkMethodConflicts(method.getContainingClass(), myChangeInfo.isGenerateDelegate() ? null : method, prototype, conflicts);
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
LOG.error(e);
|
||||
|
||||
@@ -53,7 +53,7 @@ public class ConflictsUtil {
|
||||
}
|
||||
|
||||
public static void checkMethodConflicts(@Nullable PsiClass aClass,
|
||||
PsiMethod refactoredMethod,
|
||||
@Nullable PsiMethod refactoredMethod,
|
||||
final PsiMethod prototype,
|
||||
final MultiMap<PsiElement,String> conflicts) {
|
||||
if (prototype == null) return;
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
class A {
|
||||
void <caret>m() {}
|
||||
}
|
||||
@@ -52,6 +52,14 @@ public class ChangeSignatureTest extends ChangeSignatureBaseTest {
|
||||
catch (BaseRefactoringProcessor.ConflictsInTestsException ignored) { }
|
||||
}
|
||||
|
||||
public void testDelegateWithoutChangesWarnAboutSameMethodInClass() throws Exception {
|
||||
try {
|
||||
doTest(null, new ParameterInfoImpl[0], true);
|
||||
fail("Conflict expected");
|
||||
}
|
||||
catch (BaseRefactoringProcessor.ConflictsInTestsException ignored) { }
|
||||
}
|
||||
|
||||
public void testGenericTypes() {
|
||||
doTest(null, null, "T", method -> new ParameterInfoImpl[]{
|
||||
new ParameterInfoImpl(-1, "x", myFactory.createTypeFromText("T", method.getParameterList()), "null"),
|
||||
|
||||
Reference in New Issue
Block a user