Move to internal packages

This commit is contained in:
Clément Fournier
2019-04-28 20:55:53 +02:00
parent 5844d5c594
commit fbd936aa26
5 changed files with 20 additions and 19 deletions

View File

@ -13,6 +13,7 @@ import net.sourceforge.pmd.lang.ParserOptions;
import net.sourceforge.pmd.lang.TokenManager;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.ParseException;
import net.sourceforge.pmd.lang.xml.ast.internal.XmlParserImpl;
/**
* Adapter for the XmlParser.
@ -35,7 +36,7 @@ public class XmlParser extends AbstractParser {
@Override
public Node parse(String fileName, Reader source) throws ParseException {
return new net.sourceforge.pmd.lang.xml.ast.XmlParser((XmlParserOptions) parserOptions).parse(source);
return new XmlParserImpl((XmlParserOptions) parserOptions).parse(source);
}
@Override

View File

@ -1,21 +1,19 @@
/**
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.xml.ast;
package net.sourceforge.pmd.lang.xml.ast.internal;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import org.w3c.dom.Document;
import org.w3c.dom.DocumentType;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
import org.w3c.dom.ProcessingInstruction;
import net.sourceforge.pmd.lang.ast.SourceCodePositioner;
import net.sourceforge.pmd.lang.xml.ast.XmlParser.RootXmlNode;
import net.sourceforge.pmd.lang.xml.ast.internal.XmlParserImpl.RootXmlNode;
/**
*

View File

@ -1,8 +1,8 @@
/**
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.xml.ast;
package net.sourceforge.pmd.lang.xml.ast.internal;
import java.util.ArrayList;
@ -20,6 +20,7 @@ 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.dfa.DataFlowNode;
import net.sourceforge.pmd.lang.xml.ast.XmlNode;
import net.sourceforge.pmd.util.CompoundIterator;
@ -29,14 +30,14 @@ import net.sourceforge.pmd.util.CompoundIterator;
* @author Clément Fournier
* @since 6.1.0
*/
public class XmlNodeWrapper extends AbstractNode implements XmlNode {
class XmlNodeWrapper extends AbstractNode implements XmlNode {
private final XmlParser parser;
private final XmlParserImpl parser;
private Object userData;
private final org.w3c.dom.Node node;
public XmlNodeWrapper(XmlParser parser, org.w3c.dom.Node domNode) {
XmlNodeWrapper(XmlParserImpl parser, org.w3c.dom.Node domNode) {
super(0);
this.node = domNode;
this.parser = parser;

View File

@ -1,8 +1,8 @@
/**
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.xml.ast;
package net.sourceforge.pmd.lang.xml.ast.internal;
import java.io.IOException;
import java.io.Reader;
@ -22,15 +22,16 @@ import org.xml.sax.SAXException;
import net.sourceforge.pmd.lang.ast.ParseException;
import net.sourceforge.pmd.lang.ast.RootNode;
import net.sourceforge.pmd.lang.xml.XmlParserOptions;
import net.sourceforge.pmd.lang.xml.ast.XmlNode;
public class XmlParser {
public class XmlParserImpl {
private final XmlParserOptions parserOptions;
private Map<org.w3c.dom.Node, XmlNode> nodeCache = new HashMap<>();
public XmlParser(XmlParserOptions parserOptions) {
public XmlParserImpl(XmlParserOptions parserOptions) {
this.parserOptions = parserOptions;
}
@ -94,8 +95,8 @@ public class XmlParser {
/**
* The root should implement {@link RootNode}.
*/
public static class RootXmlNode extends XmlNodeWrapper implements RootNode {
RootXmlNode(XmlParser parser, Node domNode) {
static class RootXmlNode extends XmlNodeWrapper implements RootNode {
RootXmlNode(XmlParserImpl parser, Node domNode) {
super(parser, domNode);
}
}

View File

@ -24,11 +24,11 @@ import net.sourceforge.pmd.lang.Parser;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.xpath.Attribute;
import net.sourceforge.pmd.lang.xml.ast.XmlNode;
import net.sourceforge.pmd.lang.xml.ast.XmlParser;
import net.sourceforge.pmd.lang.xml.ast.internal.XmlParserImpl;
import net.sourceforge.pmd.util.StringUtil;
/**
* Unit test for the {@link XmlParser}.
* Unit test for the {@link XmlParserImpl}.
*/
public class XmlParserTest {