mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-02 04:35:22 +07:00
[java-refactoring] ReplaceConstructorWithBuilderProcessor: use anchor instead of null, as new conflict dialog requires it
Fixes IDEA-354549 Creating builder from constructor not working GitOrigin-RevId: e793d9fff9af4125a5b442069e70e7bc314b6912
This commit is contained in:
committed by
intellij-monorepo-bot
parent
07c73fd64a
commit
f7976fa52c
+3
-2
@@ -289,11 +289,12 @@ public class ReplaceConstructorWithBuilderProcessor extends FixableUsagesRefacto
|
||||
protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
|
||||
final MultiMap<PsiElement, String> conflicts = new MultiMap<>();
|
||||
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(myProject);
|
||||
PsiClass anchor = myConstructors[0].getContainingClass();
|
||||
final PsiClass builderClass =
|
||||
psiFacade.findClass(StringUtil.getQualifiedName(myPackageName, myClassName), GlobalSearchScope.projectScope(myProject));
|
||||
if (builderClass == null) {
|
||||
if (!myCreateNewBuilderClass) {
|
||||
conflicts.putValue(null, JavaRefactoringBundle.message("replace.constructor.builder.error.selected.class.was.not.found"));
|
||||
conflicts.putValue(anchor, JavaRefactoringBundle.message("replace.constructor.builder.error.selected.class.was.not.found", myClassName));
|
||||
}
|
||||
} else if (myCreateNewBuilderClass){
|
||||
conflicts.putValue(builderClass,
|
||||
@@ -306,7 +307,7 @@ public class ReplaceConstructorWithBuilderProcessor extends FixableUsagesRefacto
|
||||
|
||||
final PsiMethod commonConstructor = getMostCommonConstructor();
|
||||
if (commonConstructor == null) {
|
||||
conflicts.putValue(null, JavaRefactoringBundle.message("replace.constructor.builder.error.no.constructor.chain"));
|
||||
conflicts.putValue(anchor, JavaRefactoringBundle.message("replace.constructor.builder.error.no.constructor.chain"));
|
||||
}
|
||||
|
||||
return showConflicts(conflicts, refUsages.get());
|
||||
|
||||
Reference in New Issue
Block a user