boolean (List<? extends PsiElement> elements) { Set<PsiEnumConstant> constants = ContainerUtil.map2Set(elements, el -> (PsiEnumConstant)el); for (PsiElement element: elements) { PsiEnumConstant enumConstant = (PsiEnumConstant)element; boolean entriesHaveDependencies = StreamEx.ofTree((PsiElement)enumConstant.getArgumentList(), el -> StreamEx.of(el.getChildren())) .select(PsiReferenceExpression.class) .anyMatch(ref -> constants.contains(ref.resolve())); if(entriesHaveDependencies) return false; } return true; }