From cab260ed226c7f1e6d2526e62426f41e0608ad48 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Apr 2021 14:59:13 +0200 Subject: [PATCH 1/4] [javascript] Update Rhino library to 1.7.13 * Convert pmd-javascript to a java8 module * Fixes #699 * Fixes #2081 --- BUILDING.md | 3 ++- docs/pages/pmd/devdocs/building.md | 3 ++- docs/pages/pmd/userdocs/installation.md | 8 +++++++- docs/pages/release_notes.md | 11 +++++++++++ pmd-dist/pom.xml | 10 +++++----- .../net/sourceforge/pmd/it/BinaryDistributionIT.java | 6 +++--- pmd-javascript/pom.xml | 5 +++++ .../pmd/lang/ecmascript/ast/EcmascriptParserTest.java | 10 ++++++++++ pom.xml | 7 +------ 9 files changed, 46 insertions(+), 17 deletions(-) diff --git a/BUILDING.md b/BUILDING.md index 8654ec8953..6579e3ca2e 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -16,7 +16,8 @@ This will create the zip files in the directory `pmd-dist/target`: That's all ! -**Note:** While Java 11 is required for building, running PMD only requires Java 7 (or Java 8 for Apex and the Designer). +**Note:** While Java 11 is required for building, running PMD only requires Java 7 +(or Java 8 for Apex, JavaScript, Scala, Visualforce, and the Designer). **Note:** With PMD 6.24.0, we are creating [Reproducible Builds](https://reproducible-builds.org/). Since we use [Maven](https://maven.apache.org/guides/mini/guide-reproducible-builds.html) for building, the following diff --git a/docs/pages/pmd/devdocs/building.md b/docs/pages/pmd/devdocs/building.md index d9a7bcbc11..97196f2179 100644 --- a/docs/pages/pmd/devdocs/building.md +++ b/docs/pages/pmd/devdocs/building.md @@ -12,7 +12,8 @@ author: Tom Copeland, Xavier Le Vourch * JDK 11 or higher -{% include note.html content="While Java 11 is required for building, running PMD only requires Java 7 (or Java 8 for Apex, Scala, Visualforce, and the Designer)." %} +{% include note.html content="While Java 11 is required for building, running PMD only requires Java 7 +(or Java 8 for Apex, JavaScript, Scala, Visualforce, and the Designer)." %} You’ll need to either check out the source code or download the latest source release. Assuming you’ve got the latest source release, unzip it to a directory: diff --git a/docs/pages/pmd/userdocs/installation.md b/docs/pages/pmd/userdocs/installation.md index 7339d1b986..264b3dbdc0 100644 --- a/docs/pages/pmd/userdocs/installation.md +++ b/docs/pages/pmd/userdocs/installation.md @@ -11,7 +11,13 @@ sidebar: pmd_sidebar ### Requirements -* [Java JRE](http://www.oracle.com/technetwork/java/javase/downloads/index.html) 1.7 or higher +* [Java JRE](http://www.oracle.com/technetwork/java/javase/downloads/index.html), + OpenJDK from [Azul](https://www.azul.com/downloads/zulu-community/) + or [AdoptOpenJDK](https://adoptopenjdk.net/) 1.7 or higher. + + **Note:** For analyzing Apex, JavaScript, Scala or VisualForce or running the [Designer](pmd_userdocs_extending_designer_reference.html) + at least Java 8 is required. + * A zip archiver, e.g.: * For Windows: [Winzip](http://winzip.com) or the free [7-zip](http://www.7-zip.org/) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index b8f8783555..3dce1681cf 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -14,8 +14,19 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy +#### Javascript module now requires at least Java 8 + +The latest version of [Rhino](https://github.com/mozilla/rhino), the implementation of JavaScript we use +for parsing JavaScript code, requires at least Java 8. Therefore we decided to upgrade the pmd-javascript +module to Java 8 as well. This means, that from now on, a Java 8 or later runtime is required in order +to analyze JavaScript code. Note, that PMD core still stays the at Java 7. + ### Fixed Issues +* pmd-javascript + * [#699](https://github.com/pmd/pmd/issues/699): \[javascript] Update Rhino library to 1.7.13 + * [#2081](https://github.com/pmd/pmd/issues/2081): \[javascript] Failing with OutOfMemoryError parsing a Javascript file + ### API Changes ### External Contributions diff --git a/pmd-dist/pom.xml b/pmd-dist/pom.xml index 44c0ed3eb7..39a4eec1ff 100644 --- a/pmd-dist/pom.xml +++ b/pmd-dist/pom.xml @@ -138,11 +138,6 @@ pmd-java ${project.version} - - net.sourceforge.pmd - pmd-javascript - ${project.version} - net.sourceforge.pmd pmd-jsp @@ -249,6 +244,11 @@ pmd-apex ${project.version} + + net.sourceforge.pmd + pmd-javascript + ${project.version} + net.sourceforge.pmd pmd-scala_2.13 diff --git a/pmd-dist/src/test/java/net/sourceforge/pmd/it/BinaryDistributionIT.java b/pmd-dist/src/test/java/net/sourceforge/pmd/it/BinaryDistributionIT.java index d5bff3f134..f95dc88391 100644 --- a/pmd-dist/src/test/java/net/sourceforge/pmd/it/BinaryDistributionIT.java +++ b/pmd-dist/src/test/java/net/sourceforge/pmd/it/BinaryDistributionIT.java @@ -25,10 +25,10 @@ public class BinaryDistributionIT extends AbstractBinaryDistributionTest { private static final String SUPPORTED_LANGUAGES_PMD; static { - // note: apex, visualforce, and scala require java8 + // note: apex, javascript, visualforce, and scala require java8 if (PMDExecutor.isJava7Test()) { - SUPPORTED_LANGUAGES_CPD = "Supported languages: [cpp, cs, dart, ecmascript, fortran, go, groovy, java, jsp, kotlin, lua, matlab, modelica, objectivec, perl, php, plsql, python, ruby, swift, xml]"; - SUPPORTED_LANGUAGES_PMD = "ecmascript, java, jsp, modelica, plsql, pom, vm, wsdl, xml, xsl"; + SUPPORTED_LANGUAGES_CPD = "Supported languages: [cpp, cs, dart, fortran, go, groovy, java, jsp, kotlin, lua, matlab, modelica, objectivec, perl, php, plsql, python, ruby, swift, xml]"; + SUPPORTED_LANGUAGES_PMD = "java, jsp, modelica, plsql, pom, vm, wsdl, xml, xsl"; } else { SUPPORTED_LANGUAGES_CPD = "Supported languages: [apex, cpp, cs, dart, ecmascript, fortran, go, groovy, java, jsp, kotlin, lua, matlab, modelica, objectivec, perl, php, plsql, python, ruby, scala, swift, vf, xml]"; SUPPORTED_LANGUAGES_PMD = "apex, ecmascript, java, jsp, modelica, plsql, pom, scala, vf, vm, wsdl, xml, xsl"; diff --git a/pmd-javascript/pom.xml b/pmd-javascript/pom.xml index 589a819970..534a496f49 100644 --- a/pmd-javascript/pom.xml +++ b/pmd-javascript/pom.xml @@ -11,6 +11,10 @@ ../ + + 8 + + @@ -78,6 +82,7 @@ org.mozilla rhino + 1.7.13 commons-io diff --git a/pmd-javascript/src/test/java/net/sourceforge/pmd/lang/ecmascript/ast/EcmascriptParserTest.java b/pmd-javascript/src/test/java/net/sourceforge/pmd/lang/ecmascript/ast/EcmascriptParserTest.java index b4ee5913cf..f6fe15ce3f 100644 --- a/pmd-javascript/src/test/java/net/sourceforge/pmd/lang/ecmascript/ast/EcmascriptParserTest.java +++ b/pmd-javascript/src/test/java/net/sourceforge/pmd/lang/ecmascript/ast/EcmascriptParserTest.java @@ -6,6 +6,7 @@ package net.sourceforge.pmd.lang.ecmascript.ast; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import java.io.Reader; @@ -181,4 +182,13 @@ public class EcmascriptParserTest extends EcmascriptParserTestBase { ASTAssignment infix = rootNode.getFirstDescendantOfType(ASTAssignment.class); assertEquals("^=", infix.getImage()); } + + /** + * [javascript] Failing with OutOfMemoryError parsing a Javascript file #2081 + */ + @Test(timeout = 5000L) + public void shouldNotFailWithOutOfMemory() { + ASTAstRoot rootNode = js.parse("(``\n);"); + assertNotNull(rootNode); + } } diff --git a/pom.xml b/pom.xml index 068c80b77c..c03411d3e2 100644 --- a/pom.xml +++ b/pom.xml @@ -687,11 +687,6 @@ 9.1.0.8 dom - - org.mozilla - rhino - 1.7.7.2 - net.java.dev.javacc javacc @@ -1066,7 +1061,6 @@ pmd-groovy pmd-lua pmd-java - pmd-javascript pmd-jsp pmd-kotlin pmd-matlab @@ -1086,6 +1080,7 @@ pmd-apex-jorje pmd-apex pmd-java8 + pmd-javascript pmd-doc pmd-lang-test pmd-scala From 16e70bd8f6024fda39a9c082ad409cf3aab0ae7b Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Apr 2021 15:08:47 +0200 Subject: [PATCH 2/4] [javascript] Fix unit tests --- .../ast/testdata/jquery-selector.txt | 348 +++++++++++++----- 1 file changed, 251 insertions(+), 97 deletions(-) diff --git a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/jquery-selector.txt b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/jquery-selector.txt index 92588d6387..5ddb5321df 100644 --- a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/jquery-selector.txt +++ b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/jquery-selector.txt @@ -1,4 +1,5 @@ +- AstRoot + +- Comment +- EmptyStatement +- EmptyStatement +- EmptyStatement @@ -9,6 +10,7 @@ +- EmptyStatement +- EmptyStatement +- EmptyStatement + +- Comment +- EmptyStatement +- EmptyStatement +- EmptyStatement @@ -338,6 +340,7 @@ | | +- IfStatement | | | +- Name | | | +- Scope + | | | +- Comment | | | +- ReturnStatement | | | +- Name | | +- ReturnStatement @@ -451,6 +454,7 @@ | | +- InfixExpression | | +- Name | | +- ArrayLiteral + | +- Comment | +- IfStatement | | +- InfixExpression | | | +- InfixExpression @@ -491,6 +495,8 @@ | | +- IfStatement | | +- Name | | +- Scope + | | +- Comment + | | +- Comment | | +- IfStatement | | | +- InfixExpression | | | | +- InfixExpression @@ -505,6 +511,7 @@ | | | | | +- Name | | | | +- Name | | | +- Scope + | | | +- Comment | | | +- IfStatement | | | +- ParenthesizedExpression | | | | +- Assignment @@ -513,59 +520,62 @@ | | | | +- Name | | | | +- NumberLiteral | | | +- Scope + | | | | +- Comment | | | | +- IfStatement - | | | | +- InfixExpression - | | | | | +- Name - | | | | | +- NumberLiteral - | | | | +- Scope - | | | | | +- IfStatement - | | | | | | +- ParenthesizedExpression - | | | | | | | +- Assignment - | | | | | | | +- Name - | | | | | | | +- FunctionCall - | | | | | | | +- PropertyGet - | | | | | | | | +- Name - | | | | | | | | +- Name - | | | | | | | +- Name - | | | | | | +- Scope - | | | | | | +- ExpressionStatement - | | | | | | +- FunctionCall - | | | | | | +- PropertyGet - | | | | | | | +- Name - | | | | | | | +- Name - | | | | | | +- Name - | | | | | | +- Name - | | | | | +- ReturnStatement - | | | | | +- Name - | | | | +- Scope - | | | | +- IfStatement - | | | | +- InfixExpression - | | | | | +- Name - | | | | | +- InfixExpression - | | | | | +- ParenthesizedExpression - | | | | | | +- Assignment - | | | | | | +- Name - | | | | | | +- FunctionCall - | | | | | | +- PropertyGet - | | | | | | | +- Name - | | | | | | | +- Name - | | | | | | +- Name - | | | | | +- FunctionCall - | | | | | +- PropertyGet - | | | | | | +- Name - | | | | | | +- Name - | | | | | +- Name - | | | | | +- Name - | | | | +- Scope - | | | | +- ExpressionStatement - | | | | | +- FunctionCall - | | | | | +- PropertyGet - | | | | | | +- Name - | | | | | | +- Name - | | | | | +- Name - | | | | | +- Name - | | | | +- ReturnStatement - | | | | +- Name + | | | | | +- InfixExpression + | | | | | | +- Name + | | | | | | +- NumberLiteral + | | | | | +- Scope + | | | | | | +- IfStatement + | | | | | | | +- ParenthesizedExpression + | | | | | | | | +- Assignment + | | | | | | | | +- Name + | | | | | | | | +- FunctionCall + | | | | | | | | +- PropertyGet + | | | | | | | | | +- Name + | | | | | | | | | +- Name + | | | | | | | | +- Name + | | | | | | | +- Scope + | | | | | | | +- ExpressionStatement + | | | | | | | +- FunctionCall + | | | | | | | +- PropertyGet + | | | | | | | | +- Name + | | | | | | | | +- Name + | | | | | | | +- Name + | | | | | | | +- Name + | | | | | | +- ReturnStatement + | | | | | | | +- Name + | | | | | | +- Comment + | | | | | +- Scope + | | | | | +- IfStatement + | | | | | +- InfixExpression + | | | | | | +- Name + | | | | | | +- InfixExpression + | | | | | | +- ParenthesizedExpression + | | | | | | | +- Assignment + | | | | | | | +- Name + | | | | | | | +- FunctionCall + | | | | | | | +- PropertyGet + | | | | | | | | +- Name + | | | | | | | | +- Name + | | | | | | | +- Name + | | | | | | +- FunctionCall + | | | | | | +- PropertyGet + | | | | | | | +- Name + | | | | | | | +- Name + | | | | | | +- Name + | | | | | | +- Name + | | | | | +- Scope + | | | | | +- ExpressionStatement + | | | | | | +- FunctionCall + | | | | | | +- PropertyGet + | | | | | | | +- Name + | | | | | | | +- Name + | | | | | | +- Name + | | | | | | +- Name + | | | | | +- ReturnStatement + | | | | | +- Name + | | | | +- Comment | | | +- IfStatement | | | +- ElementGet | | | | +- Name @@ -583,7 +593,8 @@ | | | | | | +- Name | | | | | +- Name | | | | +- ReturnStatement - | | | | +- Name + | | | | | +- Name + | | | | +- Comment | | | +- IfStatement | | | +- InfixExpression | | | | +- ParenthesizedExpression @@ -636,6 +647,13 @@ | | | +- Assignment | | | +- Name | | | +- Name + | | +- Comment + | | +- Comment + | | +- Comment + | | +- Comment + | | +- Comment + | | +- Comment + | | +- Comment | | +- IfStatement | | | +- InfixExpression | | | | +- InfixExpression @@ -654,6 +672,7 @@ | | | | | +- Name | | | | +- Name | | | +- Scope + | | | +- Comment | | | +- ExpressionStatement | | | | +- Assignment | | | | +- Name @@ -670,6 +689,8 @@ | | | | | +- Name | | | | | +- Name | | | | +- Name + | | | +- Comment + | | | +- Comment | | | +- IfStatement | | | | +- InfixExpression | | | | | +- InfixExpression @@ -680,6 +701,7 @@ | | | | | +- Name | | | | | +- Name | | | | +- Scope + | | | | +- Comment | | | | +- IfStatement | | | | +- ParenthesizedExpression | | | | | +- Assignment @@ -800,6 +822,7 @@ | +- Name | +- Name | +- Name + +- Comment +- FunctionNode | +- Name | +- Block @@ -812,6 +835,7 @@ | | +- Name | | +- Name | | +- Block + | | +- Comment | | +- IfStatement | | | +- InfixExpression | | | | +- FunctionCall @@ -825,6 +849,7 @@ | | | | +- Name | | | | +- Name | | | +- Scope + | | | +- Comment | | | +- ExpressionStatement | | | +- UnaryExpression | | | +- ElementGet @@ -844,6 +869,7 @@ | | +- Name | +- ReturnStatement | +- Name + +- Comment +- FunctionNode | +- Name | +- Name @@ -856,6 +882,7 @@ | | +- KeywordLiteral | +- ReturnStatement | +- Name + +- Comment +- FunctionNode | +- Name | +- Name @@ -875,6 +902,7 @@ | | +- Name | | +- Name | +- Name + +- Comment +- FunctionNode | +- Name | +- Name @@ -900,19 +928,31 @@ | | +- Name | | +- Name | +- Name + +- Comment +- FunctionNode | +- Name | +- Name | +- Block + | +- Comment | +- ReturnStatement | +- FunctionNode | +- Name | +- Block + | +- Comment + | +- Comment + | +- Comment | +- IfStatement | | +- InfixExpression | | | +- StringLiteral | | | +- Name | | +- Scope + | | | +- Comment + | | | +- Comment + | | | +- Comment + | | | +- Comment + | | | +- Comment + | | | +- Comment + | | | +- Comment | | | +- IfStatement | | | | +- InfixExpression | | | | | +- PropertyGet @@ -924,6 +964,7 @@ | | | | | | +- Name | | | | | +- KeywordLiteral | | | | +- Scope + | | | | +- Comment | | | | +- IfStatement | | | | | +- InfixExpression | | | | | | +- StringLiteral @@ -971,11 +1012,14 @@ | | | | | +- Name | | | | +- Name | | | +- ReturnStatement - | | | +- InfixExpression - | | | +- PropertyGet - | | | | +- Name - | | | | +- Name - | | | +- Name + | | | | +- InfixExpression + | | | | +- PropertyGet + | | | | | +- Name + | | | | | +- Name + | | | | +- Name + | | | +- Comment + | | | +- Comment + | | | +- Comment | | +- IfStatement | | +- InfixExpression | | | +- StringLiteral @@ -989,6 +1033,7 @@ | | +- Name | +- ReturnStatement | +- KeywordLiteral + +- Comment +- FunctionNode | +- Name | +- Name @@ -1028,6 +1073,7 @@ | | +- PropertyGet | | +- Name | | +- Name + | +- Comment | +- WhileLoop | +- UnaryExpression | | +- Name @@ -1056,6 +1102,7 @@ | +- ElementGet | +- Name | +- Name + +- Comment +- FunctionNode | +- Name | +- Name @@ -1071,6 +1118,7 @@ | | | +- Name | | +- StringLiteral | +- Name + +- Comment +- FunctionNode | +- Name | +- Name @@ -1088,6 +1136,11 @@ | | | | +- Name | | | +- Name | | +- Name + | +- Comment + | +- Comment + | +- Comment + | +- Comment + | +- Comment | +- IfStatement | | +- InfixExpression | | | +- InfixExpression @@ -1119,6 +1172,12 @@ | | | +- Name | | | +- Name | | +- Name + | +- Comment + | +- Comment + | +- Comment + | +- Comment + | +- Comment + | +- Comment | +- IfStatement | +- InfixExpression | | +- InfixExpression @@ -1137,6 +1196,7 @@ | | | +- Name | | +- Name | +- Scope + | +- Comment | +- ExpressionStatement | +- FunctionCall | +- PropertyGet @@ -1288,11 +1348,12 @@ | | | | +- StringLiteral | | | +- Scope | | | | +- ReturnStatement - | | | | +- FunctionCall - | | | | +- PropertyGet - | | | | | +- Name - | | | | | +- Name - | | | | +- Name + | | | | | +- FunctionCall + | | | | | +- PropertyGet + | | | | | | +- Name + | | | | | | +- Name + | | | | | +- Name + | | | | +- Comment | | | +- Scope | | | +- ReturnStatement | | | +- FunctionCall @@ -1376,6 +1437,7 @@ | | | | | +- Name | | | | +- Name | | | | +- Name + | | | +- Comment | | | +- ExpressionStatement | | | | +- Assignment | | | | +- ElementGet @@ -1431,6 +1493,7 @@ | | | +- FunctionNode | | | +- Name | | | +- Block + | | | +- Comment | | | +- ExpressionStatement | | | | +- Assignment | | | | +- ElementGet @@ -1454,6 +1517,7 @@ | | | | | | +- NumberLiteral | | | | | +- StringLiteral | | | | +- Scope + | | | | | +- Comment | | | | | +- IfStatement | | | | | | +- UnaryExpression | | | | | | | +- ElementGet @@ -1502,26 +1566,27 @@ | | | | | | | +- NumberLiteral | | | | | | +- StringLiteral | | | | | +- ExpressionStatement - | | | | | +- Assignment - | | | | | +- ElementGet - | | | | | | +- Name - | | | | | | +- NumberLiteral - | | | | | +- UnaryExpression - | | | | | +- ParenthesizedExpression - | | | | | +- InfixExpression - | | | | | +- ParenthesizedExpression - | | | | | | +- InfixExpression - | | | | | | +- ElementGet - | | | | | | | +- Name - | | | | | | | +- NumberLiteral - | | | | | | +- ElementGet - | | | | | | +- Name - | | | | | | +- NumberLiteral - | | | | | +- InfixExpression - | | | | | +- ElementGet - | | | | | | +- Name - | | | | | | +- NumberLiteral - | | | | | +- StringLiteral + | | | | | | +- Assignment + | | | | | | +- ElementGet + | | | | | | | +- Name + | | | | | | | +- NumberLiteral + | | | | | | +- UnaryExpression + | | | | | | +- ParenthesizedExpression + | | | | | | +- InfixExpression + | | | | | | +- ParenthesizedExpression + | | | | | | | +- InfixExpression + | | | | | | | +- ElementGet + | | | | | | | | +- Name + | | | | | | | | +- NumberLiteral + | | | | | | | +- ElementGet + | | | | | | | +- Name + | | | | | | | +- NumberLiteral + | | | | | | +- InfixExpression + | | | | | | +- ElementGet + | | | | | | | +- Name + | | | | | | | +- NumberLiteral + | | | | | | +- StringLiteral + | | | | | +- Comment | | | | +- IfStatement | | | | +- ElementGet | | | | | +- Name @@ -1572,19 +1637,20 @@ | | | | +- NumberLiteral | | | +- Scope | | | | +- ExpressionStatement - | | | | +- Assignment - | | | | +- ElementGet - | | | | | +- Name - | | | | | +- NumberLiteral - | | | | +- InfixExpression - | | | | +- ElementGet - | | | | | +- Name - | | | | | +- NumberLiteral - | | | | +- InfixExpression - | | | | +- ElementGet - | | | | | +- Name - | | | | | +- NumberLiteral - | | | | +- StringLiteral + | | | | | +- Assignment + | | | | | +- ElementGet + | | | | | | +- Name + | | | | | | +- NumberLiteral + | | | | | +- InfixExpression + | | | | | +- ElementGet + | | | | | | +- Name + | | | | | | +- NumberLiteral + | | | | | +- InfixExpression + | | | | | +- ElementGet + | | | | | | +- Name + | | | | | | +- NumberLiteral + | | | | | +- StringLiteral + | | | | +- Comment | | | +- IfStatement | | | +- InfixExpression | | | | +- Name @@ -1620,6 +1686,7 @@ | | | | +- Name | | | | +- Name | | | +- Scope + | | | +- Comment | | | +- ExpressionStatement | | | | +- Assignment | | | | +- ElementGet @@ -2046,6 +2113,7 @@ | | | +- IfStatement | | | +- Name | | | +- Scope + | | | +- Comment | | | +- IfStatement | | | | +- Name | | | | +- Scope @@ -2079,6 +2147,7 @@ | | | | | | +- Scope | | | | | | +- ReturnStatement | | | | | | +- KeywordLiteral + | | | | | +- Comment | | | | | +- ExpressionStatement | | | | | +- Assignment | | | | | +- Name @@ -2106,11 +2175,13 @@ | | | | +- PropertyGet | | | | +- Name | | | | +- Name + | | | +- Comment | | | +- IfStatement | | | | +- InfixExpression | | | | | +- Name | | | | | +- Name | | | | +- Scope + | | | | | +- Comment | | | | | +- ExpressionStatement | | | | | | +- Assignment | | | | | | +- Name @@ -2187,6 +2258,7 @@ | | | | | | +- Name | | | | | | +- Name | | | | | +- Scope + | | | | | +- Comment | | | | | +- IfStatement | | | | | +- InfixExpression | | | | | | +- InfixExpression @@ -2212,6 +2284,7 @@ | | | | | | +- Name | | | | | +- BreakStatement | | | | +- Scope + | | | | +- Comment | | | | +- IfStatement | | | | | +- Name | | | | | +- Scope @@ -2257,6 +2330,7 @@ | | | | | +- Name | | | | | +- KeywordLiteral | | | | +- Scope + | | | | +- Comment | | | | +- WhileLoop | | | | +- ParenthesizedExpression | | | | | +- Assignment @@ -2299,6 +2373,7 @@ | | | | | +- UnaryExpression | | | | | +- Name | | | | +- Scope + | | | | +- Comment | | | | +- IfStatement | | | | | +- Name | | | | | +- Scope @@ -2329,6 +2404,7 @@ | | | | | +- Name | | | | +- Scope | | | | +- BreakStatement + | | | +- Comment | | | +- ExpressionStatement | | | | +- Assignment | | | | +- Name @@ -2356,6 +2432,10 @@ | | +- Name | | +- Name | | +- Block + | | +- Comment + | | +- Comment + | | +- Comment + | | +- Comment | | +- VariableDeclaration | | | +- VariableInitializer | | | | +- Name @@ -2381,6 +2461,9 @@ | | | +- InfixExpression | | | +- StringLiteral | | | +- Name + | | +- Comment + | | +- Comment + | | +- Comment | | +- IfStatement | | | +- ElementGet | | | | +- Name @@ -2487,6 +2570,9 @@ | | +- FunctionNode | | +- Name | | +- Block + | | +- Comment + | | +- Comment + | | +- Comment | | +- VariableDeclaration | | | +- VariableInitializer | | | | +- Name @@ -2533,6 +2619,7 @@ | | | | +- PropertyGet | | | | +- Name | | | | +- Name + | | | +- Comment | | | +- WhileLoop | | | +- UnaryExpression | | | | +- Name @@ -2575,6 +2662,7 @@ | | | +- KeywordLiteral | | | +- Name | | | +- Name + | | +- Comment | | +- ExpressionStatement | | | +- Assignment | | | +- ElementGet @@ -2652,6 +2740,7 @@ | | +- FunctionNode | | +- Name | | +- Block + | | +- Comment | | +- IfStatement | | | +- UnaryExpression | | | | +- FunctionCall @@ -2830,6 +2919,8 @@ | | +- FunctionNode | | +- Name | | +- Block + | | +- Comment + | | +- Comment | | +- ReturnStatement | | +- InfixExpression | | +- ParenthesizedExpression @@ -2859,11 +2950,16 @@ | | +- FunctionNode | | +- Name | | +- Block + | | +- Comment + | | +- Comment + | | +- Comment + | | +- Comment | | +- IfStatement | | | +- PropertyGet | | | | +- Name | | | | +- Name | | | +- Scope + | | | +- Comment | | | +- ExpressionStatement | | | +- PropertyGet | | | +- PropertyGet @@ -2881,6 +2977,10 @@ | | +- FunctionNode | | +- Name | | +- Block + | | +- Comment + | | +- Comment + | | +- Comment + | | +- Comment | | +- ForLoop | | | +- Assignment | | | | +- Name @@ -3182,6 +3282,7 @@ | | +- Name | | +- Name | +- Name + +- Comment +- ForInLoop | +- Name | +- ObjectLiteral @@ -3231,6 +3332,7 @@ | +- FunctionCall | +- Name | +- Name + +- Comment +- FunctionNode | +- Name | +- Block @@ -3309,6 +3411,7 @@ | +- WhileLoop | | +- Name | | +- Scope + | | +- Comment | | +- IfStatement | | | +- InfixExpression | | | | +- UnaryExpression @@ -3325,6 +3428,7 @@ | | | +- IfStatement | | | | +- Name | | | | +- Scope + | | | | +- Comment | | | | +- ExpressionStatement | | | | +- Assignment | | | | +- Name @@ -3352,6 +3456,7 @@ | | | +- Assignment | | | +- Name | | | +- KeywordLiteral + | | +- Comment | | +- IfStatement | | | +- ParenthesizedExpression | | | | +- Assignment @@ -3468,6 +3573,9 @@ | | | +- Name | | +- Scope | | +- BreakStatement + | +- Comment + | +- Comment + | +- Comment | +- IfStatement | | +- Name | | +- Scope @@ -3606,6 +3714,7 @@ | | +- ArrayLiteral | | +- Name | | +- Name + | +- Comment | +- IfStatement | | +- Name | | +- Scope @@ -3702,6 +3811,7 @@ | | | | +- NumberLiteral | | | +- Name | | +- Scope + | | | +- Comment | | | +- ReturnStatement | | | +- ParenthesizedExpression | | | +- Assignment @@ -3712,12 +3822,14 @@ | | | +- Name | | | +- NumberLiteral | | +- Scope + | | +- Comment | | +- ExpressionStatement | | | +- Assignment | | | +- ElementGet | | | | +- Name | | | | +- Name | | | +- Name + | | +- Comment | | +- IfStatement | | +- ParenthesizedExpression | | | +- Assignment @@ -3985,6 +4097,8 @@ | +- IfStatement | | +- Name | | +- Scope + | | | +- Comment + | | | +- Comment | | | +- ExpressionStatement | | | | +- Assignment | | | | +- Name @@ -4000,6 +4114,7 @@ | | | | | +- Name | | | | +- ArrayLiteral | | | | +- Name + | | | +- Comment | | | +- ExpressionStatement | | | +- FunctionCall | | | +- Name @@ -4012,6 +4127,7 @@ | | +- Assignment | | +- Name | | +- Name + | +- Comment | +- IfStatement | | +- Name | | +- Scope @@ -4029,6 +4145,7 @@ | | | +- ArrayLiteral | | | +- Name | | | +- Name + | | +- Comment | | +- ExpressionStatement | | | +- Assignment | | | +- Name @@ -4074,6 +4191,7 @@ | | +- IfStatement | | | +- Name | | | +- Scope + | | | +- Comment | | | +- ExpressionStatement | | | | +- Assignment | | | | +- Name @@ -4096,6 +4214,7 @@ | | | | | +- Name | | | | | +- Name | | | | +- Scope + | | | | +- Comment | | | | +- ExpressionStatement | | | | +- FunctionCall | | | | +- PropertyGet @@ -4316,6 +4435,7 @@ | | | +- Name | | | +- Name | | | +- Name + | | +- Comment | | +- ExpressionStatement | | | +- Assignment | | | +- Name @@ -4376,11 +4496,13 @@ | | | | +- Name | | | | +- Name | | | +- Name + | | +- Comment | | +- IfStatement | | | +- ElementGet | | | | +- Name | | | | +- Name | | | +- Scope + | | | +- Comment | | | +- ExpressionStatement | | | | +- Assignment | | | | +- Name @@ -4583,6 +4705,10 @@ | | +- IfStatement | | | +- Name | | | +- Scope + | | | +- Comment + | | | +- Comment + | | | +- Comment + | | | +- Comment | | | +- ExpressionStatement | | | +- Assignment | | | +- Name @@ -4615,6 +4741,10 @@ | | | | | +- Assignment | | | | | +- Name | | | | | +- NumberLiteral + | | | | +- Comment + | | | | +- Comment + | | | | +- Comment + | | | | +- Comment | | | | +- IfStatement | | | | | +- InfixExpression | | | | | | +- UnaryExpression @@ -4670,6 +4800,7 @@ | | | +- IfStatement | | | +- Name | | | +- Scope + | | | +- Comment | | | +- IfStatement | | | | +- ParenthesizedExpression | | | | | +- Assignment @@ -4691,10 +4822,19 @@ | | | | +- Name | | | | +- Name | | | +- Name + | | +- Comment + | | +- Comment | | +- ExpressionStatement | | | +- Assignment | | | +- Name | | | +- Name + | | +- Comment + | | +- Comment + | | +- Comment + | | +- Comment + | | +- Comment + | | +- Comment + | | +- Comment | | +- IfStatement | | | +- InfixExpression | | | | +- Name @@ -4725,6 +4865,7 @@ | | | +- IfStatement | | | | +- Name | | | | +- Scope + | | | | +- Comment | | | | +- IfStatement | | | | | +- InfixExpression | | | | | | +- Name @@ -4768,6 +4909,7 @@ | | | | | +- Name | | | | +- Name | | | | +- Name + | | | +- Comment | | | +- IfStatement | | | +- InfixExpression | | | | +- Name @@ -4840,6 +4982,7 @@ | | +- UnaryExpression | | | +- Name | | +- Scope + | | +- Comment | | +- IfStatement | | | +- UnaryExpression | | | | +- Name @@ -4886,6 +5029,7 @@ | | | | +- Name | | | | +- Name | | | +- Name + | | +- Comment | | +- ExpressionStatement | | | +- Assignment | | | +- Name @@ -4896,6 +5040,7 @@ | | | +- Name | | | +- Name | | | +- Name + | | +- Comment | | +- ExpressionStatement | | +- Assignment | | +- PropertyGet @@ -4904,6 +5049,7 @@ | | +- Name | +- ReturnStatement | +- Name + +- Comment +- FunctionNode | +- Name | +- Name @@ -4951,6 +5097,8 @@ | | +- InfixExpression | | +- Name | | +- ArrayLiteral + | +- Comment + | +- Comment | +- IfStatement | | +- InfixExpression | | | +- PropertyGet @@ -4958,6 +5106,7 @@ | | | | +- Name | | | +- NumberLiteral | | +- Scope + | | +- Comment | | +- ExpressionStatement | | | +- Assignment | | | +- Name @@ -5038,7 +5187,8 @@ | | | | | +- Name | | | | +- Scope | | | | | +- ReturnStatement - | | | | | +- Name + | | | | | | +- Name + | | | | | +- Comment | | | | +- IfStatement | | | | +- Name | | | | +- Scope @@ -5088,6 +5238,7 @@ | | | +- ElementGet | | | +- Name | | | +- Name + | | +- Comment | | +- IfStatement | | | +- ElementGet | | | | +- PropertyGet @@ -5111,6 +5262,7 @@ | | | | +- Name | | | +- Name | | +- Scope + | | +- Comment | | +- IfStatement | | +- ParenthesizedExpression | | | +- Assignment @@ -5145,6 +5297,7 @@ | | | | +- Name | | | +- Name | | +- Scope + | | +- Comment | | +- ExpressionStatement | | | +- FunctionCall | | | +- PropertyGet @@ -5208,6 +5361,7 @@ | | +- Name | +- ReturnStatement | +- Name + +- Comment +- ExpressionStatement | +- FunctionCall | +- Name From 1081448e5d71a28407cbc06b65be6422ef44f3ea Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 29 Apr 2021 15:13:04 +0200 Subject: [PATCH 3/4] [pmd-dist] Exclude javascript in java7 AllRules integration test --- pmd-dist/src/test/java/net/sourceforge/pmd/it/AllRulesIT.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pmd-dist/src/test/java/net/sourceforge/pmd/it/AllRulesIT.java b/pmd-dist/src/test/java/net/sourceforge/pmd/it/AllRulesIT.java index 8ba9e0533f..4f9a38ff0f 100644 --- a/pmd-dist/src/test/java/net/sourceforge/pmd/it/AllRulesIT.java +++ b/pmd-dist/src/test/java/net/sourceforge/pmd/it/AllRulesIT.java @@ -22,8 +22,8 @@ public class AllRulesIT extends AbstractBinaryDistributionTest { @Parameters public static Iterable languagesToTest() { if (PMDExecutor.isJava7Test()) { - // note: apex, scala, and visualforce require java8 - return Arrays.asList("java", "javascript", "jsp", "modelica", + // note: apex, javascript, scala, and visualforce require java8 + return Arrays.asList("java", "jsp", "modelica", "plsql", "pom", "velocitytemplate", "xml", "xsl"); } // note: scala and wsdl have no rules From a64077f10cc0fe14e5585acc9e12fc7d62c5d78a Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 21 May 2021 11:00:48 +0200 Subject: [PATCH 4/4] Apply suggestions from code review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clément Fournier --- docs/pages/release_notes.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 3dce1681cf..08e22c7c46 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -18,8 +18,8 @@ This is a {{ site.pmd.release_type }} release. The latest version of [Rhino](https://github.com/mozilla/rhino), the implementation of JavaScript we use for parsing JavaScript code, requires at least Java 8. Therefore we decided to upgrade the pmd-javascript -module to Java 8 as well. This means, that from now on, a Java 8 or later runtime is required in order -to analyze JavaScript code. Note, that PMD core still stays the at Java 7. +module to Java 8 as well. This means that from now on, a Java 8 or later runtime is required in order +to analyze JavaScript code. Note that PMD core still only requires Java 7. ### Fixed Issues @@ -32,4 +32,3 @@ to analyze JavaScript code. Note, that PMD core still stays the at Java 7. ### External Contributions {% endtocmaker %} -