PsiMethod (final PsiMethod[] mainMethods, PsiClass aClass) { for (final PsiMethod mainMethod : mainMethods) { PsiClass containingClass = mainMethod.getContainingClass(); if (containingClass != null && containingClass != aClass) { if (containingClass.isInterface() && PsiUtil.getLanguageLevel(containingClass).isLessThan(LanguageLevel.JDK_21_PREVIEW)) { continue; } } if (isMainMethod(mainMethod)) return mainMethod; } return null; }