Merge branch 'master' into pmd/7.0.x

This commit is contained in:
Andreas Dangel 2021-01-16 19:29:09 +01:00
commit f27dc1bde5
4 changed files with 35 additions and 197 deletions

View File

@ -22,6 +22,7 @@ This is a {{ site.pmd.release_type }} release.
### Fixed Issues
* core
* [#2970](https://github.com/pmd/pmd/issues/2970): \[core] PMD 6.30.0 release is not reproducible
* [#2994](https://github.com/pmd/pmd/pull/2994): \[core] Fix code climate severity strings
* java-bestpractices
* [#575](https://github.com/pmd/pmd/issues/575): \[java] LiteralsFirstInComparisons should consider constant fields

View File

@ -121,11 +121,15 @@
Token-tracking behavior is implemented in the JJTree builder,
so the grammar should have TRACK_TOKEN=false; (this is the default value)
-->
<jjtree target="etc/grammar/${lang-name}.jjt"
outputdirectory="${target-package-dir}"
nodeusesparser="false"
nodepackage="${lang-ast-package}"
javacchome="${javacc-home.path}" />
<java fork="true"
classname="jjtree"
classpath="${javacc-home.path}/javacc.jar">
<sysproperty key="file.encoding" value="UTF-8" />
<arg value="-OUTPUT_DIRECTORY:${target-package-dir}" />
<arg value="-NODE_USES_PARSER:false" />
<arg value="-NODE_PACKAGE:${lang-ast-package}" />
<arg value="etc/grammar/${lang-name}.jjt" />
</java>
</target>
<target name="jjtree-ersatz" if="no-jjtree" unless="javaccBuildNotRequired">
@ -135,12 +139,16 @@
</target>
<target name="javacc" depends="jjtree" unless="javaccBuildNotRequired">
<javacc static="false"
usercharstream="true"
unicodeinput="true"
target="${target-package-dir}/${lang-name}.jj"
outputdirectory="${target-package-dir}"
javacchome="${javacc-home.path}" />
<java fork="true"
classname="javacc"
classpath="${javacc-home.path}/javacc.jar">
<sysproperty key="file.encoding" value="UTF-8" />
<arg value="-STATIC:false" />
<arg value="-USER_CHAR_STREAM:true" />
<arg value="-UNICODE_INPUT:true" />
<arg value="-OUTPUT_DIRECTORY:${target-package-dir}" />
<arg value="${target-package-dir}/${lang-name}.jj" />
</java>
</target>

View File

@ -41,15 +41,23 @@
<delete dir="${tmp-package.dir}" />
<mkdir dir="${tmp-package.dir}" />
<echo>Using JavaCC home: ${javacc-home.path}</echo>
<jjtree target="etc/grammar/dummy.jjt"
outputdirectory="${tmp-package.dir}"
javacchome="${javacc-home.path}" />
<java fork="true"
classname="jjtree"
classpath="${javacc-home.path}/javacc.jar">
<sysproperty key="file.encoding" value="UTF-8" />
<arg value="-OUTPUT_DIRECTORY:${tmp-package.dir}" />
<arg value="etc/grammar/dummy.jjt" />
</java>
<!-- Generate CharStream interface -->
<javacc usercharstream="true"
target="${tmp-package.dir}/dummy.jj"
outputdirectory="${tmp-package.dir}"
javacchome="${javacc-home.path}" />
<java fork="true"
classname="javacc"
classpath="${javacc-home.path}/javacc.jar">
<sysproperty key="file.encoding" value="UTF-8" />
<arg value="-USER_CHAR_STREAM:true" />
<arg value="-OUTPUT_DIRECTORY:${tmp-package.dir}" />
<arg value="${tmp-package.dir}/dummy.jj" />
</java>
<replace file="${tmp-package.dir}/CharStream.java"
token="interface"

View File

@ -1,179 +0,0 @@
<project name="pmd" default="alljavacc" basedir="../../">
<property name="javacc-home.path" value="target/lib" />
<target name="alljavacc"
description="Generates all JavaCC aspects within PMD"
depends="checkUpToDate,init,plsqljjtree,cleanup" />
<target name="checkUpToDate">
<uptodate property="javaccBuildNotRequired" targetfile="${target}/last-generated-timestamp">
<srcfiles dir="etc/grammar" includes="*.jj*"/>
</uptodate>
<echo message="up to date check: javaccBuildNotRequired=${javaccBuildNotRequired}"/>
</target>
<target name="init" unless="javaccBuildNotRequired">
<mkdir dir="${javacc-home.path}" />
<copy file="${javacc.jar}" tofile="${javacc-home.path}/javacc.jar" />
<mkdir dir="${target}"/>
<touch file="${target}/last-generated-timestamp"/>
</target>
<target name="cleanup">
<delete dir="${javacc-home.path}" />
</target>
<target name="plsqljjtree" description="Generates the PlSQL parser and AST source files" unless="javaccBuildNotRequired">
<delete dir="${target}/net/sourceforge/pmd/lang/plsql/ast" />
<mkdir dir="${target}/net/sourceforge/pmd/lang/plsql/ast" />
<jjtree target="etc/grammar/PldocAST.jjt"
outputdirectory="${target}/net/sourceforge/pmd/lang/plsql/ast"
javacchome="${javacc-home.path}" />
<!-- Ensure generated using CharStream interface -->
<javacc static="false"
target="${target}/net/sourceforge/pmd/lang/plsql/ast/PldocAST.jj"
outputdirectory="${target}/net/sourceforge/pmd/lang/plsql/ast"
javacchome="${javacc-home.path}" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/SimpleNode.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/Node.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/CharStream.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/TokenMgrError.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTArguments.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTComparisonCondition.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTCompoundCondition.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTDatatype.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTExtractExpression.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTFetchStatement.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTFormalParameter.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTIfStatement.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTInnerCrossJoinClause.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTInput.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTMethodDeclaration.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTMethodDeclarator.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTName.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTOuterJoinClause.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTOuterJoinType.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTInlineConstraint.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTOutOfLineConstraint.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTPackageBody.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTPackageSpecification.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTQueryBlock.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTPrimaryPrefix.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTPrimarySuffix.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTProgramUnit.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTRegexpLikeCondition.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTSelectIntoStatement.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTSelectStatement.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTSqlStatement.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTStringLiteral.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTSubqueryOperation.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTTriggerTimingPointSection.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTTriggerUnit.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTTypeMethod.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTTypeSpecification.java" />
<delete file="${target}/net/sourceforge/pmd/lang/plsql/ast/ASTVariableOrConstantDeclaratorId.java" />
<replace file="${target}/net/sourceforge/pmd/lang/plsql/ast/PLSQLParserVisitor.java"
token="SimpleNode"
value="PLSQLNode" />
<replace file="${target}/net/sourceforge/pmd/lang/plsql/ast/PLSQLParserTokenManager.java"
token="class PLSQLParserTokenManager"
value="class PLSQLParserTokenManager extends net.sourceforge.pmd.lang.ast.AbstractTokenManager" />
<replace file="${target}/net/sourceforge/pmd/lang/plsql/ast/JJTPLSQLParserState.java">
<replacetoken>public class</replacetoken>
<replacevalue><![CDATA[import net.sourceforge.pmd.lang.ast.Node;
public class]]></replacevalue>
</replace>
<replace file="${target}/net/sourceforge/pmd/lang/plsql/ast/ParseException.java"
token="extends Exception"
value="extends net.sourceforge.pmd.lang.ast.ParseException" />
<replace file="${target}/net/sourceforge/pmd/lang/plsql/ast/Token.java">
<replacetoken>public class Token implements java.io.Serializable</replacetoken>
<replacevalue><![CDATA[import net.sourceforge.pmd.lang.ast.GenericToken;
public class Token implements GenericToken, java.io.Serializable]]></replacevalue>
</replace>
<!--Add implementation methods of GenericToken-->
<replace file="${target}/net/sourceforge/pmd/lang/plsql/ast/Token.java">
<replacetoken>public Token specialToken;</replacetoken>
<replacevalue><![CDATA[public Token specialToken;
@Override
public GenericToken getNext() {
return next;
}
@Override
public GenericToken getPreviousComment() {
return specialToken;
}
@Override
public String getImage() {
return image;
}
@Override
public int getBeginLine() {
return beginLine;
}
@Override
public int getEndLine() {
return endLine;
}
@Override
public int getBeginColumn() {
return beginColumn;
}
@Override
public int getEndColumn() {
return endColumn;
}
]]></replacevalue>
</replace>
<replaceregexp>
<regexp pattern="public (?:class|interface)" />
<substitution expression="@Deprecated${line.separator}@net.sourceforge.pmd.annotation.InternalApi${line.separator}\0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/plsql/ast">
<exclude name="AST*.java" />
<exclude name="ParseException.java" />
<exclude name="*ParserVisitor.java"/>
</fileset>
</replaceregexp>
<replaceregexp>
<regexp pattern="(?m)\*/\s+(public class ParseException )" />
<substitution expression="*${line.separator} * @deprecated Use superclass {@link net.sourceforge.pmd.lang.ast.ParseException}${line.separator} */${line.separator}@Deprecated${line.separator}@net.sourceforge.pmd.annotation.InternalApi${line.separator}\1" />
<fileset file="${target}/net/sourceforge/pmd/lang/plsql/ast/ParseException.java"/>
</replaceregexp>
<!-- deprecate/internalize AST constructors -->
<replaceregexp>
<regexp pattern=" public AST\w+\(int id\) \{" />
<substitution expression=" @Deprecated${line.separator} @net.sourceforge.pmd.annotation.InternalApi${line.separator}\0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/plsql/ast">
<include name="AST*.java" />
</fileset>
</replaceregexp>
<replaceregexp>
<regexp pattern=" public AST\w+\(PLSQLParser p, int id\) \{" />
<substitution expression=" @Deprecated${line.separator} @net.sourceforge.pmd.annotation.InternalApi${line.separator}\0" />
<fileset dir="${target}/net/sourceforge/pmd/lang/plsql/ast">
<include name="AST*.java" />
</fileset>
</replaceregexp>
</target>
</project>