diff --git a/pmd-scala/src/main/java/net/sourceforge/pmd/lang/scala/ast/DumpFacade.java b/pmd-scala/src/main/java/net/sourceforge/pmd/lang/scala/ast/DumpFacade.java index 78b3f81c11..1bbdbeab39 100644 --- a/pmd-scala/src/main/java/net/sourceforge/pmd/lang/scala/ast/DumpFacade.java +++ b/pmd-scala/src/main/java/net/sourceforge/pmd/lang/scala/ast/DumpFacade.java @@ -58,9 +58,11 @@ public class DumpFacade extends ScalaParserVisitorAdapter { StringBuilder sb = new StringBuilder(); while (attributeIter.hasNext()) { Attribute attr = attributeIter.next(); - sb.append(attr.getName()).append("=").append(attr.getStringValue()).append(","); + sb.append(attr.getName()).append("=").append(attr.getStringValue()).append(", "); + } + if (sb.length() != 0) { + attrs = sb.delete(sb.length() - 2, sb.length()).toString(); } - attrs = sb.deleteCharAt(sb.length()).toString(); } if (image != null) { diff --git a/pmd-scala/src/main/java/net/sourceforge/pmd/lang/scala/ast/ScalaWrapperNode.java b/pmd-scala/src/main/java/net/sourceforge/pmd/lang/scala/ast/ScalaWrapperNode.java index 1201732afd..659b565b38 100644 --- a/pmd-scala/src/main/java/net/sourceforge/pmd/lang/scala/ast/ScalaWrapperNode.java +++ b/pmd-scala/src/main/java/net/sourceforge/pmd/lang/scala/ast/ScalaWrapperNode.java @@ -4,17 +4,11 @@ package net.sourceforge.pmd.lang.scala.ast; -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; import java.util.Objects; import net.sourceforge.pmd.lang.ast.AbstractNode; import net.sourceforge.pmd.lang.ast.Node; -import net.sourceforge.pmd.lang.ast.xpath.Attribute; import net.sourceforge.pmd.lang.scala.ScalaParser; -import net.sourceforge.pmd.util.CompoundIterator; import scala.meta.Tree; import scala.meta.inputs.Position; @@ -40,8 +34,8 @@ public class ScalaWrapperNode extends AbstractNode implements ScalaNode { this.node = scalaNode; Position pos = node.pos(); beginLine = pos.startLine() + 1; - endLine = pos.endLine(); - beginColumn = pos.startColumn(); + endLine = pos.endLine() + 1; + beginColumn = pos.startColumn() + 1; endColumn = pos.endColumn() + 1; } @@ -158,25 +152,4 @@ public class ScalaWrapperNode extends AbstractNode implements ScalaNode { throw new UnsupportedOperationException(); } - @Override - public Iterator getXPathAttributesIterator() { - List> iterators = new ArrayList<>(); - - // Possible things we would want to expose to the XPath AST - // - // JavaConverters.asJava(node.productElementNames()).forEachRemaining(System.out::print); - // JavaConverters.asJava(node.productFields()).forEach(System.out::print); - // JavaConverters.asJava(node.productIterator()).forEachRemaining(System.out::print); - - String image = getImage(); - if (image != null) { - iterators.add(Collections.singletonList(new Attribute(this, "Image", image)).iterator()); - } - - @SuppressWarnings("unchecked") - Iterator[] it = new Iterator[iterators.size()]; - - return new CompoundIterator<>(iterators.toArray(it)); - } - }