package com.github.simy4.xpath.effects;

import com.github.simy4.xpath.XmlBuilderException;
import com.github.simy4.xpath.expr.Expr;
import com.github.simy4.xpath.navigator.Navigator;
import com.github.simy4.xpath.navigator.Node;
import com.github.simy4.xpath.spi.Effect;
import com.github.simy4.xpath.view.AbstractViewVisitor;
import com.github.simy4.xpath.view.IterableNodeView;
import com.github.simy4.xpath.view.NodeView;
import com.github.simy4.xpath.view.View;
import com.github.simy4.xpath.view.ViewVisitor;

import java.io.Serializable;

public class PutEffect implements Effect, Serializable {

    private static final long serialVersionUID = 1L;

    private static final ViewVisitor<? extends Node, Void> eagerVisitor = new EagerVisitor<Node>();

    private final Expr expr;

    public PutEffect(Expr expr) {
        this.expr = expr;
    }

    @Override
    @SuppressWarnings("unchecked")
    public <N extends Node> void perform(Navigator<N> navigator, N xml) throws XmlBuilderException {
        expr.resolve(navigator, new NodeView<N>(xml), true).visit((ViewVisitor<N, Void>) eagerVisitor);
    }

    private static final class EagerVisitor<N extends Node> extends AbstractViewVisitor<N, Void> {

        @Override
        @SuppressWarnings({"StatementWithEmptyBody", "UnusedVariable"})
        public Void visit(IterableNodeView<N> nodeSet) throws XmlBuilderException {
            for (NodeView<N> ignored : nodeSet) { } // eagerly consume resolved iterable
            return null;
        }

        @Override
        protected Void returnDefault(View<N> view) {
            return null;
        }

    }

}

@@ -692,18 +692,8 @@
 tor%3C
-? extends 
 Node
@@ -735,14 +735,8 @@
 itor
-%3CNode%3E
 ();%0A
@@ -1137,32 +1137,16 @@
 rVisitor
-%3CN extends Node%3E
  extends
@@ -1163,24 +1163,27 @@
 iewVisitor%3CN
+ode
 , Void%3E %7B%0A%0A 
@@ -1315,16 +1315,19 @@
 deView%3CN
+ode
 %3E nodeSe
@@ -1385,16 +1385,19 @@
 deView%3CN
+ode
 %3E ignore
@@ -1547,16 +1547,19 @@
 t(View%3CN
+ode
 %3E view) 

Make EagerVisitor less generic.