PsiElementPredicate () { return new PsiElementPredicate() { @Override public boolean satisfiedBy(@NotNull PsiElement element) { if (!(element instanceof GrSwitchStatement)) return false; final List<PsiEnumConstant> unused = findUnusedConstants((GrSwitchStatement)element); return !unused.isEmpty(); } }; }