[java-inspections] ClassCanBeRecord: remove unused boolean showAffectedMembers

It was always true anyway.

Merge-request: IJ-MR-159168
Merged-by: Bartek Pacia <bartek.pacia@jetbrains.com>

GitOrigin-RevId: 7542653cc8505f2b206c43b54acf49b1bbd58b7e
This commit is contained in:
Bartek Pacia
2025-04-03 11:50:25 +00:00
committed by intellij-monorepo-bot
parent ab93bd6d65
commit 4fbfd4be3e
3 changed files with 5 additions and 11 deletions
@@ -73,7 +73,7 @@ public final class ClassCanBeRecordInspection extends BaseInspection implements
boolean suggestQuickFix = (boolean)infos[0];
if (suggestQuickFix) {
fixes.add(new ConvertToRecordFix(true, suggestAccessorsRenaming, myIgnoredAnnotations));
fixes.add(new ConvertToRecordFix(suggestAccessorsRenaming, myIgnoredAnnotations));
PsiClass psiClass = ObjectUtils.tryCast(infos[1], PsiClass.class);
if (psiClass != null) {
PsiAnnotation[] annotations = psiClass.getAnnotations();
@@ -39,12 +39,10 @@ import static com.intellij.psi.CommonClassNames.JAVA_LANG_OBJECT;
import static com.intellij.psi.PsiModifier.*;
public class ConvertToRecordFix extends InspectionGadgetsFix {
private final boolean myShowAffectedMembers;
private final boolean mySuggestAccessorsRenaming;
private final @NotNull List<String> myIgnoredAnnotations;
ConvertToRecordFix(boolean showAffectedMembers, boolean suggestAccessorsRenaming, @NotNull List<String> ignoredAnnotations) {
myShowAffectedMembers = showAffectedMembers;
ConvertToRecordFix(boolean suggestAccessorsRenaming, @NotNull List<String> ignoredAnnotations) {
mySuggestAccessorsRenaming = suggestAccessorsRenaming;
myIgnoredAnnotations = ignoredAnnotations;
}
@@ -77,7 +75,7 @@ public class ConvertToRecordFix extends InspectionGadgetsFix {
RecordCandidate recordCandidate = getClassDefinition(psiClass, mySuggestAccessorsRenaming, myIgnoredAnnotations);
if (recordCandidate == null) return null;
return new ConvertToRecordProcessor(recordCandidate, myShowAffectedMembers);
return new ConvertToRecordProcessor(recordCandidate);
}
@Override
@@ -47,14 +47,12 @@ final class ConvertToRecordProcessor extends BaseRefactoringProcessor {
private static final CallMatcher OBJECT_HASHCODE =
CallMatcher.instanceCall(CommonClassNames.JAVA_LANG_OBJECT, "hashCode").parameterCount(0);
private final RecordCandidate myRecordCandidate;
private final boolean myShowAffectedMembers;
private final Map<PsiElement, String> myAllRenames = new LinkedHashMap<>();
ConvertToRecordProcessor(@NotNull RecordCandidate recordCandidate, boolean showAffectedMembers) {
ConvertToRecordProcessor(@NotNull RecordCandidate recordCandidate) {
super(recordCandidate.getProject());
myRecordCandidate = recordCandidate;
myShowAffectedMembers = showAffectedMembers;
}
@Override
@@ -123,9 +121,7 @@ final class ConvertToRecordProcessor extends BaseRefactoringProcessor {
usages.add(new RenameMethodUsageInfo(fieldAccessorCandidate.getAccessor(), backingFieldName));
}
if (myShowAffectedMembers) {
usages.addAll(findConflicts(myRecordCandidate));
}
usages.addAll(findConflicts(myRecordCandidate));
return usages.toArray(UsageInfo.EMPTY_ARRAY);
}