PsiMethod (@NotNull PsiMethod method) { ThreadingAssertions.assertEventDispatchThread(); PsiClass aClass = method.getContainingClass(); if (aClass == null) return method; PsiMethod superMethod = method.findDeepestSuperMethod(); if (superMethod == null) return method; if (ApplicationManager.getApplication().isUnitTestMode()) return superMethod; PsiClass containingClass = superMethod.getContainingClass(); int useSuperMethod = showDialog( method.getProject(), RefactoringBundle.message("to.refactor"), DescriptiveNameUtil.getDescriptiveName(method), containingClass.isInterface() || superMethod.hasModifierProperty(PsiModifier.ABSTRACT), containingClass.isInterface(), aClass.isInterface(), containingClass.getQualifiedName() ); return switch (useSuperMethod) { case Messages.YES -> superMethod; case Messages.NO -> method; default -> null; }; }