Remove default implementation
This commit is contained in:
@ -289,13 +289,10 @@ public interface Node {
|
||||
* @implSpec A typical implementation will check the type of the visitor to
|
||||
* be that of the language specific visitor, then call the most specific
|
||||
* visit method of this Node. This is typically implemented by having
|
||||
* a different override per concrete node class (no shortcuts).
|
||||
* a different override per concrete node class (no shortcuts). If the
|
||||
* visitor is not handled, call {@link AstVisitor#cannotVisit(Node, Object)}.
|
||||
*/
|
||||
// TODO remove the default implementation, convert all visitors to be generic
|
||||
default <P, R> R acceptVisitor(AstVisitor<? super P, ? extends R> visitor, P data) {
|
||||
// override me
|
||||
throw new IllegalArgumentException("Unsupported visitor" + visitor + " for node " + this);
|
||||
}
|
||||
<P, R> R acceptVisitor(AstVisitor<? super P, ? extends R> visitor, P data);
|
||||
|
||||
|
||||
/**
|
||||
|
@ -15,6 +15,7 @@ import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.NodeList;
|
||||
import org.w3c.dom.Text;
|
||||
|
||||
import net.sourceforge.pmd.lang.ast.AstVisitor;
|
||||
import net.sourceforge.pmd.lang.rule.xpath.Attribute;
|
||||
import net.sourceforge.pmd.lang.xml.ast.XmlNode;
|
||||
import net.sourceforge.pmd.util.CompoundIterator;
|
||||
@ -161,6 +162,10 @@ class XmlNodeWrapper implements XmlNode {
|
||||
return new CompoundIterator<>(iterators.toArray(it));
|
||||
}
|
||||
|
||||
@Override
|
||||
public <P, R> R acceptVisitor(AstVisitor<? super P, ? extends R> visitor, P data) {
|
||||
return visitor.cannotVisit(this, data);
|
||||
}
|
||||
|
||||
@Override
|
||||
public org.w3c.dom.Node getNode() {
|
||||
|
Reference in New Issue
Block a user