Partially revert

This commit is contained in:
Clément Fournier
2020-08-25 03:13:27 +02:00
parent dd303a0903
commit 5015383fc6
2 changed files with 8 additions and 12 deletions

View File

@ -282,17 +282,19 @@ public interface Node {
* @param visitor Visitor to dispatch
* @param data Parameter to the visit
*
* @return What the visitor returned
*
* @throws IllegalArgumentException If the visitor is incompatible with this node
* @return What the visitor returned. If this node doesn't recognize
* the type of the visitor, returns {@link AstVisitor#cannotVisit(Node, Object) visitor.cannotVisit(this, data)}.
*
* @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). If the
* visitor is not handled, call {@link AstVisitor#cannotVisit(Node, Object)}.
* a different override per concrete node class (no shortcuts).
*
* The default implementation calls back {@link AstVisitor#cannotVisit(Node, Object)}.
*/
<P, R> R acceptVisitor(AstVisitor<? super P, ? extends R> visitor, P data);
default <P, R> R acceptVisitor(AstVisitor<? super P, ? extends R> visitor, P data) {
return visitor.cannotVisit(this, data);
}
/**

View File

@ -15,7 +15,6 @@ 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;
@ -162,11 +161,6 @@ 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() {
return node;