diff --git a/pmd-jsp/etc/grammar/JspParser.jjt b/pmd-jsp/etc/grammar/Jsp.jjt
similarity index 98%
rename from pmd-jsp/etc/grammar/JspParser.jjt
rename to pmd-jsp/etc/grammar/Jsp.jjt
index 08b9218a32..f286783d96 100644
--- a/pmd-jsp/etc/grammar/JspParser.jjt
+++ b/pmd-jsp/etc/grammar/Jsp.jjt
@@ -15,37 +15,38 @@
* Script code inside is not parsed.
*/
-options {
+options {
USER_CHAR_STREAM = true;
NODE_USES_PARSER=true;
UNICODE_INPUT=true;
- FORCE_LA_CHECK = false;
- IGNORE_CASE = true;
- STATIC = false;
-
+ FORCE_LA_CHECK = false;
+ IGNORE_CASE = true;
+ STATIC = false;
+
MULTI=true;
VISITOR=true;
TRACK_TOKENS = true;
-}
+}
-PARSER_BEGIN(JspParser)
+PARSER_BEGIN(JspParserImpl)
package net.sourceforge.pmd.lang.jsp.ast;
import net.sourceforge.pmd.lang.ast.CharStream;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
+import net.sourceforge.pmd.lang.ast.impl.javacc.JavaccToken;
-/**
+/**
* JSP Parser for PMD.
* @author Pieter, Application Engineers NV/SA, http://www.ae.be
*/
-public class JspParser {
+public class JspParserImpl {
/**
* Counter used to keep track of unclosed tags
*/
private OpenTagRegister tagRegister = new OpenTagRegister();
-
+
/**
* Return the contents of a quote.
* @param quote String - starting and ending with " or '
@@ -55,7 +56,7 @@ public class JspParser {
private static String quoteContent(String quote) {
return quote.substring(1, quote.length()-1);
}
-
+
/**
* Return the contents of a EL expression or a Value Binding expression.
* @param expression String - starting with ${ or #{ and ending with }
@@ -67,7 +68,7 @@ public class JspParser {
}
}
-PARSER_END(JspParser)
+PARSER_END(JspParserImpl)
/** ******************************************************************** */
diff --git a/pmd-jsp/pom.xml b/pmd-jsp/pom.xml
index fa27b7982e..9c138a7b0c 100644
--- a/pmd-jsp/pom.xml
+++ b/pmd-jsp/pom.xml
@@ -38,9 +38,10 @@
generate-sources
-
-
+
+
+
diff --git a/pmd-jsp/src/main/ant/alljavacc.xml b/pmd-jsp/src/main/ant/alljavacc.xml
deleted file mode 100644
index 80c1b43001..0000000000
--- a/pmd-jsp/src/main/ant/alljavacc.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public class
-
-
-
- public class Token implements java.io.Serializable
-
-
-
-
-
- public Token specialToken;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/cpd/JSPLanguage.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/cpd/JSPLanguage.java
index 543602a60c..c4c480cecc 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/cpd/JSPLanguage.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/cpd/JSPLanguage.java
@@ -1,4 +1,4 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/cpd/JSPTokenizer.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/cpd/JSPTokenizer.java
index 559f6b40a4..26d9c7a260 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/cpd/JSPTokenizer.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/cpd/JSPTokenizer.java
@@ -1,41 +1,21 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
+import org.apache.commons.io.input.CharSequenceReader;
-import net.sourceforge.pmd.lang.LanguageRegistry;
-import net.sourceforge.pmd.lang.LanguageVersionHandler;
+import net.sourceforge.pmd.cpd.internal.JavaCCTokenizer;
import net.sourceforge.pmd.lang.TokenManager;
-import net.sourceforge.pmd.lang.jsp.JspLanguageModule;
-import net.sourceforge.pmd.lang.jsp.ast.Token;
+import net.sourceforge.pmd.lang.jsp.ast.JspTokenManager;
import net.sourceforge.pmd.util.IOUtil;
-public class JSPTokenizer implements Tokenizer {
+public class JSPTokenizer extends JavaCCTokenizer {
@Override
- public void tokenize(SourceCode sourceCode, Tokens tokenEntries) {
- StringBuilder buffer = sourceCode.getCodeBuffer();
- LanguageVersionHandler languageVersionHandler = LanguageRegistry.getLanguage(JspLanguageModule.NAME)
- .getDefaultVersion().getLanguageVersionHandler();
-
- try (Reader reader = IOUtil.skipBOM(new StringReader(buffer.toString()))) {
- TokenManager tokenMgr = languageVersionHandler.getParser(languageVersionHandler.getDefaultParserOptions())
- .getTokenManager(sourceCode.getFileName(), reader);
- Token currentToken = (Token) tokenMgr.getNextToken();
-
- while (currentToken.image.length() > 0) {
- tokenEntries.add(new TokenEntry(String.valueOf(currentToken.kind), sourceCode.getFileName(),
- currentToken.beginLine, currentToken.beginColumn, currentToken.endColumn));
- currentToken = (Token) tokenMgr.getNextToken();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- tokenEntries.add(TokenEntry.getEOF());
+ protected TokenManager getLexerForSource(SourceCode sourceCode) {
+ return new JspTokenManager(IOUtil.skipBOM(new CharSequenceReader(sourceCode.getCodeBuffer())));
}
+
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspHandler.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspHandler.java
index 4dde455568..ebfa9b7785 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspHandler.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspHandler.java
@@ -1,4 +1,4 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
@@ -7,6 +7,7 @@ package net.sourceforge.pmd.lang.jsp;
import net.sourceforge.pmd.lang.AbstractPmdLanguageVersionHandler;
import net.sourceforge.pmd.lang.Parser;
import net.sourceforge.pmd.lang.ParserOptions;
+import net.sourceforge.pmd.lang.jsp.ast.JspParser;
/**
* Implementation of LanguageVersionHandler for the JSP parser.
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspLanguageModule.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspLanguageModule.java
index 2ad43f34be..549762e523 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspLanguageModule.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspLanguageModule.java
@@ -1,4 +1,4 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTAttribute.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTAttribute.java
index deaf9d9aef..f0148427e0 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTAttribute.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTAttribute.java
@@ -4,31 +4,19 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTAttribute extends AbstractJspNode {
+public final class ASTAttribute extends AbstractJspNode {
private String name;
- @InternalApi
- @Deprecated
- public ASTAttribute(int id) {
+ ASTAttribute(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTAttribute(JspParser p, int id) {
- super(p, id);
- }
-
public String getName() {
return name;
}
- @InternalApi
- @Deprecated
- public void setName(String name) {
+ void setName(String name) {
this.name = name;
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTAttributeValue.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTAttributeValue.java
index f84c97b55f..fb27af1df7 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTAttributeValue.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTAttributeValue.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTAttributeValue extends AbstractJspNode {
-public class ASTAttributeValue extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTAttributeValue(int id) {
+ ASTAttributeValue(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTAttributeValue(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTCData.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTCData.java
index b4aa3c6831..28fb132a70 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTCData.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTCData.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTCData extends AbstractJspNode {
-public class ASTCData extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTCData(int id) {
+ ASTCData(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTCData(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTCommentTag.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTCommentTag.java
index 0fcc4f175d..0d82ec39a4 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTCommentTag.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTCommentTag.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTCommentTag extends AbstractJspNode {
-public class ASTCommentTag extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTCommentTag(int id) {
+ ASTCommentTag(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTCommentTag(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTCompilationUnit.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTCompilationUnit.java
index d3232029ab..2b36ed8dea 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTCompilationUnit.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTCompilationUnit.java
@@ -4,20 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.ast.RootNode;
-public class ASTCompilationUnit extends AbstractJspNode implements RootNode {
- @InternalApi
- @Deprecated
- public ASTCompilationUnit(int id) {
- super(id);
- }
+public final class ASTCompilationUnit extends AbstractJspNode implements RootNode {
- @InternalApi
- @Deprecated
- public ASTCompilationUnit(JspParser p, int id) {
- super(p, id);
+ ASTCompilationUnit(int id) {
+ super(id);
}
@Override
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTContent.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTContent.java
index b3c7dbac0d..955868fea3 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTContent.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTContent.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTContent extends AbstractJspNode {
-public class ASTContent extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTContent(int id) {
+ ASTContent(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTContent(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDeclaration.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDeclaration.java
index d2c0bc815d..239dd27386 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDeclaration.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDeclaration.java
@@ -4,31 +4,19 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTDeclaration extends AbstractJspNode {
+public final class ASTDeclaration extends AbstractJspNode {
private String name;
- @InternalApi
- @Deprecated
- public ASTDeclaration(int id) {
+ ASTDeclaration(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTDeclaration(JspParser p, int id) {
- super(p, id);
- }
-
public String getName() {
return name;
}
- @InternalApi
- @Deprecated
- public void setName(String name) {
+ void setName(String name) {
this.name = name;
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDoctypeDeclaration.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDoctypeDeclaration.java
index b8936498db..6a2dfc7f32 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDoctypeDeclaration.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDoctypeDeclaration.java
@@ -4,34 +4,22 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTDoctypeDeclaration extends AbstractJspNode {
+public final class ASTDoctypeDeclaration extends AbstractJspNode {
/**
* Name of the document type. Cannot be null.
*/
private String name;
- @InternalApi
- @Deprecated
- public ASTDoctypeDeclaration(int id) {
+ ASTDoctypeDeclaration(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTDoctypeDeclaration(JspParser p, int id) {
- super(p, id);
- }
-
public String getName() {
return name;
}
- @InternalApi
- @Deprecated
- public void setName(String name) {
+ void setName(String name) {
this.name = name;
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDoctypeExternalId.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDoctypeExternalId.java
index d78ab5136f..1c58ae5aa1 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDoctypeExternalId.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDoctypeExternalId.java
@@ -4,9 +4,7 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTDoctypeExternalId extends AbstractJspNode {
+public final class ASTDoctypeExternalId extends AbstractJspNode {
/**
* URI of the external entity. Cannot be null.
@@ -18,18 +16,10 @@ public class ASTDoctypeExternalId extends AbstractJspNode {
*/
private String publicId;
- @InternalApi
- @Deprecated
- public ASTDoctypeExternalId(int id) {
+ ASTDoctypeExternalId(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTDoctypeExternalId(JspParser p, int id) {
- super(p, id);
- }
-
public boolean isHasPublicId() {
return null != publicId;
}
@@ -38,9 +28,7 @@ public class ASTDoctypeExternalId extends AbstractJspNode {
return uri;
}
- @InternalApi
- @Deprecated
- public void setUri(String uri) {
+ void setUri(String uri) {
this.uri = uri;
}
@@ -52,9 +40,7 @@ public class ASTDoctypeExternalId extends AbstractJspNode {
return null == publicId ? "" : publicId;
}
- @InternalApi
- @Deprecated
- public void setPublicId(String publicId) {
+ void setPublicId(String publicId) {
this.publicId = publicId;
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTElExpression.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTElExpression.java
index 5cdb60f8e3..3a70816338 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTElExpression.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTElExpression.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTElExpression extends AbstractJspNode {
-public class ASTElExpression extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTElExpression(int id) {
+ ASTElExpression(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTElExpression(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTElement.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTElement.java
index fe95d24606..6a9fe71b3b 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTElement.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTElement.java
@@ -4,9 +4,7 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTElement extends AbstractJspNode {
+public final class ASTElement extends AbstractJspNode {
/**
* Name of the element-tag. Cannot be null.
@@ -24,18 +22,10 @@ public class ASTElement extends AbstractJspNode {
*/
private boolean unclosed;
- @InternalApi
- @Deprecated
- public ASTElement(int id) {
+ ASTElement(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTElement(JspParser p, int id) {
- super(p, id);
- }
-
/**
* @return boolean - true if the element has a namespace-prefix, false
* otherwise
@@ -67,9 +57,7 @@ public class ASTElement extends AbstractJspNode {
return name;
}
- @InternalApi
- @Deprecated
- public void setName(String name) {
+ void setName(String name) {
this.name = name;
}
@@ -81,15 +69,11 @@ public class ASTElement extends AbstractJspNode {
return unclosed;
}
- @InternalApi
- @Deprecated
- public void setUnclosed(boolean unclosed) {
+ void setUnclosed(boolean unclosed) {
this.unclosed = unclosed;
}
- @InternalApi
- @Deprecated
- public void setEmpty(boolean empty) {
+ void setEmpty(boolean empty) {
this.empty = empty;
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTHtmlScript.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTHtmlScript.java
index 4bfb1bc583..ab13b5043f 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTHtmlScript.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTHtmlScript.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTHtmlScript extends AbstractJspNode {
-public class ASTHtmlScript extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTHtmlScript(int id) {
+ ASTHtmlScript(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTHtmlScript(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspComment.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspComment.java
index cc2fce9fc4..ae31ae2966 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspComment.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspComment.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTJspComment extends AbstractJspNode {
-public class ASTJspComment extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTJspComment(int id) {
+ ASTJspComment(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTJspComment(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDeclaration.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDeclaration.java
index a2791a662c..5089a7d476 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDeclaration.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDeclaration.java
@@ -4,21 +4,11 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTJspDeclaration extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTJspDeclaration(int id) {
+public final class ASTJspDeclaration extends AbstractJspNode {
+ ASTJspDeclaration(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTJspDeclaration(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDeclarations.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDeclarations.java
index 2d1cc558b7..439a9ff24e 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDeclarations.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDeclarations.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTJspDeclarations extends AbstractJspNode {
-public class ASTJspDeclarations extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTJspDeclarations(int id) {
+ ASTJspDeclarations(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTJspDeclarations(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDirective.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDirective.java
index b043817a3d..f61ec9007d 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDirective.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDirective.java
@@ -4,34 +4,22 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTJspDirective extends AbstractJspNode {
+public final class ASTJspDirective extends AbstractJspNode {
/**
* Name of the element-tag. Cannot be null.
*/
private String name;
- @InternalApi
- @Deprecated
- public ASTJspDirective(int id) {
+ ASTJspDirective(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTJspDirective(JspParser p, int id) {
- super(p, id);
- }
-
public String getName() {
return name;
}
- @InternalApi
- @Deprecated
- public void setName(String name) {
+ void setName(String name) {
this.name = name;
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDirectiveAttribute.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDirectiveAttribute.java
index a85f104993..77b5fdd40c 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDirectiveAttribute.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDirectiveAttribute.java
@@ -4,32 +4,20 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTJspDirectiveAttribute extends AbstractJspNode {
+public final class ASTJspDirectiveAttribute extends AbstractJspNode {
private String name;
private String value;
- @InternalApi
- @Deprecated
- public ASTJspDirectiveAttribute(int id) {
+ ASTJspDirectiveAttribute(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTJspDirectiveAttribute(JspParser p, int id) {
- super(p, id);
- }
-
public String getName() {
return name;
}
- @InternalApi
- @Deprecated
- public void setName(String name) {
+ void setName(String name) {
this.name = name;
}
@@ -37,9 +25,7 @@ public class ASTJspDirectiveAttribute extends AbstractJspNode {
return value;
}
- @InternalApi
- @Deprecated
- public void setValue(String value) {
+ void setValue(String value) {
this.value = value;
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDocument.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDocument.java
index 02290ece1d..7cfce1375d 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDocument.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDocument.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTJspDocument extends AbstractJspNode {
-public class ASTJspDocument extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTJspDocument(int id) {
+ ASTJspDocument(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTJspDocument(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspExpression.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspExpression.java
index 3d5945396b..84b13135bf 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspExpression.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspExpression.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTJspExpression extends AbstractJspNode {
-public class ASTJspExpression extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTJspExpression(int id) {
+ ASTJspExpression(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTJspExpression(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspExpressionInAttribute.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspExpressionInAttribute.java
index 0bbd10e434..607124b0eb 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspExpressionInAttribute.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspExpressionInAttribute.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTJspExpressionInAttribute extends AbstractJspNode {
-public class ASTJspExpressionInAttribute extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTJspExpressionInAttribute(int id) {
+ ASTJspExpressionInAttribute(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTJspExpressionInAttribute(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspScriptlet.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspScriptlet.java
index 2d574e179f..c05043ae44 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspScriptlet.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspScriptlet.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTJspScriptlet extends AbstractJspNode {
-public class ASTJspScriptlet extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTJspScriptlet(int id) {
+ ASTJspScriptlet(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTJspScriptlet(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTText.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTText.java
index 6b0b15408d..465c0afae9 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTText.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTText.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTText extends AbstractJspNode {
-public class ASTText extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTText(int id) {
+ ASTText(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTText(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTUnparsedText.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTUnparsedText.java
index ff99b5b7e2..c8698037e5 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTUnparsedText.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTUnparsedText.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTUnparsedText extends AbstractJspNode {
-public class ASTUnparsedText extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTUnparsedText(int id) {
+ ASTUnparsedText(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTUnparsedText(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTValueBinding.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTValueBinding.java
index afcfd76fa6..6798fce8cc 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTValueBinding.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTValueBinding.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTValueBinding extends AbstractJspNode {
-public class ASTValueBinding extends AbstractJspNode {
- @InternalApi
- @Deprecated
- public ASTValueBinding(int id) {
+ ASTValueBinding(int id) {
super(id);
}
- @InternalApi
- @Deprecated
- public ASTValueBinding(JspParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(JspParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/AbstractJspNode.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/AbstractJspNode.java
index 5da078d6fe..9a56d46876 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/AbstractJspNode.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/AbstractJspNode.java
@@ -1,73 +1,19 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.jsp.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractJjtreeNode;
-@InternalApi
-@Deprecated
-public class AbstractJspNode extends AbstractJjtreeNode implements JspNode {
+abstract class AbstractJspNode extends AbstractJjtreeNode implements JspNode {
- protected JspParser parser;
-
- public AbstractJspNode(int id) {
+ protected AbstractJspNode(int id) {
super(id);
}
- public AbstractJspNode(JspParser parser, int id) {
- super(id);
- this.parser = parser;
- }
-
- @Override
- public void jjtOpen() {
- if (beginLine == -1 && parser.token.next != null) {
- beginLine = parser.token.next.beginLine;
- beginColumn = parser.token.next.beginColumn;
- }
- }
-
- @Override
- public void jjtClose() {
- if (beginLine == -1 && children.length == 0) {
- beginColumn = parser.token.beginColumn;
- }
- if (beginLine == -1) {
- beginLine = parser.token.beginLine;
- }
- endLine = parser.token.endLine;
- endColumn = parser.token.endColumn;
- }
-
- /**
- * Accept the visitor. *
- */
- @Override
- public Object jjtAccept(JspParserVisitor visitor, Object data) {
- return visitor.visit(this, data);
- }
-
- /**
- * Accept the visitor. *
- */
- @Override
- public Object childrenAccept(JspParserVisitor visitor, Object data) {
- for (Node child : children()) {
- ((JspNode) child).jjtAccept(visitor, data);
- }
-
- return data;
- }
-
-
-
-
@Override
public String getXPathNodeName() {
- return JspParserTreeConstants.jjtNodeName[id];
+ return JspParserImplTreeConstants.jjtNodeName[id];
}
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspNode.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspNode.java
index 56f356faa7..a036186852 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspNode.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspNode.java
@@ -1,4 +1,4 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
@@ -10,20 +10,11 @@ import net.sourceforge.pmd.lang.ast.NodeStream;
public interface JspNode extends Node {
/**
- * Accept the visitor. *
+ * Accept the visitor.
*/
Object jjtAccept(JspParserVisitor visitor, Object data);
- /**
- * Accept the visitor. *
- * @deprecated This method is not useful, the logic for combining
- * children values should be present on the visitor, not the node
- */
- @Deprecated
- Object childrenAccept(JspParserVisitor visitor, Object data);
-
-
@Override
JspNode getChild(int index);
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspParser.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspParser.java
similarity index 87%
rename from pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspParser.java
rename to pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspParser.java
index 8c8a14ec4b..aae424ba60 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspParser.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspParser.java
@@ -1,8 +1,8 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
-package net.sourceforge.pmd.lang.jsp;
+package net.sourceforge.pmd.lang.jsp.ast;
import java.io.Reader;
@@ -37,7 +37,7 @@ public class JspParser extends AbstractParser {
@Override
public Node parse(String fileName, Reader source) throws ParseException {
AbstractTokenManager.setFileName(fileName);
- return new net.sourceforge.pmd.lang.jsp.ast.JspParser(CharStreamFactory.simpleCharStream(source)).CompilationUnit();
+ return new JspParserImpl(CharStreamFactory.simpleCharStream(source)).CompilationUnit();
}
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspParserVisitorAdapter.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspParserVisitorAdapter.java
index a167ecd04a..760515326c 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspParserVisitorAdapter.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspParserVisitorAdapter.java
@@ -1,4 +1,4 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
@@ -6,119 +6,4 @@ package net.sourceforge.pmd.lang.jsp.ast;
public class JspParserVisitorAdapter implements JspParserVisitor {
- @Override
- public Object visit(JspNode node, Object data) {
- node.childrenAccept(this, data);
- return null;
- }
-
- @Override
- public Object visit(ASTCompilationUnit node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTContent node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspDirective node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspDirectiveAttribute node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspScriptlet node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspExpression node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspDeclaration node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspComment node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTText node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTUnparsedText node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTElExpression node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTValueBinding node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTCData node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTElement node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTAttribute node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTAttributeValue node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspExpressionInAttribute node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTCommentTag node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTDeclaration node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTDoctypeDeclaration node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTDoctypeExternalId node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTHtmlScript node, Object data) {
- return visit((JspNode) node, data);
- }
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspTokenManager.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspTokenManager.java
similarity index 63%
rename from pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspTokenManager.java
rename to pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspTokenManager.java
index 40386750b5..d19385e1f8 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/JspTokenManager.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/JspTokenManager.java
@@ -1,28 +1,24 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
-package net.sourceforge.pmd.lang.jsp;
+package net.sourceforge.pmd.lang.jsp.ast;
import java.io.Reader;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.TokenManager;
import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
-import net.sourceforge.pmd.lang.jsp.ast.JspParserTokenManager;
/**
* JSP Token Manager implementation.
- *
- * @deprecated This is internal API
*/
-@Deprecated
@InternalApi
public class JspTokenManager implements TokenManager {
- private final JspParserTokenManager tokenManager;
+ private final JspParserImplTokenManager tokenManager;
public JspTokenManager(Reader source) {
- tokenManager = new JspParserTokenManager(CharStreamFactory.javaCharStream(source));
+ tokenManager = new JspParserImplTokenManager(CharStreamFactory.javaCharStream(source));
}
@Override
@@ -32,6 +28,6 @@ public class JspTokenManager implements TokenManager {
@Override
public void setFileName(String fileName) {
- JspParserTokenManager.setFileName(fileName);
+ JspParserImplTokenManager.setFileName(fileName);
}
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/OpenTagRegister.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/OpenTagRegister.java
index 1795ad8d10..f31d5fef77 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/OpenTagRegister.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/OpenTagRegister.java
@@ -20,9 +20,8 @@ import net.sourceforge.pmd.util.StringUtil;
* @author Victor Bucutea
*
*/
-@Deprecated
@InternalApi
-public class OpenTagRegister {
+class OpenTagRegister {
private List tagList = new ArrayList<>();
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/StartAndEndTagMismatchException.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/StartAndEndTagMismatchException.java
deleted file mode 100644
index 6a56f0a3d1..0000000000
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/StartAndEndTagMismatchException.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/**
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-package net.sourceforge.pmd.lang.jsp.ast;
-
-import net.sourceforge.pmd.lang.ast.ParseException;
-
-/**
- * @author Pieter_Van_Raemdonck
- * @since Created on 11-jan-2006
- *
- * @deprecated for removal with PMD 7.0.0. Use {@link ParseException} instead.
- */
-@Deprecated
-public class StartAndEndTagMismatchException extends SyntaxErrorException {
-
- private static final long serialVersionUID = 5434485938487458692L;
-
- public static final String START_END_TAG_MISMATCH_RULE_NAME = "Start and End Tags of an XML Element must match.";
-
- private final int startLine;
- private final int endLine;
- private final int startColumn;
- private final int endColumn;
- private final String startTagName;
- private final String endTagName;
-
- /**
- * Public constructor.
- *
- * @param startLine
- * @param startColumn
- * @param startTagName
- * @param endLine
- * @param endColumn
- * @param endTagName
- */
- public StartAndEndTagMismatchException(int startLine, int startColumn, String startTagName, int endLine,
- int endColumn, String endTagName) {
- super(endLine, START_END_TAG_MISMATCH_RULE_NAME);
- this.startLine = startLine;
- this.startColumn = startColumn;
- this.startTagName = startTagName;
-
- this.endLine = endLine;
- this.endColumn = endColumn;
- this.endTagName = endTagName;
- }
-
- /**
- * @return Returns the endColumn.
- */
- public int getEndColumn() {
- return endColumn;
- }
-
- /**
- * @return Returns the endLine.
- */
- public int getEndLine() {
- return endLine;
- }
-
- /**
- * @return Returns the startColumn.
- */
- public int getStartColumn() {
- return startColumn;
- }
-
- /**
- * @return Returns the startLine.
- */
- public int getStartLine() {
- return startLine;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Throwable#getMessage()
- */
- @Override
- public String getMessage() {
- return "The start-tag of element \"" + startTagName + "\" (line " + startLine + ", column " + startColumn
- + ") does not correspond to the end-tag found: \"" + endTagName + "\" (line " + endLine + ", column "
- + endColumn + ").";
- }
-}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/SyntaxErrorException.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/SyntaxErrorException.java
deleted file mode 100644
index 37513a2c90..0000000000
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/SyntaxErrorException.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-package net.sourceforge.pmd.lang.jsp.ast;
-
-import net.sourceforge.pmd.lang.ast.ParseException;
-
-/**
- * Exception indicating that a syntactic error has been found.
- *
- * @author Pieter_Van_Raemdonck
- * @since Created on 11-jan-2006
- *
- * @deprecated for removal with PMD 7.0.0. Use {@link ParseException} instead.
- */
-@Deprecated
-public abstract class SyntaxErrorException extends ParseException {
- private static final long serialVersionUID = -6702683724078264059L;
-
- private final int line;
- private final String ruleName;
-
- /**
- * @param line
- * @param ruleName
- */
- public SyntaxErrorException(int line, String ruleName) {
- super();
- this.line = line;
- this.ruleName = ruleName;
- }
-
- /**
- * @return Returns the line.
- */
- public int getLine() {
- return line;
- }
-
- /**
- * @return Returns the ruleName.
- */
- public String getRuleName() {
- return ruleName;
- }
-}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/rule/AbstractJspRule.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/rule/AbstractJspRule.java
index 9413adbb37..8cf146b528 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/rule/AbstractJspRule.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/rule/AbstractJspRule.java
@@ -10,28 +10,6 @@ import net.sourceforge.pmd.RuleContext;
import net.sourceforge.pmd.lang.LanguageRegistry;
import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.jsp.JspLanguageModule;
-import net.sourceforge.pmd.lang.jsp.ast.ASTAttribute;
-import net.sourceforge.pmd.lang.jsp.ast.ASTAttributeValue;
-import net.sourceforge.pmd.lang.jsp.ast.ASTCData;
-import net.sourceforge.pmd.lang.jsp.ast.ASTCommentTag;
-import net.sourceforge.pmd.lang.jsp.ast.ASTCompilationUnit;
-import net.sourceforge.pmd.lang.jsp.ast.ASTContent;
-import net.sourceforge.pmd.lang.jsp.ast.ASTDeclaration;
-import net.sourceforge.pmd.lang.jsp.ast.ASTDoctypeDeclaration;
-import net.sourceforge.pmd.lang.jsp.ast.ASTDoctypeExternalId;
-import net.sourceforge.pmd.lang.jsp.ast.ASTElExpression;
-import net.sourceforge.pmd.lang.jsp.ast.ASTElement;
-import net.sourceforge.pmd.lang.jsp.ast.ASTHtmlScript;
-import net.sourceforge.pmd.lang.jsp.ast.ASTJspComment;
-import net.sourceforge.pmd.lang.jsp.ast.ASTJspDeclaration;
-import net.sourceforge.pmd.lang.jsp.ast.ASTJspDirective;
-import net.sourceforge.pmd.lang.jsp.ast.ASTJspDirectiveAttribute;
-import net.sourceforge.pmd.lang.jsp.ast.ASTJspExpression;
-import net.sourceforge.pmd.lang.jsp.ast.ASTJspExpressionInAttribute;
-import net.sourceforge.pmd.lang.jsp.ast.ASTJspScriptlet;
-import net.sourceforge.pmd.lang.jsp.ast.ASTText;
-import net.sourceforge.pmd.lang.jsp.ast.ASTUnparsedText;
-import net.sourceforge.pmd.lang.jsp.ast.ASTValueBinding;
import net.sourceforge.pmd.lang.jsp.ast.JspNode;
import net.sourceforge.pmd.lang.jsp.ast.JspParserVisitor;
import net.sourceforge.pmd.lang.rule.AbstractRule;
@@ -54,128 +32,4 @@ public abstract class AbstractJspRule extends AbstractRule implements JspParserV
visit(node, ctx);
}
}
-
- //
- // The following APIs are identical to those in JspParserVisitorAdapter.
- // Due to Java single inheritance, it preferred to extend from the more
- // complex Rule base class instead of from relatively simple Visitor.
- //
-
- @Override
- public Object visit(JspNode node, Object data) {
- for (JspNode child : node.children()) {
- child.jjtAccept(this, data);
- }
- return null;
- }
-
- @Override
- public Object visit(ASTCompilationUnit node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTContent node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspDirective node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspDirectiveAttribute node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspScriptlet node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspExpression node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspDeclaration node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspComment node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTText node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTUnparsedText node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTElExpression node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTValueBinding node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTCData node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTElement node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTAttribute node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTAttributeValue node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTJspExpressionInAttribute node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTCommentTag node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTDeclaration node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTDoctypeDeclaration node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTDoctypeExternalId node, Object data) {
- return visit((JspNode) node, data);
- }
-
- @Override
- public Object visit(ASTHtmlScript node, Object data) {
- return visit((JspNode) node, data);
- }
}
diff --git a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/rule/codestyle/DuplicateJspImportsRule.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/rule/codestyle/DuplicateJspImportsRule.java
index b02003f632..1399b71a29 100644
--- a/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/rule/codestyle/DuplicateJspImportsRule.java
+++ b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/rule/codestyle/DuplicateJspImportsRule.java
@@ -5,12 +5,10 @@
package net.sourceforge.pmd.lang.jsp.rule.codestyle;
import java.util.HashSet;
-import java.util.List;
import java.util.Set;
import java.util.StringTokenizer;
import net.sourceforge.pmd.RuleContext;
-import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.jsp.ast.ASTJspDirectiveAttribute;
import net.sourceforge.pmd.lang.jsp.rule.AbstractJspRule;
import net.sourceforge.pmd.lang.rule.ImportWrapper;
@@ -20,14 +18,8 @@ public class DuplicateJspImportsRule extends AbstractJspRule {
private Set imports = new HashSet<>();
@Override
- public void apply(List extends Node> nodes, RuleContext ctx) {
- /*
- * TODO: This method is a hack! It's overriding the parent's method
- * because the JSP parsing doesn't seem to hit ASTCompilationUnit
- * properly
- */
+ public void start(RuleContext ctx) {
imports.clear();
- super.apply(nodes, ctx);
}
@Override
diff --git a/pmd-jsp/src/test/java/net/sourceforge/pmd/cpd/JSPTokenizerTest.java b/pmd-jsp/src/test/java/net/sourceforge/pmd/cpd/JSPTokenizerTest.java
index f16f1487c8..4c49ea6198 100644
--- a/pmd-jsp/src/test/java/net/sourceforge/pmd/cpd/JSPTokenizerTest.java
+++ b/pmd-jsp/src/test/java/net/sourceforge/pmd/cpd/JSPTokenizerTest.java
@@ -4,50 +4,44 @@
package net.sourceforge.pmd.cpd;
-import java.nio.charset.StandardCharsets;
-
-import org.apache.commons.io.IOUtils;
import org.junit.Assert;
import org.junit.Test;
-import net.sourceforge.pmd.lang.jsp.ast.JspParserConstants;
+import net.sourceforge.pmd.lang.jsp.JspParserTest;
-
-public class JSPTokenizerTest {
+public class JSPTokenizerTest extends JspParserTest {
@Test
public void scriptletWithString() throws Exception {
JSPTokenizer tokenizer = new JSPTokenizer();
Tokens tokenEntries = new Tokens();
- String code = IOUtils.toString(JSPTokenizerTest.class.getResourceAsStream("scriptletWithString.jsp"),
- StandardCharsets.UTF_8);
+ String code = jsp.readResource("scriptletWithString.jsp");
SourceCode sourceCode = new SourceCode(new SourceCode.StringCodeLoader(code));
tokenizer.tokenize(sourceCode, tokenEntries);
- int[] expectedTokens = new int[] {
- JspParserConstants.JSP_COMMENT_START,
- JspParserConstants.JSP_COMMENT_CONTENT,
- JspParserConstants.JSP_COMMENT_END,
- JspParserConstants.JSP_SCRIPTLET_START,
- JspParserConstants.JSP_SCRIPTLET,
- JspParserConstants.JSP_SCRIPTLET_END,
- JspParserConstants.JSP_SCRIPTLET_START,
- JspParserConstants.JSP_SCRIPTLET,
- JspParserConstants.JSP_SCRIPTLET_END,
- JspParserConstants.EOF,
- };
+ String[] expectedTokens = new String[] {
+ "<%--",
+ "\n"
+ + "BSD-style license; for more info see http://pmd.sourceforge.net/license.html\n",
+ "--%>",
+ "<%",
+ "\nString nodeContent = \"<% %>\";\n",
+ "%>",
+ "<%",
+ "\n\";\n"
+ + "]]>\n",
+ "%>",
+ "",
+ };
+
+
+
Assert.assertEquals(expectedTokens.length, tokenEntries.getTokens().size());
for (int i = 0; i < expectedTokens.length - 1; i++) {
- Assert.assertEquals(String.valueOf(expectedTokens[i]), tokenEntries.getTokens().get(i).toString());
+ TokenEntry tokenEntry = tokenEntries.getTokens().get(i);
+ Assert.assertEquals(expectedTokens[i], tokenEntry.toString());
}
- Assert.assertEquals("", getTokenImage(tokenEntries.getTokens().get(4)));
}
- private static String getTokenImage(TokenEntry token) {
- int kind = 0;
- if (token != TokenEntry.EOF) {
- kind = Integer.parseInt(token.toString());
- }
- return JspParserConstants.tokenImage[kind];
- }
}
diff --git a/pmd-lang-test/src/main/kotlin/net/sourceforge/pmd/lang/ast/test/BaseParsingHelper.kt b/pmd-lang-test/src/main/kotlin/net/sourceforge/pmd/lang/ast/test/BaseParsingHelper.kt
index 8b6010e73c..124f52bdaa 100644
--- a/pmd-lang-test/src/main/kotlin/net/sourceforge/pmd/lang/ast/test/BaseParsingHelper.kt
+++ b/pmd-lang-test/src/main/kotlin/net/sourceforge/pmd/lang/ast/test/BaseParsingHelper.kt
@@ -159,7 +159,7 @@ abstract class BaseParsingHelper, T : RootNode
open fun parseClass(clazz: Class<*>, version: String? = null): T =
parse(readClassSource(clazz), version)
- protected fun readResource(resourceName: String): String {
+ fun readResource(resourceName: String): String {
val rloader = params.resourceLoader ?: javaClass
val input = rloader.getResourceAsStream(params.resourcePrefix + resourceName)
diff --git a/pmd-visualforce/etc/grammar/VfParser.jjt b/pmd-visualforce/etc/grammar/Vf.jjt
similarity index 99%
rename from pmd-visualforce/etc/grammar/VfParser.jjt
rename to pmd-visualforce/etc/grammar/Vf.jjt
index 5e1bbf20d1..efdd76d50b 100644
--- a/pmd-visualforce/etc/grammar/VfParser.jjt
+++ b/pmd-visualforce/etc/grammar/Vf.jjt
@@ -11,13 +11,13 @@ options {
TRACK_TOKENS = true;
}
-PARSER_BEGIN(VfParser)
+PARSER_BEGIN(VfParserImpl)
package net.sourceforge.pmd.lang.vf.ast;
import net.sourceforge.pmd.lang.ast.CharStream;
import net.sourceforge.pmd.lang.ast.TokenMgrError;
-public class VfParser {
+public class VfParserImpl {
/**
@@ -46,7 +46,7 @@ public class VfParser {
}
}
-PARSER_END(VfParser)
+PARSER_END(VfParserImpl)
/** ************************* VF LEXICON **************************** */
diff --git a/pmd-visualforce/pom.xml b/pmd-visualforce/pom.xml
index 04ffc69700..98f220272b 100644
--- a/pmd-visualforce/pom.xml
+++ b/pmd-visualforce/pom.xml
@@ -36,17 +36,18 @@
generate-sources
generate-sources
-
-
-
-
-
-
-
-
run
+
+
+
+
+
+
+
+
+
diff --git a/pmd-visualforce/src/main/ant/alljavacc.xml b/pmd-visualforce/src/main/ant/alljavacc.xml
deleted file mode 100644
index fff5966898..0000000000
--- a/pmd-visualforce/src/main/ant/alljavacc.xml
+++ /dev/null
@@ -1,139 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- public class
-
-
-
- public class Token implements java.io.Serializable
-
-
-
-
- public Token specialToken;
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/cpd/VfLanguage.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/cpd/VfLanguage.java
index 4fa935d573..301bfc15c3 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/cpd/VfLanguage.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/cpd/VfLanguage.java
@@ -1,4 +1,4 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/cpd/VfTokenizer.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/cpd/VfTokenizer.java
index 13febc7b90..f2d981bc3b 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/cpd/VfTokenizer.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/cpd/VfTokenizer.java
@@ -1,45 +1,23 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.cpd;
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
+import org.apache.commons.io.input.CharSequenceReader;
-import net.sourceforge.pmd.lang.LanguageRegistry;
-import net.sourceforge.pmd.lang.LanguageVersionHandler;
+import net.sourceforge.pmd.cpd.internal.JavaCCTokenizer;
import net.sourceforge.pmd.lang.TokenManager;
-import net.sourceforge.pmd.lang.vf.VfLanguageModule;
-import net.sourceforge.pmd.lang.vf.ast.Token;
+import net.sourceforge.pmd.lang.vf.ast.VfTokenManager;
import net.sourceforge.pmd.util.IOUtil;
/**
* @author sergey.gorbaty
- *
*/
-public class VfTokenizer implements Tokenizer {
+public class VfTokenizer extends JavaCCTokenizer {
@Override
- public void tokenize(SourceCode sourceCode, Tokens tokenEntries) {
- StringBuilder buffer = sourceCode.getCodeBuffer();
- LanguageVersionHandler languageVersionHandler = LanguageRegistry.getLanguage(VfLanguageModule.NAME)
- .getDefaultVersion().getLanguageVersionHandler();
-
- try (Reader reader = IOUtil.skipBOM(new StringReader(buffer.toString()))) {
- TokenManager tokenMgr = languageVersionHandler.getParser(languageVersionHandler.getDefaultParserOptions())
- .getTokenManager(sourceCode.getFileName(), reader);
- Token currentToken = (Token) tokenMgr.getNextToken();
-
- while (currentToken.image.length() > 0) {
- tokenEntries.add(new TokenEntry(String.valueOf(currentToken.kind), sourceCode.getFileName(),
- currentToken.beginLine, currentToken.beginColumn, currentToken.endColumn));
- currentToken = (Token) tokenMgr.getNextToken();
- }
- } catch (IOException e) {
- e.printStackTrace();
- }
- tokenEntries.add(TokenEntry.getEOF());
+ protected TokenManager getLexerForSource(SourceCode sourceCode) {
+ return new VfTokenManager(IOUtil.skipBOM(new CharSequenceReader(sourceCode.getCodeBuffer())));
}
}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfHandler.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfHandler.java
index d46c19f074..734c742be1 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfHandler.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfHandler.java
@@ -1,4 +1,4 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
@@ -7,6 +7,7 @@ package net.sourceforge.pmd.lang.vf;
import net.sourceforge.pmd.lang.AbstractPmdLanguageVersionHandler;
import net.sourceforge.pmd.lang.Parser;
import net.sourceforge.pmd.lang.ParserOptions;
+import net.sourceforge.pmd.lang.vf.ast.VfParser;
public class VfHandler extends AbstractPmdLanguageVersionHandler {
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfLanguageModule.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfLanguageModule.java
index 6e782b7308..301674bcc0 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfLanguageModule.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfLanguageModule.java
@@ -1,4 +1,4 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfTokenManager.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfTokenManager.java
deleted file mode 100644
index 62e83beff1..0000000000
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfTokenManager.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/**
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-package net.sourceforge.pmd.lang.vf;
-
-import java.io.Reader;
-
-import net.sourceforge.pmd.annotation.InternalApi;
-import net.sourceforge.pmd.lang.LanguageVersionHandler;
-import net.sourceforge.pmd.lang.Parser;
-import net.sourceforge.pmd.lang.ParserOptions;
-import net.sourceforge.pmd.lang.TokenManager;
-import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
-import net.sourceforge.pmd.lang.vf.ast.VfParserTokenManager;
-
-/**
- * VF Token Manager implementation.
- *
- * @deprecated This is internal API, use {@link Parser#getTokenManager(String, Reader)} via
- * {@link LanguageVersionHandler#getParser(ParserOptions)}.
- */
-@Deprecated
-@InternalApi
-public class VfTokenManager implements TokenManager {
- private final VfParserTokenManager tokenManager;
-
- public VfTokenManager(Reader source) {
- tokenManager = new VfParserTokenManager(CharStreamFactory.javaCharStream(source));
- }
-
- @Override
- public Object getNextToken() {
- return tokenManager.getNextToken();
- }
-
- @Override
- public void setFileName(String fileName) {
- VfParserTokenManager.setFileName(fileName);
- }
-}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTArguments.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTArguments.java
index c37a7d28ff..6c95e97ef6 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTArguments.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTArguments.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTArguments extends AbstractVfNode {
-public class ASTArguments extends AbstractVFNode {
- @Deprecated
- @InternalApi
- public ASTArguments(int id) {
+ ASTArguments(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTArguments(VfParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(VfParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTAttribute.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTAttribute.java
index 1d210964a9..296a6f189c 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTAttribute.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTAttribute.java
@@ -4,31 +4,20 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTAttribute extends AbstractVFNode {
+public final class ASTAttribute extends AbstractVfNode {
private String name;
- @Deprecated
- @InternalApi
- public ASTAttribute(int id) {
+ ASTAttribute(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTAttribute(VfParser p, int id) {
- super(p, id);
- }
public String getName() {
return name;
}
- @Deprecated
- @InternalApi
- public void setName(String name) {
+ void setName(String name) {
this.name = name;
}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTAttributeValue.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTAttributeValue.java
index f663c51a55..937fd5f376 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTAttributeValue.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTAttributeValue.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTAttributeValue extends AbstractVfNode {
-public class ASTAttributeValue extends AbstractVFNode {
- @Deprecated
- @InternalApi
- public ASTAttributeValue(int id) {
+ ASTAttributeValue(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTAttributeValue(VfParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(VfParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTCData.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTCData.java
index 45d11065d1..26adfa0a29 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTCData.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTCData.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTCData extends AbstractVfNode {
-public class ASTCData extends AbstractVFNode {
- @Deprecated
- @InternalApi
- public ASTCData(int id) {
+ ASTCData(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTCData(VfParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(VfParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTCompilationUnit.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTCompilationUnit.java
index 65827db0a5..33e14f1fe3 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTCompilationUnit.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTCompilationUnit.java
@@ -4,20 +4,12 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.ast.RootNode;
-public class ASTCompilationUnit extends AbstractVFNode implements RootNode {
- @Deprecated
- @InternalApi
- public ASTCompilationUnit(int id) {
- super(id);
- }
+public final class ASTCompilationUnit extends AbstractVfNode implements RootNode {
- @Deprecated
- @InternalApi
- public ASTCompilationUnit(VfParser p, int id) {
- super(p, id);
+ ASTCompilationUnit(int id) {
+ super(id);
}
@Override
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTContent.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTContent.java
index 406d44b5f1..86c81318a3 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTContent.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTContent.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTContent extends AbstractVfNode {
-public class ASTContent extends AbstractVFNode {
- @Deprecated
- @InternalApi
- public ASTContent(int id) {
+ ASTContent(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTContent(VfParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(VfParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDeclaration.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDeclaration.java
index c9c7378442..c58fe458da 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDeclaration.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDeclaration.java
@@ -4,31 +4,19 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTDeclaration extends AbstractVFNode {
+public final class ASTDeclaration extends AbstractVfNode {
private String name;
- @Deprecated
- @InternalApi
- public ASTDeclaration(int id) {
+ ASTDeclaration(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTDeclaration(VfParser p, int id) {
- super(p, id);
- }
-
public String getName() {
return name;
}
- @Deprecated
- @InternalApi
- public void setName(String name) {
+ void setName(String name) {
this.name = name;
}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDoctypeDeclaration.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDoctypeDeclaration.java
index 2148f10e32..6ddb097ac8 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDoctypeDeclaration.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDoctypeDeclaration.java
@@ -4,34 +4,22 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTDoctypeDeclaration extends AbstractVFNode {
+public final class ASTDoctypeDeclaration extends AbstractVfNode {
/**
* Name of the document type. Cannot be null.
*/
private String name;
- @Deprecated
- @InternalApi
- public ASTDoctypeDeclaration(int id) {
+ ASTDoctypeDeclaration(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTDoctypeDeclaration(VfParser p, int id) {
- super(p, id);
- }
-
public String getName() {
return name;
}
- @Deprecated
- @InternalApi
- public void setName(String name) {
+ void setName(String name) {
this.name = name;
}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDoctypeExternalId.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDoctypeExternalId.java
index abba54a49b..6a969700dd 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDoctypeExternalId.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDoctypeExternalId.java
@@ -4,9 +4,7 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTDoctypeExternalId extends AbstractVFNode {
+public final class ASTDoctypeExternalId extends AbstractVfNode {
/**
* URI of the external entity. Cannot be null.
@@ -18,18 +16,10 @@ public class ASTDoctypeExternalId extends AbstractVFNode {
*/
private String publicId;
- @Deprecated
- @InternalApi
- public ASTDoctypeExternalId(int id) {
+ ASTDoctypeExternalId(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTDoctypeExternalId(VfParser p, int id) {
- super(p, id);
- }
-
public boolean isHasPublicId() {
return null != publicId;
}
@@ -38,9 +28,7 @@ public class ASTDoctypeExternalId extends AbstractVFNode {
return uri;
}
- @Deprecated
- @InternalApi
- public void setUri(String uri) {
+ void setUri(String uri) {
this.uri = uri;
}
@@ -52,9 +40,7 @@ public class ASTDoctypeExternalId extends AbstractVFNode {
return null == publicId ? "" : publicId;
}
- @Deprecated
- @InternalApi
- public void setPublicId(String publicId) {
+ void setPublicId(String publicId) {
this.publicId = publicId;
}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDotExpression.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDotExpression.java
index 6841840482..b820202cdc 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDotExpression.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTDotExpression.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTDotExpression extends AbstractVfNode {
-public class ASTDotExpression extends AbstractVFNode {
- @Deprecated
- @InternalApi
- public ASTDotExpression(int id) {
+ ASTDotExpression(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTDotExpression(VfParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(VfParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTElExpression.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTElExpression.java
index 18f1bd1536..b59a7ff899 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTElExpression.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTElExpression.java
@@ -4,21 +4,11 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTElExpression extends AbstractVFNode {
- @Deprecated
- @InternalApi
- public ASTElExpression(int id) {
+public final class ASTElExpression extends AbstractVfNode {
+ ASTElExpression(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTElExpression(VfParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(VfParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTElement.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTElement.java
index a180e6ecd4..ecdbcc4dcb 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTElement.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTElement.java
@@ -4,9 +4,7 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTElement extends AbstractVFNode {
+public final class ASTElement extends AbstractVfNode {
/**
* Name of the element-tag. Cannot be null.
@@ -24,18 +22,10 @@ public class ASTElement extends AbstractVFNode {
*/
private boolean unclosed;
- @Deprecated
- @InternalApi
- public ASTElement(int id) {
+ ASTElement(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTElement(VfParser p, int id) {
- super(p, id);
- }
-
/**
* @return boolean - true if the element has a namespace-prefix, false
* otherwise
@@ -67,9 +57,7 @@ public class ASTElement extends AbstractVFNode {
return name;
}
- @Deprecated
- @InternalApi
- public void setName(String name) {
+ void setName(String name) {
this.name = name;
}
@@ -81,15 +69,11 @@ public class ASTElement extends AbstractVFNode {
return unclosed;
}
- @Deprecated
- @InternalApi
- public void setUnclosed(boolean unclosed) {
+ void setUnclosed(boolean unclosed) {
this.unclosed = unclosed;
}
- @Deprecated
- @InternalApi
- public void setEmpty(boolean empty) {
+ void setEmpty(boolean empty) {
this.empty = empty;
}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTExpression.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTExpression.java
index a84eb74fb0..403a3aac40 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTExpression.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTExpression.java
@@ -4,21 +4,11 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTExpression extends AbstractVFNode {
- @Deprecated
- @InternalApi
- public ASTExpression(int id) {
+public final class ASTExpression extends AbstractVfNode {
+ ASTExpression(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTExpression(VfParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(VfParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTHtmlScript.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTHtmlScript.java
index cfeed966d9..557177c818 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTHtmlScript.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTHtmlScript.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTHtmlScript extends AbstractVfNode {
-public class ASTHtmlScript extends AbstractVFNode {
- @Deprecated
- @InternalApi
- public ASTHtmlScript(int id) {
+ ASTHtmlScript(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTHtmlScript(VfParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(VfParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTIdentifier.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTIdentifier.java
index fa7d70601c..fa8d7f6ce6 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTIdentifier.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTIdentifier.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTIdentifier extends AbstractVfNode {
-public class ASTIdentifier extends AbstractVFNode {
- @Deprecated
- @InternalApi
- public ASTIdentifier(int id) {
+ ASTIdentifier(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTIdentifier(VfParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(VfParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTLiteral.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTLiteral.java
index 74450f65b8..12d54867ec 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTLiteral.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTLiteral.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTLiteral extends AbstractVfNode {
-public class ASTLiteral extends AbstractVFNode {
- @Deprecated
- @InternalApi
- public ASTLiteral(int id) {
+ ASTLiteral(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTLiteral(VfParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(VfParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTNegationExpression.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTNegationExpression.java
index 00763e018e..af6d093db0 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTNegationExpression.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTNegationExpression.java
@@ -4,21 +4,11 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
-
-public class ASTNegationExpression extends AbstractVFNode {
- @Deprecated
- @InternalApi
- public ASTNegationExpression(int id) {
+public final class ASTNegationExpression extends AbstractVfNode {
+ ASTNegationExpression(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTNegationExpression(VfParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(VfParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTText.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTText.java
index 8ef2e42579..a7420747e0 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTText.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/ASTText.java
@@ -4,21 +4,12 @@
package net.sourceforge.pmd.lang.vf.ast;
-import net.sourceforge.pmd.annotation.InternalApi;
+public final class ASTText extends AbstractVfNode {
-public class ASTText extends AbstractVFNode {
- @Deprecated
- @InternalApi
- public ASTText(int id) {
+ ASTText(int id) {
super(id);
}
- @Deprecated
- @InternalApi
- public ASTText(VfParser p, int id) {
- super(p, id);
- }
-
@Override
public Object jjtAccept(VfParserVisitor visitor, Object data) {
return visitor.visit(this, data);
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/AbstractVFNode.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/AbstractVFNode.java
deleted file mode 100644
index 88b234fb33..0000000000
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/AbstractVFNode.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-package net.sourceforge.pmd.lang.vf.ast;
-
-import net.sourceforge.pmd.annotation.InternalApi;
-import net.sourceforge.pmd.lang.ast.Node;
-import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractJjtreeNode;
-
-@Deprecated
-@InternalApi
-public class AbstractVFNode extends AbstractJjtreeNode implements VfNode {
-
- protected VfParser parser;
-
- public AbstractVFNode(int id) {
- super(id);
- }
-
- public AbstractVFNode(VfParser parser, int id) {
- super(id);
- this.parser = parser;
- }
-
- @Override
- public void jjtOpen() {
- if (beginLine == -1 && parser.token.next != null) {
- beginLine = parser.token.next.beginLine;
- beginColumn = parser.token.next.beginColumn;
- }
- }
-
- @Override
- public void jjtClose() {
- if (beginLine == -1 && children.length == 0) {
- beginColumn = parser.token.beginColumn;
- }
- if (beginLine == -1) {
- beginLine = parser.token.beginLine;
- }
- endLine = parser.token.endLine;
- endColumn = parser.token.endColumn;
- }
-
- /**
- * Accept the visitor. *
- */
- @Override
- public Object jjtAccept(VfParserVisitor visitor, Object data) {
- return visitor.visit(this, data);
- }
-
- /**
- * Accept the visitor. *
- */
- @Override
- public Object childrenAccept(VfParserVisitor visitor, Object data) {
- if (children != null) {
- for (Node child : children) {
- ((VfNode) child).jjtAccept(visitor, data);
- }
- }
- return data;
- }
-
-
-
-
- @Override
- public String getXPathNodeName() {
- return VfParserTreeConstants.jjtNodeName[id];
- }
-}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/AbstractVfNode.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/AbstractVfNode.java
new file mode 100644
index 0000000000..e50bf2c10b
--- /dev/null
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/AbstractVfNode.java
@@ -0,0 +1,19 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+package net.sourceforge.pmd.lang.vf.ast;
+
+import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractJjtreeNode;
+
+abstract class AbstractVfNode extends AbstractJjtreeNode implements VfNode {
+
+ protected AbstractVfNode(int id) {
+ super(id);
+ }
+
+ @Override
+ public String getXPathNodeName() {
+ return VfParserImplTreeConstants.jjtNodeName[id];
+ }
+}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/OpenTagRegister.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/OpenTagRegister.java
index c235d70ac2..910c21db2a 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/OpenTagRegister.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/OpenTagRegister.java
@@ -1,4 +1,4 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
@@ -20,9 +20,8 @@ import net.sourceforge.pmd.util.StringUtil;
* @author Victor Bucutea
*
*/
-@Deprecated
@InternalApi
-public class OpenTagRegister {
+class OpenTagRegister {
private List tagList = new ArrayList<>();
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/StartAndEndTagMismatchException.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/StartAndEndTagMismatchException.java
deleted file mode 100644
index 78e6609383..0000000000
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/StartAndEndTagMismatchException.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/**
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-package net.sourceforge.pmd.lang.vf.ast;
-
-/**
- * @author Pieter_Van_Raemdonck
- * @since Created on 11-jan-2006
- *
- * @deprecated for removal with PMD 7.0.0. Use {@link ParseException} instead.
- */
-@Deprecated
-public class StartAndEndTagMismatchException extends SyntaxErrorException {
-
- private static final long serialVersionUID = 5434485938487458692L;
-
- public static final String START_END_TAG_MISMATCH_RULE_NAME = "Start and End Tags of an XML Element must match.";
-
- private final int startLine;
- private final int endLine;
- private final int startColumn;
- private final int endColumn;
- private final String startTagName;
- private final String endTagName;
-
- /**
- * Public constructor.
- *
- * @param startLine
- * @param startColumn
- * @param startTagName
- * @param endLine
- * @param endColumn
- * @param endTagName
- */
- public StartAndEndTagMismatchException(int startLine, int startColumn, String startTagName, int endLine,
- int endColumn, String endTagName) {
- super(endLine, START_END_TAG_MISMATCH_RULE_NAME);
- this.startLine = startLine;
- this.startColumn = startColumn;
- this.startTagName = startTagName;
-
- this.endLine = endLine;
- this.endColumn = endColumn;
- this.endTagName = endTagName;
- }
-
- /**
- * @return Returns the endColumn.
- */
- public int getEndColumn() {
- return endColumn;
- }
-
- /**
- * @return Returns the endLine.
- */
- public int getEndLine() {
- return endLine;
- }
-
- /**
- * @return Returns the startColumn.
- */
- public int getStartColumn() {
- return startColumn;
- }
-
- /**
- * @return Returns the startLine.
- */
- public int getStartLine() {
- return startLine;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.lang.Throwable#getMessage()
- */
- @Override
- public String getMessage() {
- return "The start-tag of element \"" + startTagName + "\" (line " + startLine + ", column " + startColumn
- + ") does not correspond to the end-tag found: \"" + endTagName + "\" (line " + endLine + ", column "
- + endColumn + ").";
- }
-}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/SyntaxErrorException.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/SyntaxErrorException.java
deleted file mode 100644
index 1a0a41e3db..0000000000
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/SyntaxErrorException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/**
- * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
- */
-
-package net.sourceforge.pmd.lang.vf.ast;
-
-/**
- * Exception indicating that a syntactic error has been found.
- *
- * @author Pieter_Van_Raemdonck
- * @since Created on 11-jan-2006
- *
- * @deprecated for removal with PMD 7.0.0. Use {@link ParseException} instead.
- */
-@Deprecated
-public abstract class SyntaxErrorException extends ParseException {
- private static final long serialVersionUID = -6702683724078264059L;
-
- private final int line;
- private final String ruleName;
-
- /**
- * @param line
- * @param ruleName
- */
- public SyntaxErrorException(int line, String ruleName) {
- super();
- this.line = line;
- this.ruleName = ruleName;
- }
-
- /**
- * @return Returns the line.
- */
- public int getLine() {
- return line;
- }
-
- /**
- * @return Returns the ruleName.
- */
- public String getRuleName() {
- return ruleName;
- }
-}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfNode.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfNode.java
index dfb2df4422..b6ca6ff812 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfNode.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfNode.java
@@ -1,4 +1,4 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
@@ -10,21 +10,11 @@ import net.sourceforge.pmd.lang.ast.NodeStream;
public interface VfNode extends Node {
/**
- * Accept the visitor. *
+ * Accept the visitor.
*/
Object jjtAccept(VfParserVisitor visitor, Object data);
- /**
- * Accept the visitor. *
- *
- * @deprecated This method is not useful, the logic for combining
- * children values should be present on the visitor, not the node
- */
- @Deprecated
- Object childrenAccept(VfParserVisitor visitor, Object data);
-
-
@Override
VfNode getParent();
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfParser.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfParser.java
similarity index 87%
rename from pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfParser.java
rename to pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfParser.java
index 01fb37f547..4d91f1518d 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/VfParser.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfParser.java
@@ -1,8 +1,8 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
-package net.sourceforge.pmd.lang.vf;
+package net.sourceforge.pmd.lang.vf.ast;
import java.io.Reader;
@@ -37,7 +37,7 @@ public class VfParser extends AbstractParser {
@Override
public Node parse(String fileName, Reader source) throws ParseException {
AbstractTokenManager.setFileName(fileName);
- return new net.sourceforge.pmd.lang.vf.ast.VfParser(CharStreamFactory.simpleCharStream(source)).CompilationUnit();
+ return new VfParserImpl(CharStreamFactory.simpleCharStream(source)).CompilationUnit();
}
}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfParserVisitorAdapter.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfParserVisitorAdapter.java
index 693bda0b51..8cdf95c9eb 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfParserVisitorAdapter.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfParserVisitorAdapter.java
@@ -1,4 +1,4 @@
-/**
+/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
@@ -6,100 +6,4 @@ package net.sourceforge.pmd.lang.vf.ast;
public class VfParserVisitorAdapter implements VfParserVisitor {
- @Override
- public Object visit(VfNode node, Object data) {
- node.childrenAccept(this, data);
- return data;
- }
-
- @Override
- public Object visit(ASTCompilationUnit node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTText node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTElExpression node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTCData node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTElement node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTAttribute node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTAttributeValue node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTDeclaration node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTDoctypeDeclaration node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTDoctypeExternalId node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTHtmlScript node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTLiteral node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTIdentifier node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTExpression node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTArguments node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTDotExpression node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTContent node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTNegationExpression node, Object data) {
- return visit((VfNode) node, data);
- }
-
}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfTokenManager.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfTokenManager.java
new file mode 100644
index 0000000000..9cce89b6d6
--- /dev/null
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/ast/VfTokenManager.java
@@ -0,0 +1,33 @@
+/*
+ * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
+ */
+
+package net.sourceforge.pmd.lang.vf.ast;
+
+import java.io.Reader;
+
+import net.sourceforge.pmd.annotation.InternalApi;
+import net.sourceforge.pmd.lang.TokenManager;
+import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory;
+
+/**
+ * VF Token Manager implementation.
+ */
+@InternalApi
+public class VfTokenManager implements TokenManager {
+ private final VfParserImplTokenManager tokenManager;
+
+ public VfTokenManager(Reader source) {
+ tokenManager = new VfParserImplTokenManager(CharStreamFactory.javaCharStream(source));
+ }
+
+ @Override
+ public Object getNextToken() {
+ return tokenManager.getNextToken();
+ }
+
+ @Override
+ public void setFileName(String fileName) {
+ VfParserImplTokenManager.setFileName(fileName);
+ }
+}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/rule/AbstractVfRule.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/rule/AbstractVfRule.java
index 2329824e18..48871f3df9 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/rule/AbstractVfRule.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/rule/AbstractVfRule.java
@@ -12,24 +12,7 @@ import net.sourceforge.pmd.lang.ast.Node;
import net.sourceforge.pmd.lang.rule.AbstractRule;
import net.sourceforge.pmd.lang.rule.ImmutableLanguage;
import net.sourceforge.pmd.lang.vf.VfLanguageModule;
-import net.sourceforge.pmd.lang.vf.ast.ASTArguments;
-import net.sourceforge.pmd.lang.vf.ast.ASTAttribute;
-import net.sourceforge.pmd.lang.vf.ast.ASTAttributeValue;
-import net.sourceforge.pmd.lang.vf.ast.ASTCData;
import net.sourceforge.pmd.lang.vf.ast.ASTCompilationUnit;
-import net.sourceforge.pmd.lang.vf.ast.ASTContent;
-import net.sourceforge.pmd.lang.vf.ast.ASTDeclaration;
-import net.sourceforge.pmd.lang.vf.ast.ASTDoctypeDeclaration;
-import net.sourceforge.pmd.lang.vf.ast.ASTDoctypeExternalId;
-import net.sourceforge.pmd.lang.vf.ast.ASTDotExpression;
-import net.sourceforge.pmd.lang.vf.ast.ASTElExpression;
-import net.sourceforge.pmd.lang.vf.ast.ASTElement;
-import net.sourceforge.pmd.lang.vf.ast.ASTExpression;
-import net.sourceforge.pmd.lang.vf.ast.ASTHtmlScript;
-import net.sourceforge.pmd.lang.vf.ast.ASTIdentifier;
-import net.sourceforge.pmd.lang.vf.ast.ASTLiteral;
-import net.sourceforge.pmd.lang.vf.ast.ASTNegationExpression;
-import net.sourceforge.pmd.lang.vf.ast.ASTText;
import net.sourceforge.pmd.lang.vf.ast.VfNode;
import net.sourceforge.pmd.lang.vf.ast.VfParserVisitor;
@@ -56,100 +39,4 @@ public abstract class AbstractVfRule extends AbstractRule implements VfParserVis
}
}
- @Override
- public Object visit(VfNode node, Object data) {
- node.childrenAccept(this, data);
- return null;
- }
-
- @Override
- public Object visit(ASTCompilationUnit node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTText node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTAttributeValue node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTElExpression node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTCData node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTElement node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTAttribute node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTDeclaration node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTDoctypeDeclaration node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTDoctypeExternalId node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTHtmlScript node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTLiteral node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTIdentifier node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTExpression node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTArguments node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTDotExpression node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTContent node, Object data) {
- return visit((VfNode) node, data);
- }
-
- @Override
- public Object visit(ASTNegationExpression node, Object data) {
- return visit((VfNode) node, data);
- }
-
}
diff --git a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/rule/security/VfUnescapeElRule.java b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/rule/security/VfUnescapeElRule.java
index 948f4264aa..c83d2d242d 100644
--- a/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/rule/security/VfUnescapeElRule.java
+++ b/pmd-visualforce/src/main/java/net/sourceforge/pmd/lang/vf/rule/security/VfUnescapeElRule.java
@@ -24,7 +24,7 @@ import net.sourceforge.pmd.lang.vf.ast.ASTIdentifier;
import net.sourceforge.pmd.lang.vf.ast.ASTLiteral;
import net.sourceforge.pmd.lang.vf.ast.ASTNegationExpression;
import net.sourceforge.pmd.lang.vf.ast.ASTText;
-import net.sourceforge.pmd.lang.vf.ast.AbstractVFNode;
+import net.sourceforge.pmd.lang.vf.ast.VfNode;
import net.sourceforge.pmd.lang.vf.rule.AbstractVfRule;
/**
@@ -441,14 +441,14 @@ public class VfUnescapeElRule extends AbstractVfRule {
return !nonEscapedIds.isEmpty();
}
- private boolean containsSafeFields(final AbstractVFNode expression) {
+ private boolean containsSafeFields(final VfNode expression) {
final ASTExpression ex = expression.getFirstChildOfType(ASTExpression.class);
return ex != null && innerContainsSafeFields(ex);
}
- private boolean innerContainsSafeFields(final AbstractVFNode expression) {
+ private boolean innerContainsSafeFields(final VfNode expression) {
for (int i = 0; i < expression.getNumChildren(); i++) {
Node child = expression.getChild(i);