List<PsiTypeCastExpression> (@NotNull PsiElement where) { HashSet<PsiTypeCastExpression> casts = new HashSet<>(); JavaElementVisitor visitor = createRedundantCastVisitor(new CommonProcessors.CollectProcessor<>(casts)); where.accept(new JavaRecursiveElementWalkingVisitor() { @Override public void visitElement(@NotNull PsiElement element) { super.visitElement(element); element.accept(visitor); } }); return new ArrayList<>(casts); }