diff --git a/docs/pages/pmd/projectdocs/trivia/news.md b/docs/pages/pmd/projectdocs/trivia/news.md index e06151b013..2729f89bcb 100644 --- a/docs/pages/pmd/projectdocs/trivia/news.md +++ b/docs/pages/pmd/projectdocs/trivia/news.md @@ -9,7 +9,9 @@ author: Tom Copeland ### Salesforce / Apex Language Module -* July 2019 - [Apex PMD | Static code analysis - Apex Hours](https://youtu.be/34PxAHtAavU) +* March 2020 - [Helping Salesforce developers create readable and maintainable Apex code](https://gearset.com/blog/helping-sf-developers-create-readable-and-maintainable-apex-code) + +* July 2019 - [Apex PMD | Static code analysis - Apex Hours](https://youtu.be/34PxAHtAavU) * June 2019 - [Pluralsight](https://www.pluralsight.com/authors/don-robins) Course about leveraging PMD usage for Salesforce by [Robert Sösemann](https://github.com/rsoesemann) (Apex Language Module Contributor) [Play by Play: Automated Code Analysis in Salesforce - a Tools Deep-Dive](https://www.pluralsight.com/courses/play-by-play-automated-code-analysis-in-salesforce) diff --git a/docs/pages/pmd/userdocs/tools/ant.md b/docs/pages/pmd/userdocs/tools/ant.md index 55a45fc12c..b34820e1f0 100644 --- a/docs/pages/pmd/userdocs/tools/ant.md +++ b/docs/pages/pmd/userdocs/tools/ant.md @@ -57,7 +57,7 @@ The examples below won't repeat this taskdef element, as this is always required rulesetfiles - A comma delimited list of ruleset files ('rulesets/java/basic.xml,rulesets/java/design.xml'). + A comma delimited list of ruleset files ('rulesets/java/quickstart.xml,config/my-ruleset.xml'). If you write your own ruleset files, you can put them on the classpath and plug them in here. Yes, unless the ruleset nested element is used @@ -153,9 +153,10 @@ configure multiple formatters.
encoding
Specifies the encoding to be used in the generated report (only honored when used with `toFile`). When rendering `toConsole` PMD will automatically detect the terminal's encoding and use it, unless the output is being redirected / piped, in which case `file.encoding` is used. See example below.
linkPrefix
-
Used for linking to online HTMLized source (like this). See example below. Note, this only works with [maven-jxr-plugin](https://maven.apache.org/jxr/maven-jxr-plugin/index.html).
+
Used for linking to online HTMLized source (like this). See example below. Note, this only works with + maven-jxr-plugin.
linePrefix
-
Used for linking to online HTMLized source (like this). See example below. Note, this only works with [maven-jxr-plugin](https://maven.apache.org/jxr/maven-jxr-plugin/index.html).
+
Used for linking to online HTMLized source (like this). See example below. Note, this only works with maven-jxr-plugin.
@@ -179,8 +180,8 @@ automatically and the latest language version is used. - rulesets/java/design.xml - java-basic + rulesets/java/quickstart.xml + config/my-ruleset.xml @@ -261,7 +262,7 @@ Then, after the end of the PMD task, do this: Running one ruleset to produce a HTML report (and printing the report to the console as well) using a file cache - + @@ -274,7 +275,7 @@ Running one ruleset to produce a HTML report (and printing the report to the con Running multiple rulesets to produce an XML report with the same analysis cache - + @@ -297,7 +298,7 @@ need to be configured when defining the task: - + @@ -370,11 +371,13 @@ You can run pmd then with `ant pmd`. pmd: [pmd] Using the normal ClassLoader - [pmd] Using these rulesets: rulesets/java/imports.xml - [pmd] Using rule DontImportJavaLang - [pmd] Using rule UnusedImports - [pmd] Using rule ImportFromSamePackage - [pmd] Using rule DuplicateImports + [pmd] Using these rulesets: rulesets/java/quickstart.xml + [pmd] Using rule AvoidMessageDigestField + [pmd] Using rule AvoidStringBufferField + [pmd] Using rule AvoidUsingHardCodedIP + [pmd] Using rule CheckResultSet + [pmd] Using rule ConstantsInInterface + ... [pmd] Processing file /usr/local/java/src/java/lang/ref/Finalizer.java [pmd] Processing file /usr/local/java/src/java/lang/ref/FinalReference.java [pmd] Processing file /usr/local/java/src/java/lang/ref/PhantomReference.java @@ -394,7 +397,7 @@ An HTML report with the "linkPrefix" and "linePrefix" properties: - + diff --git a/docs/pages/pmd/userdocs/tools/maven.md b/docs/pages/pmd/userdocs/tools/maven.md index 2d07e1a07c..d6c6cb4e78 100644 --- a/docs/pages/pmd/userdocs/tools/maven.md +++ b/docs/pages/pmd/userdocs/tools/maven.md @@ -94,9 +94,8 @@ To specify a ruleset, simply edit the previous configuration: maven-pmd-plugin - /rulesets/java/braces.xml - /rulesets/java/naming.xml - d:\rulesets\strings.xml + /rulesets/java/quickstart.xml + d:\rulesets\my-ruleset.xml http://localhost/design.xml diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 32ce1c4c9f..a51d4ed31e 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -96,6 +96,13 @@ should give more accurate results and especially fixes the problems with the usi * [#2255](https://github.com/pmd/pmd/issues/2255): \[java] InvalidLogMessageFormat false-positive for a lambda argument * java-performance * [#2275](https://github.com/pmd/pmd/issues/2275): \[java] AppendCharacterWithChar flags literals in an expression +* plsql + * [#2325](https://github.com/pmd/pmd/issues/2325): \[plsql] NullPointerException while running parsing test for CREATE TRIGGER + * [#2327](https://github.com/pmd/pmd/pull/2327): \[plsql] Parsing of WHERE CURRENT OF + * [#2328](https://github.com/pmd/pmd/issues/2328): \[plsql] Support XMLROOT + * [#2331](https://github.com/pmd/pmd/pull/2331): \[plsql] Fix in Comment statement + * [#2332](https://github.com/pmd/pmd/pull/2332): \[plsql] Fixed Execute Immediate statement parsing + * [#2340](https://github.com/pmd/pmd/pull/2340): \[plsql] Fixed parsing / as divide or execute ### API Changes @@ -173,6 +180,59 @@ methods on {% jdoc apex::lang.apex.ast.ApexParserVisitor %} and its implementati * pmd-apex * {% jdoc apex::lang.apex.metrics.ApexMetrics %}, {% jdoc apex::lang.apex.metrics.ApexMetricsComputer %} +##### In ASTs (JSP) + +As part of the changes we'd like to do to AST classes for 7.0.0, we would like to +hide some methods and constructors that rule writers should not have access to. +The following usages are now deprecated **in the JSP AST** (with other languages to come): + +* Manual instantiation of nodes. **Constructors of node classes are deprecated** and + marked {% jdoc core::annotation.InternalApi %}. Nodes should only be obtained from the parser, + which for rules, means that they never need to instantiate node themselves. + Those constructors will be made package private with 7.0.0. +* **Subclassing of abstract node classes, or usage of their type**. The base classes are internal API + and will be hidden in version 7.0.0. You should not couple your code to them. + * In the meantime you should use interfaces like {% jdoc jsp::lang.jsp.ast.JspNode %} or + {% jdoc core::lang.ast.Node %}, or the other published interfaces in this package, + to refer to nodes generically. + * Concrete node classes will **be made final** with 7.0.0. +* Setters found in any node class or interface. **Rules should consider the AST immutable**. + We will make those setters package private with 7.0.0. +* The class {% jdoc jsp::lang.jsp.JspParser %} is deprecated and should not be used directly. + Use {% jdoc !!core::lang.LanguageVersionHandler#getParser(ParserOptions) %} instead. + +Please look at {% jdoc_package jsp::lang.jsp.ast %} to find out the full list of deprecations. + +##### In ASTs (Velocity) + +As part of the changes we'd like to do to AST classes for 7.0.0, we would like to +hide some methods and constructors that rule writers should not have access to. +The following usages are now deprecated **in the VM AST** (with other languages to come): + +* Manual instantiation of nodes. **Constructors of node classes are deprecated** and + marked {% jdoc core::annotation.InternalApi %}. Nodes should only be obtained from the parser, + which for rules, means that they never need to instantiate node themselves. + Those constructors will be made package private with 7.0.0. +* **Subclassing of abstract node classes, or usage of their type**. The base classes are internal API + and will be hidden in version 7.0.0. You should not couple your code to them. + * In the meantime you should use interfaces like {% jdoc vm::lang.vm.ast.VmNode %} or + {% jdoc core::lang.ast.Node %}, or the other published interfaces in this package, + to refer to nodes generically. + * Concrete node classes will **be made final** with 7.0.0. +* Setters found in any node class or interface. **Rules should consider the AST immutable**. + We will make those setters package private with 7.0.0. +* The package {% jdoc_package vm::lang.vm.directive %} as well as the classes + {% jdoc vm::lang.vm.util.DirectiveMapper %} and {% jdoc vm::lang.vm.util.LogUtil %} are deprecated + for removal. They were only used internally during parsing. +* The class {% jdoc vm::lang.vm.VmParser %} is deprecated and should not be used directly. + Use {% jdoc !!core::lang.LanguageVersionHandler#getParser(ParserOptions) %} instead. + +Please look at {% jdoc_package vm::lang.vm.ast %} to find out the full list of deprecations. + +#### PLSQL AST + +The production and node `ASTCursorBody` was unnecessary, not used and has been removed. Cursors have been already +parsed as `ASTCursorSpecification`. ### External Contributions @@ -186,6 +246,16 @@ methods on {% jdoc apex::lang.apex.ast.ApexParserVisitor %} and its implementati * [#2297](https://github.com/pmd/pmd/pull/2297): \[apex] Cognitive complexity metrics - [Gwilym Kuiper](https://github.com/gwilymatgearset) * [#2317](https://github.com/pmd/pmd/pull/2317): \[apex] New Rule - Test Methods Must Be In Test Classes - [Brian Nørremark](https://github.com/noerremark) * [#2321](https://github.com/pmd/pmd/pull/2321): \[apex] Support switch statements correctly in Cognitive Complexity - [Gwilym Kuiper](https://github.com/gwilymatgearset) +* [#2326](https://github.com/pmd/pmd/pull/2326): \[plsql] Added XML functions to parser: extract(xml), xml_root and fixed xml_forest - [Piotr Szymanski](https://github.com/szyman23) +* [#2327](https://github.com/pmd/pmd/pull/2327): \[plsql] Parsing of WHERE CURRENT OF added - [Piotr Szymanski](https://github.com/szyman23) +* [#2331](https://github.com/pmd/pmd/pull/2331): \[plsql] Fix in Comment statement - [Piotr Szymanski](https://github.com/szyman23) +* [#2332](https://github.com/pmd/pmd/pull/2332): \[plsql] Fixed Execute Immediate statement parsing - [Piotr Szymanski](https://github.com/szyman23) +* [#2338](https://github.com/pmd/pmd/pull/2338): \[cs] CPD: fixes in filtering of using directives - [Maikel Steneker](https://github.com/maikelsteneker) +* [#2339](https://github.com/pmd/pmd/pull/2339): \[cs] CPD: Fixed CPD --ignore-usings option - [Maikel Steneker](https://github.com/maikelsteneker) +* [#2340](https://github.com/pmd/pmd/pull/2340): \[plsql] fix for parsing / as divide or execute - [Piotr Szymanski](https://github.com/szyman23) +* [#2342](https://github.com/pmd/pmd/pull/2342): \[xml] Update property used in example - [Piotrek Żygieło](https://github.com/pzygielo) +* [#2344](https://github.com/pmd/pmd/pull/2344): \[doc] Update ruleset examples for ant - [Piotrek Żygieło](https://github.com/pzygielo) +* [#2343](https://github.com/pmd/pmd/pull/2343): \[ci] Disable checking for snapshots in jcenter - [Piotrek Żygieło](https://github.com/pzygielo) {% endtocmaker %} diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/token/internal/BaseTokenFilter.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/token/internal/BaseTokenFilter.java index 7b7f11ca17..4baca41d37 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/token/internal/BaseTokenFilter.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/token/internal/BaseTokenFilter.java @@ -41,9 +41,9 @@ public abstract class BaseTokenFilter implements TokenFi currentToken = null; if (!unprocessedTokens.isEmpty()) { currentToken = unprocessedTokens.poll(); - return currentToken; + } else { + currentToken = (T) tokenManager.getNextToken(); } - currentToken = (T) tokenManager.getNextToken(); while (!shouldStopProcessing(currentToken)) { analyzeToken(currentToken); analyzeTokens(currentToken, remainingTokens); @@ -53,7 +53,11 @@ public abstract class BaseTokenFilter implements TokenFi return currentToken; } - currentToken = (T) tokenManager.getNextToken(); + if (!unprocessedTokens.isEmpty()) { + currentToken = unprocessedTokens.poll(); + } else { + currentToken = (T) tokenManager.getNextToken(); + } } return null; diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/lang/AbstractLanguageVersionHandler.java b/pmd-core/src/main/java/net/sourceforge/pmd/lang/AbstractLanguageVersionHandler.java index 6b7f306253..9f7da9f54f 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/lang/AbstractLanguageVersionHandler.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/lang/AbstractLanguageVersionHandler.java @@ -1,4 +1,4 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ diff --git a/pmd-cs/src/main/java/net/sourceforge/pmd/cpd/CsTokenizer.java b/pmd-cs/src/main/java/net/sourceforge/pmd/cpd/CsTokenizer.java index 9978cb4d93..c1f797f1c6 100644 --- a/pmd-cs/src/main/java/net/sourceforge/pmd/cpd/CsTokenizer.java +++ b/pmd-cs/src/main/java/net/sourceforge/pmd/cpd/CsTokenizer.java @@ -59,6 +59,7 @@ public class CsTokenizer extends AntlrTokenizer { private final boolean ignoreUsings; private boolean discardingUsings = false; private boolean discardingNL = false; + private boolean discardCurrent = false; CsTokenFilter(final AntlrTokenManager tokenManager, boolean ignoreUsings) { super(tokenManager); @@ -72,15 +73,19 @@ public class CsTokenizer extends AntlrTokenizer { @Override protected void analyzeTokens(final AntlrToken currentToken, final Iterable remainingTokens) { + discardCurrent = false; skipUsingDirectives(currentToken, remainingTokens); } private void skipUsingDirectives(final AntlrToken currentToken, final Iterable remainingTokens) { - final int type = currentToken.getType(); - if (type == CSharpLexer.USING && isUsingDirective(remainingTokens)) { - discardingUsings = true; - } else if (type == CSharpLexer.SEMICOLON) { - discardingUsings = false; + if (ignoreUsings) { + final int type = currentToken.getType(); + if (type == CSharpLexer.USING && isUsingDirective(remainingTokens)) { + discardingUsings = true; + } else if (type == CSharpLexer.SEMICOLON && discardingUsings) { + discardingUsings = false; + discardCurrent = true; + } } } @@ -148,7 +153,7 @@ public class CsTokenizer extends AntlrTokenizer { @Override protected boolean isLanguageSpecificDiscarding() { - return discardingUsings || discardingNL; + return discardingUsings || discardingNL || discardCurrent; } } } diff --git a/pmd-cs/src/test/java/net/sourceforge/pmd/cpd/CsTokenizerTest.java b/pmd-cs/src/test/java/net/sourceforge/pmd/cpd/CsTokenizerTest.java index ed87562537..3736bea90d 100644 --- a/pmd-cs/src/test/java/net/sourceforge/pmd/cpd/CsTokenizerTest.java +++ b/pmd-cs/src/test/java/net/sourceforge/pmd/cpd/CsTokenizerTest.java @@ -116,6 +116,14 @@ public class CsTokenizerTest { assertEquals(8, tokens.getTokens().get(14).getBeginLine()); } + @Test + public void testDoNotIgnoreUsingDirectives() { + tokenizer.setIgnoreUsings(false); + tokenizer.tokenize(toSourceCode("using System.Text;\n"), tokens); + assertEquals(6, tokens.size()); + assertEquals("using", tokens.getTokens().get(0).toString()); + } + @Test public void testIgnoreUsingDirectives() { tokenizer.setIgnoreUsings(true); @@ -125,6 +133,17 @@ public class CsTokenizerTest { assertEquals(TokenEntry.EOF, tokens.getTokens().get(0)); } + @Test + public void testStatementsAfterUsingDirectivesAreNotIgnored() { + tokenizer.setIgnoreUsings(true); + tokenizer.tokenize(toSourceCode( + "using System;\n" + + "public class MyClass {\n" + + "}\n"), + tokens); + assertEquals(6, tokens.size()); + } + @Test public void testUsingStatementsAreNotIgnored() { tokenizer.setIgnoreUsings(true); diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTAnyTypeBodyDeclaration.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTAnyTypeBodyDeclaration.java index 74465075ae..e35bfc3ceb 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTAnyTypeBodyDeclaration.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTAnyTypeBodyDeclaration.java @@ -59,6 +59,8 @@ public interface ASTAnyTypeBodyDeclaration extends JavaNode { ANNOTATION, /** No child, {@link #getDeclarationNode()} will return null. */ EMPTY, + /** See {@link ASTRecordDeclaration}. */ + RECORD, /** See {@link ASTRecordConstructorDeclaration}. */ RECORD_CONSTRUCTOR } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTVariableDeclaratorId.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTVariableDeclaratorId.java index 1c6cf51a7f..1a4f1d8b2d 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTVariableDeclaratorId.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTVariableDeclaratorId.java @@ -59,6 +59,9 @@ public class ASTVariableDeclaratorId extends AbstractJavaTypeNode implements Dim } + /** + * Note: this might be null in certain cases. + */ public VariableNameDeclaration getNameDeclaration() { return nameDeclaration; } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AbstractTypeBodyDeclaration.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AbstractTypeBodyDeclaration.java index c9c9984547..546ddee1bd 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AbstractTypeBodyDeclaration.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/AbstractTypeBodyDeclaration.java @@ -14,6 +14,7 @@ import static net.sourceforge.pmd.lang.java.ast.ASTAnyTypeBodyDeclaration.Declar import static net.sourceforge.pmd.lang.java.ast.ASTAnyTypeBodyDeclaration.DeclarationKind.INITIALIZER; import static net.sourceforge.pmd.lang.java.ast.ASTAnyTypeBodyDeclaration.DeclarationKind.INTERFACE; import static net.sourceforge.pmd.lang.java.ast.ASTAnyTypeBodyDeclaration.DeclarationKind.METHOD; +import static net.sourceforge.pmd.lang.java.ast.ASTAnyTypeBodyDeclaration.DeclarationKind.RECORD; import net.sourceforge.pmd.annotation.InternalApi; @@ -72,6 +73,8 @@ abstract class AbstractTypeBodyDeclaration extends AbstractJavaNode implements A return ANNOTATION; } else if (node instanceof ASTEnumDeclaration) { return ENUM; + } else if (node instanceof ASTRecordDeclaration) { + return RECORD; } throw new IllegalStateException("Declaration node types should all be known"); diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractInefficientZeroCheck.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractInefficientZeroCheck.java index 04cf59f456..d513e677b5 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractInefficientZeroCheck.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractInefficientZeroCheck.java @@ -60,6 +60,7 @@ public abstract class AbstractInefficientZeroCheck extends AbstractJavaRule { public Object visit(ASTVariableDeclaratorId node, Object data) { Node nameNode = node.getTypeNameNode(); if (nameNode == null || nameNode instanceof ASTPrimitiveType + || node.getNameDeclaration() == null || !appliesToClassName(node.getNameDeclaration().getTypeImage())) { return data; } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractPoorMethodCall.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractPoorMethodCall.java index 3469190a1a..221dee5080 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractPoorMethodCall.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractPoorMethodCall.java @@ -92,7 +92,7 @@ public abstract class AbstractPoorMethodCall extends AbstractJavaRule { */ @Override public Object visit(ASTVariableDeclaratorId node, Object data) { - if (!targetTypename().equals(node.getNameDeclaration().getTypeImage())) { + if (node.getNameDeclaration() == null || !targetTypename().equals(node.getNameDeclaration().getTypeImage())) { return data; } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/MissingOverrideRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/MissingOverrideRule.java index 9076e635de..d3bc8e39ed 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/MissingOverrideRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/bestpractices/MissingOverrideRule.java @@ -209,7 +209,7 @@ public class MissingOverrideRule extends AbstractJavaRule { @Override public Object visit(ASTMethodDeclaration node, Object data) { - if (currentLookup.peek() == null) { + if (currentLookup.isEmpty() || currentLookup.peek() == null) { return super.visit(node, data); } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/InsufficientStringBufferDeclarationRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/InsufficientStringBufferDeclarationRule.java index e1a4183265..53c1bc4098 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/InsufficientStringBufferDeclarationRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/InsufficientStringBufferDeclarationRule.java @@ -55,7 +55,8 @@ public class InsufficientStringBufferDeclarationRule extends AbstractJavaRule { @Override public Object visit(ASTVariableDeclaratorId node, Object data) { - if (!TypeHelper.isExactlyAny(node.getNameDeclaration(), StringBuffer.class, StringBuilder.class)) { + if (node.getNameDeclaration() == null + || !TypeHelper.isExactlyAny(node.getNameDeclaration(), StringBuffer.class, StringBuilder.class)) { return data; } Node rootNode = node; diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/StringToStringRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/StringToStringRule.java index 95c4e29986..35b3d3a200 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/StringToStringRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/performance/StringToStringRule.java @@ -18,7 +18,8 @@ public class StringToStringRule extends AbstractJavaRule { @Override public Object visit(ASTVariableDeclaratorId node, Object data) { - if (!TypeHelper.isExactlyAny(node.getNameDeclaration(), String.class) + if (node.getNameDeclaration() == null + || !TypeHelper.isExactlyAny(node.getNameDeclaration(), String.class) && !TypeHelper.isExactlyAny(node.getNameDeclaration(), String[].class)) { return data; } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/VariableNameDeclaration.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/VariableNameDeclaration.java index b2a5abdf42..e23a04b7d6 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/VariableNameDeclaration.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/symboltable/VariableNameDeclaration.java @@ -7,6 +7,7 @@ package net.sourceforge.pmd.lang.java.symboltable; import net.sourceforge.pmd.lang.java.ast.ASTFormalParameter; import net.sourceforge.pmd.lang.java.ast.ASTLambdaExpression; import net.sourceforge.pmd.lang.java.ast.ASTPrimitiveType; +import net.sourceforge.pmd.lang.java.ast.ASTRecordComponent; import net.sourceforge.pmd.lang.java.ast.ASTReferenceType; import net.sourceforge.pmd.lang.java.ast.ASTType; import net.sourceforge.pmd.lang.java.ast.ASTVariableDeclaratorId; @@ -91,7 +92,15 @@ public class VariableNameDeclaration extends AbstractNameDeclaration implements && getAccessNodeParent().getFirstChildOfType(ASTType.class).getChild(0) instanceof ASTReferenceType; } + private boolean isRecordComponent() { + return node.getParent() instanceof ASTRecordComponent; + } + public AccessNode getAccessNodeParent() { + if (isRecordComponent()) { + return null; + } + if (node.getParent() instanceof ASTFormalParameter || node.getParent() instanceof ASTLambdaExpression) { return (AccessNode) node.getParent(); } @@ -103,6 +112,9 @@ public class VariableNameDeclaration extends AbstractNameDeclaration implements } private TypeNode getTypeNode() { + if (isRecordComponent()) { + return (TypeNode) node.getParent().getFirstChildOfType(ASTType.class).getChild(0); + } if (isPrimitiveType()) { return (TypeNode) getAccessNodeParent().getFirstChildOfType(ASTType.class).getChild(0); } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java14PreviewTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java14PreviewTest.java index b137fe5c2d..b487c35267 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java14PreviewTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/Java14PreviewTest.java @@ -13,6 +13,7 @@ import org.junit.Test; import net.sourceforge.pmd.lang.ast.ParseException; import net.sourceforge.pmd.lang.java.JavaParsingHelper; +import net.sourceforge.pmd.lang.java.ast.ASTAnyTypeBodyDeclaration.DeclarationKind; /** * Tests new java14 preview features. @@ -83,6 +84,9 @@ public class Java14PreviewTest { Assert.assertEquals("s", variable.getVariableName()); Assert.assertTrue(variable.isPatternBinding()); Assert.assertTrue(variable.isFinal()); + // Note: these variables are not part of the symbol table + // See ScopeAndDeclarationFinder#visit(ASTVariableDeclaratorId, Object) + Assert.assertNull(variable.getNameDeclaration()); } } @@ -102,6 +106,9 @@ public class Java14PreviewTest { Assert.assertEquals(2, components.size()); Assert.assertEquals("x", components.get(0).getVarId().getImage()); Assert.assertEquals("y", components.get(1).getVarId().getImage()); + Assert.assertNull(components.get(0).getVarId().getNameDeclaration().getAccessNodeParent()); + Assert.assertEquals(Integer.TYPE, components.get(0).getVarId().getNameDeclaration().getType()); + Assert.assertEquals("int", components.get(0).getVarId().getNameDeclaration().getTypeImage()); } @Test(expected = ParseException.class) @@ -130,6 +137,10 @@ public class Java14PreviewTest { Assert.assertEquals(2, complex.getDeclarations().size()); Assert.assertTrue(complex.getDeclarations().get(0).getChild(1) instanceof ASTConstructorDeclaration); Assert.assertTrue(complex.getDeclarations().get(1).getChild(0) instanceof ASTRecordDeclaration); + Assert.assertTrue(complex.getParent() instanceof ASTClassOrInterfaceBodyDeclaration); + ASTClassOrInterfaceBodyDeclaration complexParent = complex.getFirstParentOfType(ASTClassOrInterfaceBodyDeclaration.class); + Assert.assertEquals(DeclarationKind.RECORD, complexParent.getKind()); + Assert.assertSame(complex, complexParent.getDeclarationNode()); ASTRecordDeclaration nested = recordDecls.get(1); Assert.assertEquals("Nested", nested.getSimpleName()); diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/MissingOverride.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/MissingOverride.xml index f631a8ad8c..e00c22fdd0 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/MissingOverride.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/MissingOverride.xml @@ -582,5 +582,18 @@ + + EmptyStackException with record top level + 0 + + java 14-preview + diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/InefficientEmptyStringCheck.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/InefficientEmptyStringCheck.xml index b1d99ceef2..6c89aebc8a 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/InefficientEmptyStringCheck.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/InefficientEmptyStringCheck.xml @@ -196,4 +196,22 @@ public class Foo { } ]]> + + + Avoid NPE for pattern matching instanceof + 0 + + java 14-preview + diff --git a/pmd-jsp/src/main/ant/alljavacc.xml b/pmd-jsp/src/main/ant/alljavacc.xml index 066a3c7c03..c7bfd8bd85 100644 --- a/pmd-jsp/src/main/ant/alljavacc.xml +++ b/pmd-jsp/src/main/ant/alljavacc.xml @@ -120,17 +120,17 @@ public class Token implements GenericToken, java.io.Serializable]]> - - + + + - - + + 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/JspParser.java index 976657d90d..8c8a14ec4b 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/JspParser.java @@ -6,7 +6,9 @@ package net.sourceforge.pmd.lang.jsp; import java.io.Reader; +import net.sourceforge.pmd.annotation.InternalApi; import net.sourceforge.pmd.lang.AbstractParser; +import net.sourceforge.pmd.lang.LanguageVersionHandler; import net.sourceforge.pmd.lang.ParserOptions; import net.sourceforge.pmd.lang.TokenManager; import net.sourceforge.pmd.lang.ast.AbstractTokenManager; @@ -16,7 +18,11 @@ import net.sourceforge.pmd.lang.ast.impl.javacc.CharStreamFactory; /** * Adapter for the JspParser. + * + * @deprecated This is internal API, use {@link LanguageVersionHandler#getParser(ParserOptions)}. */ +@InternalApi +@Deprecated public class JspParser extends AbstractParser { public JspParser(ParserOptions parserOptions) { 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 b41bec84d5..deaf9d9aef 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 @@ -1,33 +1,33 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTAttribute.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTAttribute extends AbstractJspNode { private String name; + @InternalApi + @Deprecated public ASTAttribute(int id) { super(id); } + @InternalApi + @Deprecated public ASTAttribute(JspParser p, int id) { super(p, id); } - /** - * @return Returns the name. - */ public String getName() { return name; } - /** - * @param name - * The name to set. - */ + @InternalApi + @Deprecated public void setName(String name) { this.name = name; } @@ -59,9 +59,6 @@ public class ASTAttribute extends AbstractJspNode { return colonIndex >= 0 ? name.substring(colonIndex + 1) : name; } - /** - * Accept the visitor. * - */ @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/ASTAttributeValue.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTAttributeValue.java index 8c56e9bfd5..f84c97b55f 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTAttributeValue.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTAttributeValue extends AbstractJspNode { + @InternalApi + @Deprecated public ASTAttributeValue(int id) { super(id); } + @InternalApi + @Deprecated public ASTAttributeValue(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 00e04452d1..b4aa3c6831 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTCData.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTCData extends AbstractJspNode { + @InternalApi + @Deprecated public ASTCData(int id) { super(id); } + @InternalApi + @Deprecated public ASTCData(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 2dbc4f0f61..0fcc4f175d 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTCommentTag.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTCommentTag extends AbstractJspNode { + @InternalApi + @Deprecated public ASTCommentTag(int id) { super(id); } + @InternalApi + @Deprecated public ASTCommentTag(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 dd4b411f4a..d3232029ab 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 @@ -1,24 +1,25 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTCompilationUnit.java */ 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); } + @InternalApi + @Deprecated public ASTCompilationUnit(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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/ASTContent.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTContent.java index 5a17814f1c..b3c7dbac0d 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTContent.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTContent extends AbstractJspNode { + @InternalApi + @Deprecated public ASTContent(int id) { super(id); } + @InternalApi + @Deprecated public ASTContent(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 534b7e3451..d2c0bc815d 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 @@ -1,40 +1,37 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTDeclaration.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTDeclaration extends AbstractJspNode { private String name; + @InternalApi + @Deprecated public ASTDeclaration(int id) { super(id); } + @InternalApi + @Deprecated public ASTDeclaration(JspParser p, int id) { super(p, id); } - /** - * @return Returns the name. - */ public String getName() { return name; } - /** - * @param name - * The name to set. - */ + @InternalApi + @Deprecated public void setName(String name) { this.name = name; } - /** - * Accept the visitor. * - */ @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/ASTDoctypeDeclaration.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDoctypeDeclaration.java index 169587e625..b8936498db 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 @@ -1,10 +1,11 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTDoctypeDeclaration.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTDoctypeDeclaration extends AbstractJspNode { /** @@ -12,32 +13,28 @@ public class ASTDoctypeDeclaration extends AbstractJspNode { */ private String name; + @InternalApi + @Deprecated public ASTDoctypeDeclaration(int id) { super(id); } + @InternalApi + @Deprecated public ASTDoctypeDeclaration(JspParser p, int id) { super(p, id); } - /** - * @return Returns the name. - */ public String getName() { return name; } - /** - * @param name - * The name to set. - */ + @InternalApi + @Deprecated public void setName(String name) { this.name = name; } - /** - * Accept the visitor. * - */ @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/ASTDoctypeExternalId.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTDoctypeExternalId.java index d92194b209..d78ab5136f 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 @@ -1,10 +1,11 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTDoctypeExternalId.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTDoctypeExternalId extends AbstractJspNode { /** @@ -17,10 +18,14 @@ public class ASTDoctypeExternalId extends AbstractJspNode { */ private String publicId; + @InternalApi + @Deprecated public ASTDoctypeExternalId(int id) { super(id); } + @InternalApi + @Deprecated public ASTDoctypeExternalId(JspParser p, int id) { super(p, id); } @@ -29,19 +34,14 @@ public class ASTDoctypeExternalId extends AbstractJspNode { return null != publicId; } - /** - * @return Returns the name. - */ public String getUri() { return uri; } - /** - * @param name - * The name to set. - */ - public void setUri(String name) { - this.uri = name; + @InternalApi + @Deprecated + public void setUri(String uri) { + this.uri = uri; } /** @@ -52,17 +52,12 @@ public class ASTDoctypeExternalId extends AbstractJspNode { return null == publicId ? "" : publicId; } - /** - * @param publicId - * The publicId to set. - */ + @InternalApi + @Deprecated public void setPublicId(String publicId) { this.publicId = publicId; } - /** - * Accept the visitor. * - */ @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/ASTElExpression.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTElExpression.java index 9b41130210..5cdb60f8e3 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTElExpression.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTElExpression extends AbstractJspNode { + @InternalApi + @Deprecated public ASTElExpression(int id) { super(id); } + @InternalApi + @Deprecated public ASTElExpression(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 b7c7a56091..fe95d24606 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 @@ -1,10 +1,11 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTElement.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTElement extends AbstractJspNode { /** @@ -19,14 +20,18 @@ public class ASTElement extends AbstractJspNode { /** * Flag indicating that the parser did not find a proper ending marker or - * ending tag for this element + * ending tag for this element. */ private boolean unclosed; + @InternalApi + @Deprecated public ASTElement(int id) { super(id); } + @InternalApi + @Deprecated public ASTElement(JspParser p, int id) { super(p, id); } @@ -58,24 +63,16 @@ public class ASTElement extends AbstractJspNode { return colonIndex >= 0 ? name.substring(colonIndex + 1) : name; } - /** - * @return Returns the name. - */ public String getName() { return name; } - /** - * @param name - * The name to set. - */ + @InternalApi + @Deprecated public void setName(String name) { this.name = name; } - /** - * @return Returns the empty. - */ public boolean isEmpty() { return empty; } @@ -84,21 +81,18 @@ public class ASTElement extends AbstractJspNode { return unclosed; } + @InternalApi + @Deprecated public void setUnclosed(boolean unclosed) { this.unclosed = unclosed; } - /** - * @param empty - * The empty to set. - */ + @InternalApi + @Deprecated public void setEmpty(boolean empty) { this.empty = empty; } - /** - * Accept the visitor. * - */ @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/ASTHtmlScript.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTHtmlScript.java index 338adc6cf2..4bfb1bc583 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 @@ -1,21 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTHtmlScript.java Version 4.1 */ -/* JavaCCOptions:MULTI=true,NODE_USES_PARSER=true,VISITOR=true,TRACK_TOKENS=false,NODE_PREFIX=AST,NODE_EXTENDS=,NODE_FACTORY= */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTHtmlScript extends AbstractJspNode { + @InternalApi + @Deprecated public ASTHtmlScript(int id) { super(id); } + @InternalApi + @Deprecated public ASTHtmlScript(JspParser p, int id) { super(p, id); } - /** Accept the visitor. **/ @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 8d7c7b3d75..cc2fce9fc4 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTJspComment.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTJspComment extends AbstractJspNode { + @InternalApi + @Deprecated public ASTJspComment(int id) { super(id); } + @InternalApi + @Deprecated public ASTJspComment(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 65814f382e..a2791a662c 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTJspDeclaration.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTJspDeclaration extends AbstractJspNode { + @InternalApi + @Deprecated public ASTJspDeclaration(int id) { super(id); } + @InternalApi + @Deprecated public ASTJspDeclaration(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 afc12ee48a..2d1cc558b7 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTJspDeclarations.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTJspDeclarations extends AbstractJspNode { + @InternalApi + @Deprecated public ASTJspDeclarations(int id) { super(id); } + @InternalApi + @Deprecated public ASTJspDeclarations(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 85c84408db..b043817a3d 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 @@ -1,10 +1,11 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTJspDirective.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTJspDirective extends AbstractJspNode { /** @@ -12,32 +13,28 @@ public class ASTJspDirective extends AbstractJspNode { */ private String name; + @InternalApi + @Deprecated public ASTJspDirective(int id) { super(id); } + @InternalApi + @Deprecated public ASTJspDirective(JspParser p, int id) { super(p, id); } - /** - * @return Returns the name. - */ public String getName() { return name; } - /** - * @param name - * The name to set. - */ + @InternalApi + @Deprecated public void setName(String name) { this.name = name; } - /** - * Accept the visitor. * - */ @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/ASTJspDirectiveAttribute.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDirectiveAttribute.java index 700ea5d769..a85f104993 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 @@ -1,56 +1,48 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTJspDirectiveAttribute.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTJspDirectiveAttribute extends AbstractJspNode { private String name; private String value; + @InternalApi + @Deprecated public ASTJspDirectiveAttribute(int id) { super(id); } + @InternalApi + @Deprecated public ASTJspDirectiveAttribute(JspParser p, int id) { super(p, id); } - /** - * @return Returns the name. - */ public String getName() { return name; } - /** - * @param name - * The name to set. - */ + @InternalApi + @Deprecated public void setName(String name) { this.name = name; } - /** - * @return Returns the value. - */ public String getValue() { return value; } - /** - * @param value - * The value to set. - */ + @InternalApi + @Deprecated public void setValue(String value) { this.value = value; } - /** - * Accept the visitor. * - */ @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/ASTJspDocument.java b/pmd-jsp/src/main/java/net/sourceforge/pmd/lang/jsp/ast/ASTJspDocument.java index 9826676aab..02290ece1d 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTJspDocument.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTJspDocument extends AbstractJspNode { + @InternalApi + @Deprecated public ASTJspDocument(int id) { super(id); } + @InternalApi + @Deprecated public ASTJspDocument(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 6a9f41ae8d..3d5945396b 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTJspExpression.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTJspExpression extends AbstractJspNode { + @InternalApi + @Deprecated public ASTJspExpression(int id) { super(id); } + @InternalApi + @Deprecated public ASTJspExpression(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 8a1f88f9c4..0bbd10e434 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTJspExpressionInAttribute.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTJspExpressionInAttribute extends AbstractJspNode { + @InternalApi + @Deprecated public ASTJspExpressionInAttribute(int id) { super(id); } + @InternalApi + @Deprecated public ASTJspExpressionInAttribute(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 8fec3d9414..2d574e179f 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTJspScriptlet.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTJspScriptlet extends AbstractJspNode { + @InternalApi + @Deprecated public ASTJspScriptlet(int id) { super(id); } + @InternalApi + @Deprecated public ASTJspScriptlet(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 56a4654e01..6b0b15408d 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTText.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTText extends AbstractJspNode { + @InternalApi + @Deprecated public ASTText(int id) { super(id); } + @InternalApi + @Deprecated public ASTText(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 07b5bff083..ff99b5b7e2 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTUnparsedText.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTUnparsedText extends AbstractJspNode { + @InternalApi + @Deprecated public ASTUnparsedText(int id) { super(id); } + @InternalApi + @Deprecated public ASTUnparsedText(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 d7ddf39a4d..afcfd76fa6 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 @@ -1,22 +1,24 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ -/* Generated By:JJTree: Do not edit this line. ASTValueBinding.java */ package net.sourceforge.pmd.lang.jsp.ast; +import net.sourceforge.pmd.annotation.InternalApi; + public class ASTValueBinding extends AbstractJspNode { + @InternalApi + @Deprecated public ASTValueBinding(int id) { super(id); } + @InternalApi + @Deprecated public ASTValueBinding(JspParser p, int id) { super(p, id); } - /** - * Accept the visitor. * - */ @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 a591f4ecdf..5da078d6fe 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 @@ -4,9 +4,12 @@ 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 { protected JspParser parser; 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 4b76e95e96..1795ad8d10 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 @@ -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.ast; import java.util.ArrayList; import java.util.List; +import net.sourceforge.pmd.annotation.InternalApi; import net.sourceforge.pmd.util.StringUtil; /** @@ -19,6 +20,8 @@ import net.sourceforge.pmd.util.StringUtil; * @author Victor Bucutea * */ +@Deprecated +@InternalApi public 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 index 86c9131d9c..6a56f0a3d1 100644 --- 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 @@ -4,10 +4,15 @@ 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; 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 index f886b882dc..37513a2c90 100644 --- 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 @@ -4,12 +4,17 @@ 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; diff --git a/pmd-plsql/etc/grammar/PldocAST.jjt b/pmd-plsql/etc/grammar/PldocAST.jjt index dd1a27c92f..105cca864e 100644 --- a/pmd-plsql/etc/grammar/PldocAST.jjt +++ b/pmd-plsql/etc/grammar/PldocAST.jjt @@ -27,6 +27,10 @@ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. /** + * Add support for XMLROOT, improve ExtractExpression to support xml + * + * Piotr Szymanski 03/2020 + *==================================================================== * Add basic support for with clause in select statements * * Andreas Dangel 09/2019 @@ -243,9 +247,9 @@ ASTInput Input(String sourcecode) : {} | LOOKAHEAD(6) Global() | (LOOKAHEAD(6) DDLCommand())+ | LOOKAHEAD(2) SqlPlusCommand() - | UpdateStatement() - | DeleteStatement() - | InsertStatement() + | UpdateStatement() [";"] + | DeleteStatement() [";"] + | InsertStatement() [";"] | SelectStatement() [";"] |(|||||) ReadPastNextOccurrence(";") //Ignore SQL statements in scripts ) @@ -452,9 +456,7 @@ ASTDeclarativeUnit DeclarativeUnit() : ProgramUnit() | LOOKAHEAD(4) VariableOrConstantDeclaration() | - LOOKAHEAD(2) CursorSpecification() | - CursorBody() | CollectionDeclaration() | //ProgramUnit() //|TypeMethod() @@ -1034,54 +1036,48 @@ void SkipPastNextOccurrence(String target) : { return; } } -/* - Read Tokens up to but not including the target Token.kind. -*/ +/** + * Read Tokens up to but not including the target Token.kind. + */ void Skip2NextTokenOccurrence(int target) : { - Token nextToken = getToken(1); - Token specToken = null ; - while (nextToken.kind!=target - && (null == nextToken.specialToken || nextToken.specialToken.kind!=target ) //In case the target is a Special Token - && nextToken.kind!=EOF //SRT 20110521 - Prevent endless loop when target does not exist in the input stream - ) - { - /* - Check if the target appears as a SpecialToken - - - nextToken.specialToken points to the _LAST_ of any SpecialTokens before the current normal Token. - - It is the head of a doubly-linked list: - - The ${specialToken}.specialToken field POINTS BACKWARDS TOWARDS the FIRST occurring SpecialToken - The ${specialToken}.next field POINTS FORWARDS to to the LAST occurring SpecialToken - - This means that if the program is interested in a specific SpecialToken, it must examine the linked list for every Token which has nexToken.specialToken != null. - - */ - specToken = nextToken.specialToken; - if (null!= specToken) + Token nextToken = getToken(1); + Token specToken = null ; + while (nextToken.kind!=target + && (null == nextToken.specialToken || nextToken.specialToken.kind!=target ) //In case the target is a Special Token + && nextToken.kind!=EOF) //SRT 20110521 - Prevent endless loop when target does not exist in the input stream { - //Walk backwards through the list looking for this Token as a Special Token - while (specToken != null && specToken.kind != target) - { - specToken = specToken.specialToken; - } - - //We have found the target as a SpecialToken - break out of normal Token search - if (null != specToken && specToken.kind == target) - { - break; + /* + * Check if the target appears as a SpecialToken + * + * nextToken.specialToken points to the _LAST_ of any SpecialTokens before the current normal Token. + * + * It is the head of a doubly-linked list: + * + * The ${specialToken}.specialToken field POINTS BACKWARDS TOWARDS the FIRST occurring SpecialToken + * The ${specialToken}.next field POINTS FORWARDS to to the LAST occurring SpecialToken + * + * This means that if the program is interested in a specific SpecialToken, it must examine the linked list for every Token which has nexToken.specialToken != null. + */ + specToken = nextToken.specialToken; + if (null!= specToken) { + //Walk backwards through the list looking for this Token as a Special Token + while (specToken != null && specToken.kind != target) { + specToken = specToken.specialToken; + } } - } - nextToken = getNextToken(); - nextToken = getToken(1); - } + //We have found the target as a SpecialToken - break out of normal Token search + if (null != specToken && specToken.kind == target) { + break; + } + + nextToken = getNextToken(); + nextToken = getToken(1); + } } { - { return; } + { return; } } /* @@ -1140,7 +1136,7 @@ ASTReadPastNextOccurrence ReadPastNextOccurrence(String target) : ASTSqlStatement SqlStatement(String initiator, String terminator) : {} { - (
||) + (
||) Skip2NextTerminator(initiator,terminator) { return jjtThis ; @@ -1333,7 +1329,11 @@ ASTGroupingExpressionList GroupingExpressionList() : ASTWhereClause WhereClause() : {} { + ( + LOOKAHEAD(3) Expression() + | Condition() + ) { return jjtThis; } } @@ -1601,6 +1601,10 @@ ASTOuterJoinExpression OuterJoinExpression() : * See https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/Functions.html#GUID-D079EFD3-C683-441F-977E-2C9503089982 * See https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/About-User-Defined-Functions.html#GUID-4EB3E236-8216-471C-BA44-23D87BDFEA67 * + * XML Functions: + * https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/XMLROOT.html#GUID-5BD300E2-7138-436D-87AF-21658840CF9D + * https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/XMLFOREST.html#GUID-68E5C67E-CE97-4BF8-B7FF-2365E062C363 + * * A function reference/name might be: * function_name * package.function_name @@ -1621,6 +1625,10 @@ ASTFunctionCall FunctionCall() : | LOOKAHEAD({"CAST".equalsIgnoreCase(token.getImage())}) "(" ( "(" Subquery() ")" | Expression() ) Datatype() ")" | LOOKAHEAD({"XMLFOREST".equalsIgnoreCase(token.getImage())}) "(" SqlExpression() [ ID() ] ( "," SqlExpression() [ ID() ] )* ")" | LOOKAHEAD({"XMLELEMENT".equalsIgnoreCase(token.getImage())}) XMLElement() + | LOOKAHEAD({"XMLROOT".equalsIgnoreCase(token.getImage())}) + "(" Expression() "," KEYWORD("VERSION") ( KEYWORD("VALUE") | Expression() ) + [ "," KEYWORD("STANDALONE") ( | [ LOOKAHEAD({isKeyword("VALUE")}) KEYWORD("VALUE") ] ) ] + ")" | Arguments() ) @@ -1706,7 +1714,7 @@ ASTXMLPassingClause XMLPassingClause() : {} { KEYWORD("PASSING") - [ "VALUE" ] + [ KEYWORD("VALUE") ] ( SqlExpression() [ LOOKAHEAD(2) ID() ] ) ( "," SqlExpression() [ LOOKAHEAD(2) ID() ] )* { return jjtThis; } @@ -2199,7 +2207,7 @@ ASTUnlabelledStatement UnlabelledStatement() : UpdateStatement() ";" | DeleteStatement() ";" | InsertStatement() ";" | - LOOKAHEAD(["("]
||) SqlStatement(null,";") [";"] + LOOKAHEAD(["("]
||) SqlStatement(null,";") [";"] | LOOKAHEAD(3) ContinueStatement() ";" // CONTINUE keyword was added in 11G, so Oracle compilation supports CONTINUE as a variable name | CaseStatement() ";" | IfStatement() ";" @@ -2216,7 +2224,7 @@ ASTUnlabelledStatement UnlabelledStatement() : | OpenStatement() ";" | FetchStatement() ";" | Block() ";" - | EmbeddedSqlStatement() ";" + | LOOKAHEAD(2) EmbeddedSqlStatement() | PipelineStatement() ";" | ConditionalCompilationStatement() // Conditional Compilation works outside the normal parsing rules | InlinePragma() ";" @@ -2459,7 +2467,7 @@ ASTUpdateSetClause UpdateSetClause() : ( LOOKAHEAD(1) "=" Name() | - "VALUE" "(" TableAlias() ")" "=" ( LOOKAHEAD(1) "(" Subquery() ")" | Expression() ) + LOOKAHEAD({isKeyword("VALUE")}) KEYWORD("VALUE") "(" TableAlias() ")" "=" ( LOOKAHEAD(1) "(" Subquery() ")" | Expression() ) | ( ( @@ -2639,9 +2647,7 @@ ASTFetchStatement FetchStatement() : ASTEmbeddedSqlStatement EmbeddedSqlStatement() : {} { - Expression() // StringLiteral() /* */ - //SRT 20110429 | StringExpression() [ Expression() ("," Expression())*] ";" - //SRT 20121126 | StringExpression() + (StringLiteral() | Expression()) [ Name() ("," Name())* ] [ [ [ ] | ] Expression() ("," [ [ ] | ] Expression())* ] [ ( | ) Expression() ("," Expression())*] ";" @@ -2853,37 +2859,16 @@ ASTCursorUnit CursorUnit() : { jjtThis.setImage(simpleNode.getImage()) ; return jjtThis ; } } -ASTCursorSpecification CursorSpecification() : {} +/** + * This is in plsql actually called CursorDeclaration + * or CursorDefinition. + */ +ASTCursorSpecification CursorSpecification() : {} { - CursorUnit() - { return jjtThis ; } + CursorUnit() + { return jjtThis ; } } -ASTCursorBody CursorBody() : {} -{ - CursorUnit() -// /**/ - { return jjtThis ; } -} - - - -// ============================================================================ -// E X P R E S S I O N S -// ============================================================================ - -/* -String expression() : -{} -{ - "test" - { return ""; } -} -*/ - - - - ASTExpression Expression() : { PLSQLNode simpleNode = null; @@ -3185,7 +3170,7 @@ ASTMultiplicativeExpression MultiplicativeExpression() #MultiplicativeExpression //UnaryExpression() ( ( "*" | "/" | ) UnaryExpression() )* ( (simpleNode = UnaryExpression(true) ) { sb.append(simpleNode.getImage()); } - ( LOOKAHEAD(2) + ( LOOKAHEAD("**" | "*" | "/" | , {getToken(1).specialToken == null || getToken(1).specialToken.kind != EOL}) ( ("**" ) { sb.append(" ** "); } //Exponentiation | ("*" ) { sb.append(" * "); } | ("/" ) { sb.append(" / "); } @@ -3218,16 +3203,40 @@ ASTUnaryExpression UnaryExpression(boolean isUnarySign) #UnaryExpression(>1) : ASTExtractExpression ExtractExpression() : {} +{ + LOOKAHEAD(4) ExtractDatetime() { return jjtThis ; } + | + LOOKAHEAD(3) ExtractXml(jjtThis) { return jjtThis ; } +} + +/** + * See https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/EXTRACT-datetime.html#GUID-36E52BF8-945D-437D-9A3C-6860CABD210E + */ +void ExtractDatetime() #void : {} { "(" ( | | | | | | | | | ) - (LOOKAHEAD(2) FunctionCall() - |LOOKAHEAD(2) DateTimeLiteral() - |LOOKAHEAD(1) Name() ) ")" - { return jjtThis ; } + ( + LOOKAHEAD(FunctionCall()) FunctionCall() + | + LOOKAHEAD(DateTimeLiteral()) DateTimeLiteral() + | + LOOKAHEAD(Name()) Name() + ) ")" +} + +/** + * See https://docs.oracle.com/en/database/oracle/oracle-database/18/sqlrf/EXTRACT-XML.html#GUID-593295AA-4F46-4D75-B8DC-E7BCEDB1D4D7 + */ +void ExtractXml(ASTExtractExpression extractExpr) #void : +{ + extractExpr.setXml(); +} +{ + "(" Argument() "," StringLiteral() ["," StringLiteral() ] ")" } ASTUnaryExpressionNotPlusMinus UnaryExpressionNotPlusMinus() #UnaryExpressionNotPlusMinus(>1) : @@ -3864,12 +3873,10 @@ ASTComment Comment() : ( [LOOKAHEAD(ID()"."ID()"."ID()) ID()"."] ID() "." ID()) ) StringLiteral() - ";" + (";" | "/") { return jjtThis ; } } - - ASTTypeMethod TypeMethod() : { } @@ -4405,9 +4412,7 @@ ASTCompoundTriggerBlock CompoundTriggerBlock() : SubTypeDefinition() | LOOKAHEAD(4) VariableOrConstantDeclaration() | - LOOKAHEAD(2) CursorSpecification() | - CursorBody() | CollectionDeclaration() | ProgramUnit() )* @@ -5230,7 +5235,7 @@ ASTKEYWORD_UNRESERVED KEYWORD_UNRESERVED (): {} // PL/SQL UNRESERVED KEYWORDS - V$RESERVED.RESERVED='N' ( "REF" | "LAST" | "TRIM" | "OVER" | "UNBOUNDED" | "PRECEDING" | "FOLLOWING" | "WITHIN" | -"OVERFLOW" | "ERROR" | "WITHOUT" | "COUNT" | "VALUE" | "SUBPARTITION" | "LOG" | "ERRORS" | "REJECT" | "UNLIMITED" | +"OVERFLOW" | "ERROR" | "WITHOUT" | "COUNT" | "SUBPARTITION" | "LOG" | "ERRORS" | "REJECT" | "UNLIMITED" | | | diff --git a/pmd-plsql/src/main/ant/alljavacc.xml b/pmd-plsql/src/main/ant/alljavacc.xml index 6c023759b8..52045e8a58 100644 --- a/pmd-plsql/src/main/ant/alljavacc.xml +++ b/pmd-plsql/src/main/ant/alljavacc.xml @@ -46,6 +46,7 @@ + diff --git a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/ASTExtractExpression.java b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/ASTExtractExpression.java new file mode 100644 index 0000000000..eba5fadc37 --- /dev/null +++ b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/ASTExtractExpression.java @@ -0,0 +1,58 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.plsql.ast; + +import java.util.List; + +import net.sourceforge.pmd.annotation.InternalApi; + +public final class ASTExtractExpression extends AbstractPLSQLNode { + + private boolean xml; + + @InternalApi + @Deprecated + public ASTExtractExpression(int id) { + super(id); + } + + + @InternalApi + @Deprecated + public ASTExtractExpression(PLSQLParser p, int id) { + super(p, id); + } + + + @Override + public Object jjtAccept(PLSQLParserVisitor visitor, Object data) { + return visitor.visit(this, data); + } + + void setXml() { + xml = true; + } + + public boolean isXml() { + return xml; + } + + public String getXPath() { + if (xml) { + return getFirstChildOfType(ASTStringLiteral.class).getString(); + } + return ""; + } + + public String getNamespace() { + if (xml) { + List literals = findChildrenOfType(ASTStringLiteral.class); + if (literals.size() == 2) { + return literals.get(1).getString(); + } + } + return ""; + } +} diff --git a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/AbstractPLSQLNode.java b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/AbstractPLSQLNode.java index 9a7e8aa671..e65aab26a0 100644 --- a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/AbstractPLSQLNode.java +++ b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/AbstractPLSQLNode.java @@ -147,8 +147,3 @@ public abstract class AbstractPLSQLNode extends AbstractJjtreeNode im this.scope = scope; } } - -/* - * JavaCC - OriginalChecksum=3f651517d5069f856891d89230562ac4 (do not edit this - * line) - */ diff --git a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/PLSQLParserVisitorAdapter.java b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/PLSQLParserVisitorAdapter.java index c9631b54b0..81e247e122 100644 --- a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/PLSQLParserVisitorAdapter.java +++ b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/ast/PLSQLParserVisitorAdapter.java @@ -341,16 +341,6 @@ public class PLSQLParserVisitorAdapter implements PLSQLParserVisitor { return visit((PLSQLNode) node, data); } - @Override - public Object visit(ASTCursorSpecification node, Object data) { - return visit((PLSQLNode) node, data); - } - - @Override - public Object visit(ASTCursorBody node, Object data) { - return visit((PLSQLNode) node, data); - } - @Override public Object visit(ASTExpression node, Object data) { return visit((PLSQLNode) node, data); @@ -1121,4 +1111,9 @@ public class PLSQLParserVisitorAdapter implements PLSQLParserVisitor { public Object visit(ASTWithClause node, Object data) { return visit((PLSQLNode) node, data); } + + @Override + public Object visit(ASTCursorSpecification node, Object data) { + return visit((PLSQLNode) node, data); + } } diff --git a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/AbstractPLSQLRule.java b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/AbstractPLSQLRule.java index 1e6f6fcec1..59442ec42e 100644 --- a/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/AbstractPLSQLRule.java +++ b/pmd-plsql/src/main/java/net/sourceforge/pmd/lang/plsql/rule/AbstractPLSQLRule.java @@ -443,16 +443,6 @@ public abstract class AbstractPLSQLRule extends AbstractRule implements PLSQLPar return visit((PLSQLNode) node, data); } - @Override - public Object visit(ASTCursorSpecification node, Object data) { - return visit((PLSQLNode) node, data); - } - - @Override - public Object visit(ASTCursorBody node, Object data) { - return visit((PLSQLNode) node, data); - } - @Override public Object visit(ASTExpression node, Object data) { return visit((PLSQLNode) node, data); @@ -1227,6 +1217,11 @@ public abstract class AbstractPLSQLRule extends AbstractRule implements PLSQLPar return visit((PLSQLNode) node, data); } + @Override + public Object visit(ASTCursorSpecification node, Object data) { + return visit((PLSQLNode) node, data); + } + /* * Treat all Executable Code */ diff --git a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/ASTExtractExpressionTest.java b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/ASTExtractExpressionTest.java new file mode 100644 index 0000000000..99a83f30e3 --- /dev/null +++ b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/ASTExtractExpressionTest.java @@ -0,0 +1,25 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.plsql.ast; + +import org.junit.Assert; +import org.junit.Test; + +import net.sourceforge.pmd.lang.plsql.AbstractPLSQLParserTst; + +public class ASTExtractExpressionTest extends AbstractPLSQLParserTst { + + + @Test + public void testXml() { + ASTInput unit = plsql.parse("SELECT warehouse_name, EXTRACT(warehouse_spec, '/Warehouse/Docks', " + + "'xmlns:a=\"http://warehouse/1\" xmlns:b=\"http://warehouse/2\"') \"Number of Docks\" " + + " FROM warehouses WHERE warehouse_spec IS NOT NULL;"); + ASTExtractExpression extract = unit.getFirstDescendantOfType(ASTExtractExpression.class); + Assert.assertTrue(extract.isXml()); + Assert.assertEquals("/Warehouse/Docks", extract.getXPath()); + Assert.assertEquals("xmlns:a=\"http://warehouse/1\" xmlns:b=\"http://warehouse/2\"", extract.getNamespace()); + } +} diff --git a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/ExecuteImmediateTest.java b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/ExecuteImmediateTest.java index 0e459ec1b2..d72ccfb037 100644 --- a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/ExecuteImmediateTest.java +++ b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/ExecuteImmediateTest.java @@ -19,4 +19,9 @@ public class ExecuteImmediateTest extends AbstractPLSQLParserTst { public void parseExecuteImmediate1047b() { plsql.parseResource("ExecuteImmediate1047b.pls"); } + + @Test + public void parseExecuteImmediateString() { + plsql.parseResource("ExecuteImmediateString.pls"); + } } diff --git a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/FunctionsTest.java b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/FunctionsTest.java index 2f4b1bd2dd..5a6b8ef7a7 100644 --- a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/FunctionsTest.java +++ b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/FunctionsTest.java @@ -19,4 +19,9 @@ public class FunctionsTest extends AbstractPLSQLParserTst { public void parseSelectExtractExpression() { plsql.parseResource("ExtractExpressions.pls"); } + + @Test + public void parseXMLExpression() { + plsql.parseResource("XMLFunctions.pls"); + } } diff --git a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/MultipleDDLStatementsTest.java b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/MultipleDDLStatementsTest.java index d318911662..5b21d5711a 100644 --- a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/MultipleDDLStatementsTest.java +++ b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/MultipleDDLStatementsTest.java @@ -17,9 +17,9 @@ public class MultipleDDLStatementsTest extends AbstractPLSQLParserTst { public void parseDDLCommands() throws Exception { ASTInput input = plsql.parseResource("DDLCommands.sql"); List ddlcommands = input.findDescendantsOfType(ASTDDLCommand.class); - Assert.assertEquals(4, ddlcommands.size()); + Assert.assertEquals(6, ddlcommands.size()); List comments = input.findDescendantsOfType(ASTComment.class); - Assert.assertEquals(3, comments.size()); + Assert.assertEquals(5, comments.size()); Assert.assertEquals("'abbreviated job title'", comments.get(0).getFirstChildOfType(ASTStringLiteral.class).getImage()); } } diff --git a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/SlashAsDivisionTest.java b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/SlashAsDivisionTest.java new file mode 100644 index 0000000000..fe182fc25a --- /dev/null +++ b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/SlashAsDivisionTest.java @@ -0,0 +1,18 @@ +/** + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +package net.sourceforge.pmd.lang.plsql.ast; + +import org.junit.Test; + +import net.sourceforge.pmd.lang.plsql.AbstractPLSQLParserTst; + +public class SlashAsDivisionTest extends AbstractPLSQLParserTst { + + @Test + public void parseSlashAsDivision() { + plsql.parseResource("SlashAsDivision.sql"); + } + +} diff --git a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/TriggerTest.java b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/TriggerTest.java new file mode 100644 index 0000000000..073d87274a --- /dev/null +++ b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/TriggerTest.java @@ -0,0 +1,28 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + + +package net.sourceforge.pmd.lang.plsql.ast; + +import org.junit.Assert; +import org.junit.Test; + +import net.sourceforge.pmd.lang.plsql.AbstractPLSQLParserTst; + + +public class TriggerTest extends AbstractPLSQLParserTst { + + /** + * Parsing a trigger should not result in a NPE. + * + * @see #2325 [plsql] NullPointerException while running parsing test for CREATE TRIGGER + */ + @Test + public void parseCreateTrigger() { + ASTInput input = plsql.parseResource("TriggerUnit.pls"); + PLSQLNode trigger = input.getChild(0); + Assert.assertEquals(ASTTriggerUnit.class, trigger.getClass()); + Assert.assertNotNull(trigger.getScope()); + } +} diff --git a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/WhereClauseTest.java b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/WhereClauseTest.java index 96440c0b15..3c0b724362 100644 --- a/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/WhereClauseTest.java +++ b/pmd-plsql/src/test/java/net/sourceforge/pmd/lang/plsql/ast/WhereClauseTest.java @@ -85,4 +85,9 @@ public class WhereClauseTest extends AbstractPLSQLParserTst { public void testParentheses() { plsql.parseResource("WhereClauseParens.pls"); } + + @Test + public void testCurrentOf() { + plsql.parseResource("WhereCurrentOf.pls"); + } } diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/DDLCommands.sql b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/DDLCommands.sql index 5833689339..d6b4e6714b 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/DDLCommands.sql +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/DDLCommands.sql @@ -5,3 +5,7 @@ COMMENT ON COLUMN employees.job_id IS 'abbreviated job title'; DROP TABLE employees; COMMENT ON COLUMN employees.job_id IS 'abbreviated job title'; + +comment on COLUMN employees.job_id is 'abbreviated job title' +/ +comment on COLUMN employees.job_id is 'abbreviated job title'; \ No newline at end of file diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ExecuteImmediateString.pls b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ExecuteImmediateString.pls new file mode 100644 index 0000000000..b7a738ab2f --- /dev/null +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ExecuteImmediateString.pls @@ -0,0 +1,9 @@ +-- +-- BSD-style license; for more info see http://pmd.sourceforge.net/license.html +-- + +CREATE OR REPLACE PROCEDURE test ( p_num_reg OUT number ) +AS +BEGIN + execute immediate 'select count(1) from test_tbl where id =:param' into p_num_reg USING 'P'; +END test; diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ExtractExpressions.pls b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ExtractExpressions.pls index 0e4e7f3b90..f9dd1d5f68 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ExtractExpressions.pls +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ExtractExpressions.pls @@ -19,3 +19,13 @@ SELECT last_name, employee_id, hire_date SELECT EXTRACT(TIMEZONE_REGION FROM TIMESTAMP '1999-01-01 10:00:00 -08:00') FROM DUAL; + +declare + v_months NUMBER; +begin + v_months := (extract(YEAR FROM v_rec.v_rec_rec.v_rec_rec_field) - + extract(YEAR FROM v_rec.v_rec_rec.v_rec_rec_field)) * 12 + + (extract(MONTH FROM v_rec.v_rec_rec.v_rec_rec_field) - + extract(MONTH FROM v_rec.v_rec_rec.v_rec_rec_field)); + +end; \ No newline at end of file diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SlashAsDivision.sql b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SlashAsDivision.sql new file mode 100644 index 0000000000..68d46635e6 --- /dev/null +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SlashAsDivision.sql @@ -0,0 +1,17 @@ +update name +set street = 'Main Street' +/ + +update name +set n01 = 2/2 +/ + +update name +set n01 = 2 +/ + +update name +set n01 = 2/2; + +update name +set n01 = 2; diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/StringLiterals.pls b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/StringLiterals.pls index 7d1f68bc3d..6230c19f58 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/StringLiterals.pls +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/StringLiterals.pls @@ -23,10 +23,10 @@ declare qliteral1f clob := Nq'[a"b"c]'; qliteral1g clob := nQ'[ab']cd]'; - qliteral1 clob := q'!name LIKE '%DBMS_%%'!'; - qliteral2 clob := Q'{SELECT * FROM employees WHERE last_name = 'Smith';}'; - qliteral2a clob := q'! test !'; - qliteral2b clob := q'{ + qliteral2a clob := q'!name LIKE '%DBMS_%%'!'; + qliteral2b clob := Q'{SELECT * FROM employees WHERE last_name = 'Smith';}'; + qliteral2c clob := q'! test !'; + qliteral2d clob := q'{ also multiple lines }'; diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/TriggerUnit.pls b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/TriggerUnit.pls new file mode 100644 index 0000000000..fe15216d28 --- /dev/null +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/TriggerUnit.pls @@ -0,0 +1,8 @@ +create or replace trigger test_trigger +instead of update +on test_table +for each row +begin + test.clr; +end; +/ diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/WhereCurrentOf.pls b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/WhereCurrentOf.pls new file mode 100644 index 0000000000..f9464b2f16 --- /dev/null +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/WhereCurrentOf.pls @@ -0,0 +1,26 @@ +declare + thisstudent student%rowtype; + + cursor maths_student is + select * + from student + where sid in (select sid + from take + where cid = 'cs145') + for update; + +begin + open maths_student; + loop + fetch maths_student + into thisstudent; + exit when(maths_student%notfound); + if (thisstudent.gpa < 4.0) then + update student + set gpa = 4.0 + where current of maths_student; + end if; + end loop; + + close maths_student; +end; diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/XMLFunctions.pls b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/XMLFunctions.pls new file mode 100644 index 0000000000..a3e887eee7 --- /dev/null +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/XMLFunctions.pls @@ -0,0 +1,39 @@ +SELECT xmlroot(xmlelement("BODY", + xmlagg(xmlconcat(extract(v_1, '/BODY/child::node()'), + extract(v_2, '/BODY/child::node()')))), + version '1.0') + FROM (SELECT dummy FROM dual CONNECT BY LEVEL <= 2); + +SELECT warehouse_name, EXTRACT(warehouse_spec, '/Warehouse/Docks') + "Number of Docks" + FROM warehouses + WHERE warehouse_spec IS NOT NULL; + +SELECT warehouse_name, EXTRACT(warehouse_spec, '/Warehouse/Docks', 'xmlns:a="http://warehouse/1" xmlns:b="http://warehouse/2"') + "Number of Docks" + FROM warehouses + WHERE warehouse_spec IS NOT NULL; + + +SELECT XMLELEMENT("Emp", + XMLFOREST(e.employee_id, e.last_name, e.salary)) + "Emp Element" + FROM employees e WHERE employee_id = 204; + +SELECT XMLROOT ( XMLType('143598'), VERSION '1.0', STANDALONE YES) + AS "XMLROOT" FROM DUAL; + +SELECT XMLROOT ( XMLType('143598'), VERSION '1.0', STANDALONE NO) + AS "XMLROOT" FROM DUAL; + +SELECT XMLROOT ( XMLType('143598'), VERSION '1.0', STANDALONE NO VALUE) + AS "XMLROOT" FROM DUAL; + +SELECT XMLROOT ( XMLType('143598'), VERSION NO VALUE, STANDALONE YES) + AS "XMLROOT" FROM DUAL; + +SELECT XMLROOT ( XMLType('143598'), VERSION NO VALUE) + AS "XMLROOT" FROM DUAL; + +SELECT XMLROOT ( XMLType('143598'), VERSION '1.0') + AS "XMLROOT" FROM DUAL; diff --git a/pmd-test/src/main/resources/rule-tests_1_0_0.xsd b/pmd-test/src/main/resources/rule-tests_1_0_0.xsd index 5785cdff15..5387cf5aa3 100644 --- a/pmd-test/src/main/resources/rule-tests_1_0_0.xsd +++ b/pmd-test/src/main/resources/rule-tests_1_0_0.xsd @@ -50,7 +50,7 @@ - + diff --git a/pmd-vm/etc/grammar/VmParser.jjt b/pmd-vm/etc/grammar/VmParser.jjt index 4fab39c65a..3873806180 100644 --- a/pmd-vm/etc/grammar/VmParser.jjt +++ b/pmd-vm/etc/grammar/VmParser.jjt @@ -1247,10 +1247,12 @@ void Escape() : {} control = true; } - jjtThis.val = ""; + String value = ""; - for( int i = 0; i < count; i++) - jjtThis.val += ( control ? "\\" : "\\\\"); + for( int i = 0; i < count; i++) { + value += ( control ? "\\" : "\\\\"); + } + jjtThis.setValue(value); } } diff --git a/pmd-vm/src/main/ant/alljavacc.xml b/pmd-vm/src/main/ant/alljavacc.xml index ef845cdb3c..2121416409 100644 --- a/pmd-vm/src/main/ant/alljavacc.xml +++ b/pmd-vm/src/main/ant/alljavacc.xml @@ -128,18 +128,34 @@ public class Token implements GenericToken, java.io.Serializable]]> - - + + + - - + + + + + + + + + + + + + + + + + + diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmHandler.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmHandler.java index 4ec4aff3fa..054a594737 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmHandler.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmHandler.java @@ -1,4 +1,4 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmLanguageModule.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmLanguageModule.java index 9218faa6a7..bfcf727c70 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmLanguageModule.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmLanguageModule.java @@ -1,3 +1,6 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ package net.sourceforge.pmd.lang.vm; diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmParser.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmParser.java index 812d924b86..0650e0f9e5 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmParser.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmParser.java @@ -1,4 +1,4 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ @@ -6,6 +6,7 @@ package net.sourceforge.pmd.lang.vm; import java.io.Reader; +import net.sourceforge.pmd.annotation.InternalApi; import net.sourceforge.pmd.lang.AbstractParser; import net.sourceforge.pmd.lang.ParserOptions; import net.sourceforge.pmd.lang.TokenManager; @@ -16,7 +17,11 @@ import net.sourceforge.pmd.lang.vm.util.VelocityCharStream; /** * Adapter for the VmParser. + * + * @deprecated This is internal API, use {@link LanguageVersionHandler#getParser(ParserOptions)}. */ +@Deprecated +@InternalApi public class VmParser extends AbstractParser { public VmParser(final ParserOptions parserOptions) { diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmTokenManager.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmTokenManager.java index 4d8f01e46c..55669a4bd6 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmTokenManager.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/VmTokenManager.java @@ -1,4 +1,4 @@ -/** +/* * BSD-style license; for more info see http://pmd.sourceforge.net/license.html */ diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTAddNode.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTAddNode.java index ac8136b9f2..4438076ee8 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTAddNode.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTAddNode.java @@ -1,6 +1,8 @@ package net.sourceforge.pmd.lang.vm.ast; +import net.sourceforge.pmd.annotation.InternalApi; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -34,22 +36,19 @@ package net.sourceforge.pmd.lang.vm.ast; * @version $Id: ASTAddNode.java 712887 2008-11-11 00:27:50Z nbubna $ */ public class ASTAddNode extends ASTMathNode { - /** - * @param id - */ + + @InternalApi + @Deprecated public ASTAddNode(final int id) { super(id); } - /** - * @param p - * @param id - */ + @InternalApi + @Deprecated public ASTAddNode(final VmParser p, final int id) { super(p, id); } - /** Accept the visitor. **/ @Override public Object jjtAccept(VmParserVisitor visitor, Object data) { return visitor.visit(this, data); diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDirective.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDirective.java index 9068449cce..22243fe934 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDirective.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDirective.java @@ -3,6 +3,8 @@ package net.sourceforge.pmd.lang.vm.ast; import org.apache.commons.lang3.builder.ToStringBuilder; +import net.sourceforge.pmd.annotation.InternalApi; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -38,17 +40,14 @@ import org.apache.commons.lang3.builder.ToStringBuilder; public class ASTDirective extends AbstractVmNode { private String directiveName = ""; - /** - * @param id - */ + @InternalApi + @Deprecated public ASTDirective(final int id) { super(id); } - /** - * @param p - * @param id - */ + @InternalApi + @Deprecated public ASTDirective(final VmParser p, final int id) { super(p, id); } @@ -62,9 +61,9 @@ public class ASTDirective extends AbstractVmNode { * Sets the directive name. Used by the parser. This keeps us from having to * dig it out of the token stream and gives the parse the change to * override. - * - * @param str */ + @InternalApi + @Deprecated public void setDirectiveName(final String str) { directiveName = str; } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDivNode.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDivNode.java index ba8cc16168..44ca67ab02 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDivNode.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTDivNode.java @@ -1,6 +1,8 @@ package net.sourceforge.pmd.lang.vm.ast; +import net.sourceforge.pmd.annotation.InternalApi; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -34,22 +36,19 @@ package net.sourceforge.pmd.lang.vm.ast; * @version $Id: ASTDivNode.java 691048 2008-09-01 20:26:11Z nbubna $ */ public class ASTDivNode extends ASTMathNode { - /** - * @param id - */ + + @InternalApi + @Deprecated public ASTDivNode(final int id) { super(id); } - /** - * @param p - * @param id - */ + @InternalApi + @Deprecated public ASTDivNode(final VmParser p, final int id) { super(p, id); } - /** Accept the visitor. **/ @Override public Object jjtAccept(VmParserVisitor visitor, Object data) { return visitor.visit(this, data); diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTEscape.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTEscape.java index 8c8197ac55..53486785d2 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTEscape.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTEscape.java @@ -1,6 +1,8 @@ package net.sourceforge.pmd.lang.vm.ast; +import net.sourceforge.pmd.annotation.InternalApi; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -31,23 +33,30 @@ package net.sourceforge.pmd.lang.vm.ast; */ public class ASTEscape extends AbstractVmNode { /** Used by the parser */ + @InternalApi + @Deprecated public String val; - /** - * @param id - */ + @InternalApi + @Deprecated public ASTEscape(final int id) { super(id); } - /** - * @param p - * @param id - */ + @InternalApi + @Deprecated public ASTEscape(final VmParser p, final int id) { super(p, id); } + void setValue(String value) { + this.val = value; + } + + public String getValue() { + return val; + } + @Override public Object jjtAccept(final VmParserVisitor visitor, final Object data) { return visitor.visit(this, data); diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMathNode.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMathNode.java index 34733b9be1..82fed159b4 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMathNode.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMathNode.java @@ -1,6 +1,8 @@ package net.sourceforge.pmd.lang.vm.ast; +import net.sourceforge.pmd.annotation.InternalApi; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -34,13 +36,19 @@ package net.sourceforge.pmd.lang.vm.ast; * @author Nathan Bubna * @version $Id: ASTMathNode.java 517553 2007-03-13 06:09:58Z wglass $ */ +@InternalApi +@Deprecated public abstract class ASTMathNode extends AbstractVmNode { protected boolean strictMode = false; + @InternalApi + @Deprecated public ASTMathNode(final int id) { super(id); } + @InternalApi + @Deprecated public ASTMathNode(final VmParser p, final int id) { super(p, id); } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMethod.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMethod.java index 5dc1e3d563..63dd3d1902 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMethod.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMethod.java @@ -4,6 +4,8 @@ package net.sourceforge.pmd.lang.vm.ast; import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; +import net.sourceforge.pmd.annotation.InternalApi; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -40,17 +42,14 @@ import org.apache.commons.lang3.StringUtils; * @version $Id: ASTMethod.java 720228 2008-11-24 16:58:33Z nbubna $ */ public class ASTMethod extends AbstractVmNode { - /** - * @param id - */ + @InternalApi + @Deprecated public ASTMethod(final int id) { super(id); } - /** - * @param p - * @param id - */ + @InternalApi + @Deprecated public ASTMethod(final VmParser p, final int id) { super(p, id); } @@ -66,7 +65,9 @@ public class ASTMethod extends AbstractVmNode { * constructor) for unit test purposes. * * @since 1.5 + * @deprecated for removal in PMD 7.0.0 - it's not used anywhere */ + @Deprecated public static class MethodCacheKey { private final String methodName; diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTModNode.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTModNode.java index 9bd588007b..dd177a4de7 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTModNode.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTModNode.java @@ -1,6 +1,8 @@ package net.sourceforge.pmd.lang.vm.ast; +import net.sourceforge.pmd.annotation.InternalApi; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -33,22 +35,19 @@ package net.sourceforge.pmd.lang.vm.ast; * @version $Id: ASTModNode.java 691048 2008-09-01 20:26:11Z nbubna $ */ public class ASTModNode extends ASTMathNode { - /** - * @param id - */ + + @InternalApi + @Deprecated public ASTModNode(final int id) { super(id); } - /** - * @param p - * @param id - */ + @InternalApi + @Deprecated public ASTModNode(final VmParser p, final int id) { super(p, id); } - /** Accept the visitor. **/ @Override public Object jjtAccept(VmParserVisitor visitor, Object data) { return visitor.visit(this, data); diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMulNode.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMulNode.java index da565930a5..aba41e0beb 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMulNode.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTMulNode.java @@ -1,6 +1,8 @@ package net.sourceforge.pmd.lang.vm.ast; +import net.sourceforge.pmd.annotation.InternalApi; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -34,22 +36,19 @@ package net.sourceforge.pmd.lang.vm.ast; * @version $Id: ASTMulNode.java 691048 2008-09-01 20:26:11Z nbubna $ */ public class ASTMulNode extends ASTMathNode { - /** - * @param id - */ + + @InternalApi + @Deprecated public ASTMulNode(final int id) { super(id); } - /** - * @param p - * @param id - */ + @InternalApi + @Deprecated public ASTMulNode(final VmParser p, final int id) { super(p, id); } - /** Accept the visitor. **/ @Override public Object jjtAccept(VmParserVisitor visitor, Object data) { return visitor.visit(this, data); diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTReference.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTReference.java index d17e6b5a40..a4dd514966 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTReference.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTReference.java @@ -1,6 +1,8 @@ package net.sourceforge.pmd.lang.vm.ast; +import net.sourceforge.pmd.annotation.InternalApi; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -39,7 +41,10 @@ public class ASTReference extends AbstractVmNode { /** * Indicates if we are running in strict reference mode. + * + * @deprecated for removal with PMD 7.0.0 */ + @Deprecated public boolean strictRef = false; /** @@ -48,20 +53,20 @@ public class ASTReference extends AbstractVmNode { * implementations are known to have non-null return values. Disabling the * check will give a performance improval since toString() may be a complex * operation on large objects. + * + * @deprecated for removal with PMD 7.0.0 */ + @Deprecated public boolean toStringNullCheck = true; - /** - * @param id - */ + @InternalApi + @Deprecated public ASTReference(final int id) { super(id); } - /** - * @param p - * @param id - */ + @InternalApi + @Deprecated public ASTReference(final VmParser p, final int id) { super(p, id); } @@ -91,6 +96,8 @@ public class ASTReference extends AbstractVmNode { * @param literal * String to render to when null */ + @InternalApi + @Deprecated public void setLiteral(final String literal) { /* * do only once diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTStringLiteral.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTStringLiteral.java index 16aea343dc..57b527fff2 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTStringLiteral.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTStringLiteral.java @@ -3,6 +3,8 @@ package net.sourceforge.pmd.lang.vm.ast; import org.apache.commons.lang3.text.StrBuilder; +import net.sourceforge.pmd.annotation.InternalApi; + /* * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed with this @@ -28,17 +30,14 @@ import org.apache.commons.lang3.text.StrBuilder; * @version $Id: ASTStringLiteral.java 705297 2008-10-16 17:59:24Z nbubna $ */ public class ASTStringLiteral extends AbstractVmNode { - /** - * @param id - */ + @InternalApi + @Deprecated public ASTStringLiteral(final int id) { super(id); } - /** - * @param p - * @param id - */ + @InternalApi + @Deprecated public ASTStringLiteral(final VmParser p, final int id) { super(p, id); } @@ -50,7 +49,10 @@ public class ASTStringLiteral extends AbstractVmNode { * that the line and column position reported reflects the error position * within the template and not just relative to the error position within * the string literal. + * + * @deprecated for removal with PMD 7.0.0 */ + @Deprecated public void adjTokenLineNums(final AbstractVmNode node) { Token tok = node.getFirstToken(); // Test against null is probably not neccessary, but just being safe @@ -74,7 +76,10 @@ public class ASTStringLiteral extends AbstractVmNode { /** * @since 1.6 + * @deprecated for removal with PMD 7.0.0 */ + @InternalApi + @Deprecated public static String unescape(final String string) { int u = string.indexOf("\\u"); if (u < 0) { diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTSubtractNode.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTSubtractNode.java index 88e694669d..052fb7dbcf 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTSubtractNode.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/ASTSubtractNode.java @@ -1,6 +1,8 @@ package net.sourceforge.pmd.lang.vm.ast; +import net.sourceforge.pmd.annotation.InternalApi; + /* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file @@ -34,22 +36,18 @@ package net.sourceforge.pmd.lang.vm.ast; * @version $Id: ASTSubtractNode.java 691048 2008-09-01 20:26:11Z nbubna $ */ public class ASTSubtractNode extends ASTMathNode { - /** - * @param id - */ + @InternalApi + @Deprecated public ASTSubtractNode(final int id) { super(id); } - /** - * @param p - * @param id - */ + @InternalApi + @Deprecated public ASTSubtractNode(final VmParser p, final int id) { super(p, id); } - /** Accept the visitor. **/ @Override public Object jjtAccept(VmParserVisitor visitor, Object data) { return visitor.visit(this, data); diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/AbstractVmNode.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/AbstractVmNode.java index a3b9729fee..dd1234e5e5 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/AbstractVmNode.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/AbstractVmNode.java @@ -31,6 +31,8 @@ import net.sourceforge.pmd.lang.ast.impl.javacc.AbstractJjtreeNode; /** * */ +@InternalApi +@Deprecated public class AbstractVmNode extends AbstractJjtreeNode implements VmNode { /** */ @@ -128,7 +130,9 @@ public class AbstractVmNode extends AbstractJjtreeNode implements VmNode /** * @param prefix * @return String representation of this node. + * @deprecated will be removed with PMD 7. Was only needed for {@link #dump(String, boolean, Writer)}. */ + @Deprecated public String toString(final String prefix) { return prefix + toString(); } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/MacroParseException.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/MacroParseException.java index 16237c1aba..e6b19accfa 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/MacroParseException.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/MacroParseException.java @@ -30,7 +30,9 @@ import net.sourceforge.pmd.lang.vm.util.LogUtil; * @author Geir Magnusson Jr. * @author Henning P. Schmiedehausen * @version $Id: MacroParseException.java 735709 2009-01-19 14:30:03Z byron $ + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public class MacroParseException extends ParseException { private final String templateName; diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/NodeUtils.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/NodeUtils.java index 270d1395c0..d3e99c68fb 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/NodeUtils.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/NodeUtils.java @@ -28,7 +28,9 @@ import org.apache.commons.lang3.text.StrBuilder; * @author Jason van Zyl * @author Geir Magnusson Jr. * @version $Id: NodeUtils.java 687386 2008-08-20 16:57:07Z nbubna $ + * @deprecated for removal with PMD 7.0.0 */ +@Deprecated public final class NodeUtils { private NodeUtils() { } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/TemplateParseException.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/TemplateParseException.java index e41a76a3be..1913c84cee 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/TemplateParseException.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/TemplateParseException.java @@ -31,6 +31,7 @@ import net.sourceforge.pmd.lang.vm.util.LogUtil; * @version $Id: TemplateParseException.java 703544 2008-10-10 18:15:53Z nbubna * $ * @since 1.5 + * @deprecated for removal in PMD 7.0.0 */ @Deprecated public class TemplateParseException extends ParseException { diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/TokenMgrError.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/TokenMgrError.java index 546b054b60..898ad8dfec 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/TokenMgrError.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/TokenMgrError.java @@ -3,6 +3,10 @@ package net.sourceforge.pmd.lang.vm.ast; /* Generated By:JavaCC: Do not edit this line. TokenMgrError.java Version 3.0 */ +/** + * @deprecated for removal in PMD 7.0.0 + */ +@Deprecated public class TokenMgrError extends RuntimeException { /* * Ordinals for various reasons why an Error of this type can be thrown. diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmNode.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmNode.java index 50747f73b3..94da1d9d1b 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmNode.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/ast/VmNode.java @@ -9,13 +9,13 @@ import net.sourceforge.pmd.lang.ast.NodeStream; public interface VmNode extends Node { /** - * Accept the visitor. * + * Accept the visitor. */ Object jjtAccept(VmParserVisitor visitor, Object data); /** - * Accept the visitor. * + * Accept the visitor. * * @deprecated This method is not useful, the logic for combining * children values should be present on the visitor, not the node diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Block.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Block.java index b10b9dbe75..29eb9f3eb6 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Block.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Block.java @@ -29,7 +29,9 @@ package net.sourceforge.pmd.lang.vm.directive; * @author Jarkko Viinamaki * @since 1.7 * @version $Id: Block.java 686842 2008-08-18 18:29:31Z nbubna $ + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public abstract class Block extends Directive { protected String key; diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/BlockMacro.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/BlockMacro.java index e1b80173af..38c2496bc9 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/BlockMacro.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/BlockMacro.java @@ -52,7 +52,9 @@ package net.sourceforge.pmd.lang.vm.directive; * @author Jarkko Viinamaki * @since 1.7 * @version $Id$ + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public class BlockMacro extends Block { private String name; diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Break.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Break.java index ee3bf5b629..9b2a7744bf 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Break.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Break.java @@ -26,7 +26,9 @@ package net.sourceforge.pmd.lang.vm.directive; * @author Jarkko Viinamaki * @author Nathan Bubna * @version $Id$ + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public class Break extends Directive { /** diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Define.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Define.java index 08683debf5..b911f976ee 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Define.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Define.java @@ -27,7 +27,9 @@ package net.sourceforge.pmd.lang.vm.directive; * @author Andrew Tetlaw * @author Nathan Bubna * @version $Id: Define.java 686842 2008-08-18 18:29:31Z nbubna $ + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public class Define extends Block { /** * Return name of this directive. diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Directive.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Directive.java index 0baaee2eae..a79ae54a06 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Directive.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Directive.java @@ -26,7 +26,9 @@ package net.sourceforge.pmd.lang.vm.directive; * @author Jason van Zyl * @author Nathan Bubna * @version $Id: Directive.java 778045 2009-05-23 22:17:46Z nbubna $ + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public abstract class Directive implements Cloneable { /** Block directive indicator */ public static final int BLOCK = 1; diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Evaluate.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Evaluate.java index ab48ac2392..e0226ea48d 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Evaluate.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Evaluate.java @@ -26,7 +26,9 @@ package net.sourceforge.pmd.lang.vm.directive; * @author Will Glass-Husain * @version $Id: Evaluate.java 898032 2010-01-11 19:51:03Z nbubna $ * @since 1.6 + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public class Evaluate extends Directive { /** diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Foreach.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Foreach.java index 715f17f5f0..1fc9b1c17f 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Foreach.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Foreach.java @@ -28,7 +28,9 @@ package net.sourceforge.pmd.lang.vm.directive; * @author Geir Magnusson Jr. * @author Daniel Rall * @version $Id: Foreach.java 945927 2010-05-18 22:21:41Z nbubna $ + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public class Foreach extends Directive { /** * Return name of this directive. diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Include.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Include.java index fa6e04fe36..4062926fbc 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Include.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Include.java @@ -53,7 +53,9 @@ package net.sourceforge.pmd.lang.vm.directive; * @author Jason van Zyl * @author Kasper Nielsen * @version $Id: Include.java 746438 2009-02-21 05:41:24Z nbubna $ + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public class Include extends InputBase { /** diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/InputBase.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/InputBase.java index 5c47a5fe36..bb7573fab0 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/InputBase.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/InputBase.java @@ -26,7 +26,9 @@ package net.sourceforge.pmd.lang.vm.directive; * * @author Daniel Rall * @since 1.4 + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public abstract class InputBase extends Directive { /** * Return name of this directive. diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Literal.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Literal.java index 0d81c6c919..a3d3141ef2 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Literal.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Literal.java @@ -28,7 +28,7 @@ package net.sourceforge.pmd.lang.vm.directive; * * @author Jason van Zyl * @version $Id: Literal.java 746438 2009-02-21 05:41:24Z nbubna $ - * @deprecated Use the #[[unparsed content]]# syntax instead. + * @deprecated Use the #[[unparsed content]]# syntax instead. Deprecated for removal in PMD 7.0.0 */ @Deprecated public class Literal extends Directive { diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Macro.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Macro.java index 1c15e2c6a8..6d5ea84461 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Macro.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Macro.java @@ -33,7 +33,9 @@ package net.sourceforge.pmd.lang.vm.directive; * @author Geir Magnusson Jr. * @author Henning P. Schmiedehausen * @version $Id: Macro.java 746438 2009-02-21 05:41:24Z nbubna $ + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public class Macro extends Directive { /** * Return name of this directive. diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Parse.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Parse.java index 9aa23dfa05..f895292d74 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Parse.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Parse.java @@ -41,7 +41,9 @@ package net.sourceforge.pmd.lang.vm.directive; * @author Jason van Zyl * @author Christoph Reck * @version $Id: Parse.java 928253 2010-03-27 19:39:04Z nbubna $ + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public class Parse extends InputBase { /** diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/RuntimeMacro.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/RuntimeMacro.java index 2b2b513cb6..289ef617cd 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/RuntimeMacro.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/RuntimeMacro.java @@ -28,7 +28,9 @@ package net.sourceforge.pmd.lang.vm.directive; * rendered. * * @since 1.6 + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public class RuntimeMacro extends Directive { /** * Name of the macro diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Stop.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Stop.java index 83a92cb731..0bd325d7e4 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Stop.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/Stop.java @@ -24,7 +24,9 @@ package net.sourceforge.pmd.lang.vm.directive; * This class implements the #stop directive which allows a user to stop the * merging and rendering process. The #stop directive will accept a single * message argument with info about the reason for stopping. + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public class Stop extends Directive { /** diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/VelocimacroProxy.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/VelocimacroProxy.java index 5f1f79f2a9..503c122173 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/VelocimacroProxy.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/directive/VelocimacroProxy.java @@ -27,7 +27,9 @@ package net.sourceforge.pmd.lang.vm.directive; * * @author Geir Magnusson Jr. * @version $Id: VelocimacroProxy.java 898032 2010-01-11 19:51:03Z nbubna $ + * @deprecated for removal in PMD 7.0.0 */ +@Deprecated public class VelocimacroProxy extends Directive { private String macroName; private int numMacroArgs = 0; diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/util/DirectiveMapper.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/util/DirectiveMapper.java index 6b72a0d9a8..25f41aef25 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/util/DirectiveMapper.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/util/DirectiveMapper.java @@ -20,6 +20,10 @@ import net.sourceforge.pmd.lang.vm.directive.Macro; import net.sourceforge.pmd.lang.vm.directive.Parse; import net.sourceforge.pmd.lang.vm.directive.Stop; +/** + * @deprecated for removal in PMD 7.0.0 + */ +@Deprecated public final class DirectiveMapper { private DirectiveMapper() { } diff --git a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/util/LogUtil.java b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/util/LogUtil.java index 9a97f4ca6e..bb35427548 100644 --- a/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/util/LogUtil.java +++ b/pmd-vm/src/main/java/net/sourceforge/pmd/lang/vm/util/LogUtil.java @@ -31,7 +31,9 @@ import net.sourceforge.pmd.lang.vm.directive.Directive; * @author Nathan Bubna * @version $Id: Log.java 724825 2008-12-09 18:56:06Z nbubna $ * @since 1.5 + * @deprecated for removal with PMD 7.0.0 */ +@Deprecated public final class LogUtil { private LogUtil() { } diff --git a/pmd-xml/src/main/resources/category/pom/errorprone.xml b/pmd-xml/src/main/resources/category/pom/errorprone.xml index f3048a8884..d459a47a8c 100644 --- a/pmd-xml/src/main/resources/category/pom/errorprone.xml +++ b/pmd-xml/src/main/resources/category/pom/errorprone.xml @@ -90,7 +90,7 @@ By far the most common problem is the use of ${project.version} in a BOM or ... ... - ${project.dependency} + ${project.version} ]]> diff --git a/pom.xml b/pom.xml index 2ac484e86e..c3919ac196 100644 --- a/pom.xml +++ b/pom.xml @@ -92,7 +92,8 @@ 5.0 2.22.1 - 3.1.0 + 8.30 + 3.1.1 3.13.0 1.10.1 3.1.1 @@ -104,7 +105,7 @@ -Xmx512m -Dfile.encoding=${project.build.sourceEncoding} - 6-SNAPSHOT + 6 6.21.0 ${settings.localRepository}/net/java/dev/javacc/javacc/${javacc.version}/javacc-${javacc.version}.jar @@ -296,7 +297,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - ${checkstyle.version} + ${checkstyle.plugin.version} checkstyle-check @@ -310,7 +311,7 @@ com.puppycrawl.tools checkstyle - 8.29 + ${checkstyle.version} net.sourceforge.pmd @@ -531,7 +532,7 @@ org.apache.maven.plugins maven-checkstyle-plugin - ${checkstyle.version} + ${checkstyle.plugin.version} @@ -810,6 +811,18 @@ + + central + Central Repository + https://repo.maven.apache.org/maven2 + + true + never + + + false + + sonatype-nexus-snapshots Sonatype Nexus Snapshots @@ -821,14 +834,6 @@ true - - central - Central Repository - https://repo.maven.apache.org/maven2 - - false - - @@ -836,6 +841,7 @@ Central Repository https://repo.maven.apache.org/maven2 + true never @@ -854,8 +860,16 @@ + jcenter JCenter + + true + never + + + false + https://jcenter.bintray.com/