mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
introduce parameter: show conflict if method won't be record canonical constructor (IDEA-267382)
GitOrigin-RevId: 594205296f7ae88246307a24c6bd3daf240ca054
This commit is contained in:
committed by
intellij-monorepo-bot
parent
f3e4488e71
commit
77495945a3
+4
@@ -262,6 +262,10 @@ public class IntroduceParameterProcessor extends BaseRefactoringProcessor implem
|
||||
RefactoringUIUtil.getDescription(recordComponent, true));
|
||||
conflicts.putValue(myMethodToReplaceIn, message);
|
||||
}
|
||||
else if (JavaPsiRecordUtil.isCanonicalConstructor(myMethodToReplaceIn)) {
|
||||
String message = JavaRefactoringBundle.message("0.will.no.longer.be.canonical.constructor");
|
||||
conflicts.putValue(myMethodToReplaceIn, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
record R(String name) {
|
||||
R(String name) {
|
||||
<selection>"_"</selection> + name;
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
@@ -171,6 +171,12 @@ public class IntroduceParameterTest extends LightRefactoringTestCase {
|
||||
"method <b><code>R.name()</code></b> will no longer be record component <b><code>name</code></b> getter"));
|
||||
}
|
||||
|
||||
public void testCanonicalConstructor() {
|
||||
IdeaTestUtil.withLevel(getModule(), LanguageLevel.JDK_16, () ->
|
||||
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, false,
|
||||
"Constructor will no longer be canonical"));
|
||||
}
|
||||
|
||||
public void testParameterInFor() {
|
||||
configureByFile("/refactoring/introduceParameter/beforeParameterInFor.java");
|
||||
performForLocal(true, true, true, false, false);
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
0.will.hide.renamed.1={0} will hide renamed {1}
|
||||
0.will.no.longer.override.1={0} will no longer override {1}
|
||||
0.will.no.longer.be.record.component.accessor={0} will no longer be {1} getter
|
||||
0.will.no.longer.be.canonical.constructor=Constructor will no longer be canonical
|
||||
0.will.not.be.accessible.from.1.after.inlining={0} will not be accessible from {1} after inlining
|
||||
0.will.override.renamed.1={0} will override renamed {1}
|
||||
a.package.local.class.0.will.no.longer.be.accessible.from.1=Package-local class {0} will no longer be accessible from {1}
|
||||
|
||||
Reference in New Issue
Block a user