ReferenceListApplicability (@NotNull PsiClass aClass, @NotNull PsiElement position) { Preference condition = getPreferredCondition(position); if (aClass.hasModifierProperty(PsiModifier.FINAL)) { if (condition == Preference.Interfaces || condition == Preference.Classes) { return inapplicable; } } if (condition == Preference.Interfaces) return aClass.isInterface() ? applicableByKind : inapplicable; if (condition == Preference.Classes) { if (aClass.isInterface()) return inapplicable; String name = aClass.getName(); if (name != null && name.endsWith("TestCase")) { VirtualFile vFile = aClass.getContainingFile().getVirtualFile(); if (vFile != null && ProjectFileIndex.getInstance(aClass.getProject()).isInTestSourceContent(vFile)) { return applicableByName; } } return applicableByKind; } if (condition == Preference.Exceptions) { return InheritanceUtil.isInheritor(aClass, CommonClassNames.JAVA_LANG_THROWABLE) ? applicableByKind : inapplicable; } return unknown; }