UsageInfo (PsiElement refElement, PsiReference reference) { PsiElement element = reference.getElement(); PsiElement parent = element.getParent(); if (parent instanceof PsiReferenceList && refElement instanceof PsiClass psiClass) { final PsiElement pparent = parent.getParent(); if (pparent instanceof PsiClass inheritor && element instanceof PsiJavaCodeReferenceElement classRef) { if (parent.equals(inheritor.getPermitsList())) { return new SafeDeletePermitsClassUsageInfo(classRef, psiClass, inheritor, true); } //If psiClass contains only private members, then it is safe to remove it and change inheritor's extends/implements accordingly if (CachedValuesManager.getCachedValue(psiClass, () -> new CachedValueProvider.Result<>(containsOnlyPrivates(psiClass), PsiModificationTracker.getInstance(psiClass.getProject())))) { if (parent.equals(inheritor.getExtendsList()) || parent.equals(inheritor.getImplementsList())) { return new SafeDeleteExtendsClassUsageInfo(classRef, psiClass, inheritor); } } } } return null; }