PsiMethod (final PsiClass aClass) { for (JavaMainMethodProvider provider : JavaMainMethodProvider.EP_NAME.getExtensionList()) { if (provider.isApplicable(aClass)) { return provider.findMainInClass(aClass); } } final PsiMethod[] mainMethods = aClass.findMethodsByName("main", true); return findMainMethod(mainMethods, aClass); }