mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
[java][safe delete]: filter light methods during override processing
EA-264091 (plugin) - CCE: SafeDeleteOverridingMethodUsageInfo.getOverridingMethod GitOrigin-RevId: b1f4f93b052d697efc3f1f5ea0e02e3748b1a03f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
1705f01347
commit
a9d6f77e1c
@@ -19,6 +19,7 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.JavaCodeStyleManager;
|
||||
import com.intellij.psi.codeStyle.VariableKind;
|
||||
import com.intellij.psi.impl.FindSuperElementsHelper;
|
||||
import com.intellij.psi.impl.light.LightRecordMethod;
|
||||
import com.intellij.psi.javadoc.PsiDocTag;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
@@ -687,7 +688,7 @@ public class JavaSafeDeleteProcessor extends SafeDeleteProcessorDelegateBase {
|
||||
return findConstructorUsages(psiMethod, references, usages, allElementsToDelete);
|
||||
}
|
||||
final PsiMethod[] overridingMethods =
|
||||
removeDeletedMethods(OverridingMethodsSearch.search(psiMethod).toArray(PsiMethod.EMPTY_ARRAY),
|
||||
removeDeletedMethods(OverridingMethodsSearch.search(psiMethod).filtering(m -> !(m instanceof LightRecordMethod)).toArray(PsiMethod.EMPTY_ARRAY),
|
||||
allElementsToDelete);
|
||||
|
||||
findFunctionalExpressions(usages, ArrayUtil.prepend(psiMethod, overridingMethods));
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
interface I {
|
||||
int <caret>m();
|
||||
}
|
||||
record R(int m) implements I {}
|
||||
@@ -0,0 +1,3 @@
|
||||
interface I {
|
||||
}
|
||||
record R(int m) implements I {}
|
||||
@@ -19,6 +19,7 @@ import com.intellij.refactoring.BaseRefactoringProcessor;
|
||||
import com.intellij.refactoring.MultiFileTestCase;
|
||||
import com.intellij.refactoring.RefactoringSettings;
|
||||
import com.intellij.refactoring.safeDelete.SafeDeleteHandler;
|
||||
import com.intellij.testFramework.IdeaTestUtil;
|
||||
import com.intellij.testFramework.PsiTestUtil;
|
||||
import com.intellij.util.PathUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -432,8 +433,12 @@ public class SafeDeleteTest extends MultiFileTestCase {
|
||||
}
|
||||
|
||||
public void testSealedGrandParent() {
|
||||
LanguageLevelProjectExtension.getInstance(getProject()).setLanguageLevel(LanguageLevel.JDK_15_PREVIEW);
|
||||
doTest("Parent");
|
||||
IdeaTestUtil.withLevel(getModule(), LanguageLevel.JDK_15_PREVIEW, () -> doTest("Parent"));
|
||||
}
|
||||
|
||||
public void testRecordImplementsInterface() throws Exception {
|
||||
IdeaTestUtil.setModuleLanguageLevel(getModule(), LanguageLevel.JDK_16, getTestRootDisposable());
|
||||
doSingleFileTest();
|
||||
}
|
||||
|
||||
public void testNonAccessibleGrandParent() {
|
||||
|
||||
Reference in New Issue
Block a user