mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-04 08:51:02 +07:00
IDEA-232559 Rename record component: field reference is not renamed if getter overload is present
GitOrigin-RevId: 1555b2079dbba1b92d83c0638e5845efca910dc5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
e08eb714bd
commit
13edb2f136
@@ -13,6 +13,8 @@ import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class JavaRecordComponentSearcher extends QueryExecutorBase<PsiReference, ReferencesSearch.SearchParameters> {
|
||||
@Override
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters queryParameters, @NotNull Processor<? super PsiReference> consumer) {
|
||||
@@ -50,8 +52,8 @@ public class JavaRecordComponentSearcher extends QueryExecutorBase<PsiReference,
|
||||
PsiClass containingClass = recordComponent.getContainingClass();
|
||||
if (containingClass == null) return null;
|
||||
|
||||
PsiMethod[] methods = containingClass.findMethodsByName(name, false);
|
||||
if (methods.length != 1) return null;
|
||||
List<PsiMethod> methods = ContainerUtil.filter(containingClass.findMethodsByName(name, false), m -> m.getParameterList().isEmpty());
|
||||
if (methods.size() != 1) return null;
|
||||
|
||||
PsiField field = containingClass.findFieldByName(name, false);
|
||||
if (field == null) return null;
|
||||
@@ -60,7 +62,7 @@ public class JavaRecordComponentSearcher extends QueryExecutorBase<PsiReference,
|
||||
PsiParameter parameter = compactConstructor != null
|
||||
? ContainerUtil.find(compactConstructor.getParameterList().getParameters(), p -> name.equals(p.getName()))
|
||||
: null;
|
||||
return new RecordNavigationInfo(methods[0], field, parameter, name);
|
||||
return new RecordNavigationInfo(methods.get(0), field, parameter, name);
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user