JavaElementVisitor (Processor<? super PsiTypeCastExpression> processor) { return new MyIsRedundantVisitor() { @Override protected void registerCast(@NotNull PsiTypeCastExpression typeCast) { processor.process(typeCast); } }; }