boolean (PsiMethod left, PsiMethod right) { if (PsiUtil.getAccessLevel(left.getModifierList()) > PsiUtil.getAccessLevel(right.getModifierList())) return true; PsiClass lClass = left.getContainingClass(); PsiClass rClass = right.getContainingClass(); if (lClass != null && !lClass.isInterface()) return true; if (rClass != null && !rClass.isInterface()) return false; // implement annotated method PsiAnnotation[] leftAnnotations = left.getModifierList().getAnnotations(); PsiAnnotation[] rightAnnotations = right.getModifierList().getAnnotations(); return leftAnnotations.length > rightAnnotations.length; }