void (@NotNull PsiClass aClass) { if (ReferencesSearch.search(aClass, new LocalSearchScope(myParent)) .anyMatch(ref -> !isInside(ref.getElement()))) { addSideEffect(); } // local or anonymous class declaration is not side effect per se (unless referenced from outside of block) }