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