[java-intentions] UnimplementInterfaceAction: do not try to remove synthetic methods

Fixes IDEA-354044 Error in Unimplement Interface when invoked on record

GitOrigin-RevId: 9c07e03d1f86ded0aeea3bd0f373dfc263e72eb4
This commit is contained in:
Tagir Valeev
2024-06-14 16:05:02 +00:00
committed by intellij-monorepo-bot
parent d0e4f5f297
commit 636172d7db
3 changed files with 11 additions and 1 deletions
@@ -134,7 +134,7 @@ public class UnimplementInterfaceAction extends PsiUpdateModCommandAction<PsiEle
for (PsiMethod psiMethod : psiMethods) {
if (superMethods.contains(psiMethod)) continue;
final PsiMethod impl = implementations.get(psiMethod);
if (impl != null) impl.delete();
if (impl != null && !(impl instanceof SyntheticElement)) impl.delete();
}
}
@@ -0,0 +1,5 @@
// "Unimplement" "true-preview"
interface Iface {
int value();
}
record R(int value) {}
@@ -0,0 +1,5 @@
// "Unimplement" "true-preview"
interface Iface {
int value();
}
record R(int value) implements Ifa<caret>ce {}