From b9737e23b5a71b68a4135257e6bb10797cb16d52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 14 Oct 2022 23:34:52 -0300 Subject: [PATCH 01/34] Backport to PMD6 changes to accomodate PicoCli in PMD7 - Companion PR for #4059 - Add deprecations and path the way for the upcoming changes to the CLI in PMD7 --- .../main/java/net/sourceforge/pmd/PMD.java | 5 + .../net/sourceforge/pmd/PMDConfiguration.java | 172 ++++++++++++++++-- .../sourceforge/pmd/cli/PMDParameters.java | 26 +++ .../pmd/cli/PmdParametersParseResult.java | 7 + .../java/net/sourceforge/pmd/cpd/CPD.java | 8 + .../pmd/cpd/CPDCommandLineInterface.java | 1 + .../sourceforge/pmd/cpd/CPDConfiguration.java | 6 +- pmd-dist/src/main/resources/scripts/run.sh | 14 +- 8 files changed, 216 insertions(+), 23 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java b/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java index 7c3ab37f96c..632761e0029 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/PMD.java @@ -60,7 +60,10 @@ * *

Warning: This class is not intended to be instantiated or subclassed. It will * be made final in PMD7. + * + * @deprecated This class is to be removed in PMD 7 in favor of a unified PmdCli entry point. {@link PmdAnalysis} should be used for non-CLI use-cases. */ +@Deprecated public class PMD { @@ -539,7 +542,9 @@ public static StatusCode runPmd(PMDConfiguration configuration) { * Represents status codes that are used as exit codes during CLI runs. * * @see #runPmd(String[]) + * @deprecated This class is to be removed in PMD 7 in favor of a unified PmdCli entry point. */ + @Deprecated public enum StatusCode { /** No errors, no violations. This is exit code {@code 0}. */ OK(0), diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PMDConfiguration.java b/pmd-core/src/main/java/net/sourceforge/pmd/PMDConfiguration.java index ad3b9603c1a..e25b657363a 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/PMDConfiguration.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/PMDConfiguration.java @@ -6,6 +6,9 @@ import java.io.File; import java.io.IOException; +import java.net.URI; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -103,21 +106,23 @@ public class PMDConfiguration extends AbstractConfiguration { // Rule and source file options private List ruleSets = new ArrayList<>(); private RulePriority minimumPriority = RulePriority.LOW; - private List inputPaths = new ArrayList<>(); - private String inputUri; - private String inputFilePath; - private String ignoreFilePath; + private List inputPaths = new ArrayList<>(); + private URI inputUri; + private Path inputFilePath; + private Path ignoreFilePath; private boolean ruleSetFactoryCompatibilityEnabled = true; // Reporting options private String reportFormat; - private String reportFile; + private Path reportFile; private boolean reportShortNames = false; private Properties reportProperties = new Properties(); private boolean showSuppressedViolations = false; private boolean failOnViolation = true; + @Deprecated private boolean stressTest; + @Deprecated private boolean benchmark; private AnalysisCache analysisCache = new NoopAnalysisCache(); private boolean ignoreIncrementalAnalysis; @@ -433,8 +438,24 @@ public String getInputPaths() { * Returns an unmodifiable list. * * @throws NullPointerException If the parameter is null + * @deprecated Use {@link #getInputPathList()} */ + @Deprecated public List getAllInputPaths() { + final List ret = new ArrayList<>(inputPaths.size()); + for (final Path p : inputPaths) { + ret.add(p.toString()); + } + + return Collections.unmodifiableList(ret); + } + + /** + * Returns an unmodifiable list. + * + * @throws NullPointerException If the parameter is null + */ + public List getInputPathList() { return Collections.unmodifiableList(inputPaths); } @@ -448,16 +469,32 @@ public List getAllInputPaths() { */ @Deprecated public void setInputPaths(String inputPaths) { - List paths = new ArrayList<>(); - Collections.addAll(paths, inputPaths.split(",")); + List paths = new ArrayList<>(); + for (String s : inputPaths.split(",")) { + paths.add(Paths.get(s)); + } this.inputPaths = paths; } /** * Set the input paths to the given list of paths. * @throws NullPointerException If the parameter is null + * @deprecated Use {@link #setInputPathList(List)} */ + @Deprecated public void setInputPaths(List inputPaths) { + final List paths = new ArrayList<>(inputPaths.size()); + for (String s : inputPaths) { + paths.add(Paths.get(s)); + } + this.inputPaths = paths; + } + + /** + * Set the input paths to the given list of paths. + * @throws NullPointerException If the parameter is null + */ + public void setInputPathList(final List inputPaths) { this.inputPaths = new ArrayList<>(inputPaths); } @@ -465,17 +502,45 @@ public void setInputPaths(List inputPaths) { * Add an input path. It is not split on commas. * * @throws NullPointerException If the parameter is null + * @deprecated Use {@link #addInputPath(Path)} */ + @Deprecated public void addInputPath(String inputPath) { + Objects.requireNonNull(inputPath); + this.inputPaths.add(Paths.get(inputPath)); + } + + /** + * Add an input path. It is not split on commas. + * + * @throws NullPointerException If the parameter is null + */ + public void addInputPath(Path inputPath) { Objects.requireNonNull(inputPath); this.inputPaths.add(inputPath); } + /** + * @deprecated Use {@link #getInputFile()} + */ + @Deprecated public String getInputFilePath() { + return inputFilePath.toString(); + } + + public Path getInputFile() { return inputFilePath; } + /** + * @deprecated Use {@link #getIgnoreFile()} + */ + @Deprecated public String getIgnoreFilePath() { + return ignoreFilePath.toString(); + } + + public Path getIgnoreFile() { return ignoreFilePath; } @@ -483,10 +548,21 @@ public String getIgnoreFilePath() { * The input file path points to a single file, which contains a * comma-separated list of source file names to process. * - * @param inputFilePath - * path to the file + * @param inputFilePath path to the file + * @deprecated Use {@link #setInputFilePath(Path)} */ + @Deprecated public void setInputFilePath(String inputFilePath) { + this.inputFilePath = inputFilePath == null ? null : Paths.get(inputFilePath); + } + + /** + * The input file path points to a single file, which contains a + * comma-separated list of source file names to process. + * + * @param inputFilePath path to the file + */ + public void setInputFilePath(Path inputFilePath) { this.inputFilePath = inputFilePath; } @@ -494,10 +570,21 @@ public void setInputFilePath(String inputFilePath) { * The input file path points to a single file, which contains a * comma-separated list of source file names to ignore. * - * @param ignoreFilePath - * path to the file + * @param ignoreFilePath path to the file + * @deprecated Use {@link #setIgnoreFilePath(Path)} */ + @Deprecated public void setIgnoreFilePath(String ignoreFilePath) { + this.ignoreFilePath = ignoreFilePath == null ? null : Paths.get(ignoreFilePath); + } + + /** + * The input file path points to a single file, which contains a + * comma-separated list of source file names to ignore. + * + * @param ignoreFilePath path to the file + */ + public void setIgnoreFilePath(Path ignoreFilePath) { this.ignoreFilePath = ignoreFilePath; } @@ -505,18 +592,39 @@ public void setIgnoreFilePath(String ignoreFilePath) { * Get the input URI to process for source code objects. * * @return URI + * @deprecated Use {@link #getUri} */ + @Deprecated public String getInputUri() { + return inputUri.toString(); + } + + /** + * Get the input URI to process for source code objects. + * + * @return URI + */ + public URI getUri() { return inputUri; } /** * Set the input URI to process for source code objects. * - * @param inputUri - * a single URI + * @param inputUri a single URI + * @deprecated Use {@link PMDConfiguration#setInputUri(URI)} */ + @Deprecated public void setInputUri(String inputUri) { + this.inputUri = inputUri == null ? null : URI.create(inputUri); + } + + /** + * Set the input URI to process for source code objects. + * + * @param inputUri a single URI + */ + public void setInputUri(URI inputUri) { this.inputUri = inputUri; } @@ -562,10 +670,10 @@ public Renderer createRenderer(boolean withReportWriter) { Renderer renderer = RendererFactory.createRenderer(reportFormat, reportProperties); renderer.setShowSuppressedViolations(showSuppressedViolations); if (reportShortNames && inputPaths != null) { - renderer.setUseShortNames(Collections.unmodifiableList(new ArrayList<>(inputPaths))); + renderer.setUseShortNames(getAllInputPaths()); } if (withReportWriter) { - renderer.setReportFile(reportFile); + renderer.setReportFile(getReportFile()); } return renderer; } @@ -595,18 +703,39 @@ public void setReportFormat(String reportFormat) { * Get the file to which the report should render. * * @return The file to which to render. + * @deprecated Use {@link #getReportFilePath()} */ + @Deprecated public String getReportFile() { + return reportFile.toString(); + } + + /** + * Get the file to which the report should render. + * + * @return The file to which to render. + */ + public Path getReportFilePath() { return reportFile; } /** * Set the file to which the report should render. * - * @param reportFile - * the file to set + * @param reportFile the file to set + * @deprecated Use {@link #setReportFile(Path)} */ + @Deprecated public void setReportFile(String reportFile) { + this.reportFile = reportFile == null ? null : Paths.get(reportFile); + } + + /** + * Set the file to which the report should render. + * + * @param reportFile the file to set + */ + public void setReportFile(Path reportFile) { this.reportFile = reportFile; } @@ -657,7 +786,10 @@ public void setReportProperties(Properties reportProperties) { * * @return true if stress test is enbaled, false * otherwise. + * + * @deprecated For removal */ + @Deprecated public boolean isStressTest() { return stressTest; } @@ -668,7 +800,9 @@ public boolean isStressTest() { * @param stressTest * The stree test indicator to set. * @see #isStressTest() + * @deprecated For removal. */ + @Deprecated public void setStressTest(boolean stressTest) { this.stressTest = stressTest; } @@ -679,7 +813,9 @@ public void setStressTest(boolean stressTest) { * * @return true if benchmark logging is enbaled, * false otherwise. + * @deprecated This behavior is down to CLI, not part of the core analysis. */ + @Deprecated public boolean isBenchmark() { return benchmark; } @@ -690,7 +826,9 @@ public boolean isBenchmark() { * @param benchmark * The benchmark indicator to set. * @see #isBenchmark() + * @deprecated This behavior is down to CLI, not part of the core analysis. */ + @Deprecated public void setBenchmark(boolean benchmark) { this.benchmark = benchmark; } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java index 6b1888db545..b2a39a2a656 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PMDParameters.java @@ -14,6 +14,7 @@ import net.sourceforge.pmd.PMDConfiguration; import net.sourceforge.pmd.RulePriority; import net.sourceforge.pmd.annotation.InternalApi; +import net.sourceforge.pmd.lang.Language; import net.sourceforge.pmd.lang.LanguageRegistry; import net.sourceforge.pmd.lang.LanguageVersion; @@ -163,6 +164,9 @@ public class PMDParameters { @Parameter(names = { "--no-cache", "-no-cache" }, description = "Explicitly disable incremental analysis. The '-cache' option is ignored if this switch is present in the command line.") private boolean noCache = false; + @Parameter(names = "--use-version", description = "The language version PMD should use when parsing source code in the language-version format, ie: 'java-1.8'") + private List languageVersions = new ArrayList<>(); + // this has to be a public static class, so that JCommander can use it! public static class PropertyConverter implements IStringConverter { @@ -258,6 +262,24 @@ public PMDConfiguration toConfiguration() { configuration.getLanguageVersionDiscoverer().setDefaultLanguageVersion(languageVersion); } + for (String langVerStr : this.getLanguageVersions()) { + int dashPos = langVerStr.indexOf('-'); + if (dashPos == -1) { + throw new IllegalArgumentException("Invalid language version: " + langVerStr); + } + String langStr = langVerStr.substring(0, dashPos); + String verStr = langVerStr.substring(dashPos + 1); + Language lang = LanguageRegistry.findLanguageByTerseName(langStr); + LanguageVersion langVer = null; + if (lang != null) { + langVer = lang.getVersion(verStr); + } + if (lang == null || langVer == null) { + throw new IllegalArgumentException("Invalid language version: " + langVerStr); + } + configuration.getLanguageVersionDiscoverer().setDefaultLanguageVersion(langVer); + } + try { configuration.prependAuxClasspath(this.getAuxclasspath()); } catch (IllegalArgumentException e) { @@ -348,6 +370,10 @@ public String getLanguage() { return language != null ? language : LanguageRegistry.getDefaultLanguage().getTerseName(); } + public List getLanguageVersions() { + return languageVersions; + } + public String getForceLanguage() { return forceLanguage != null ? forceLanguage : ""; } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PmdParametersParseResult.java b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PmdParametersParseResult.java index 2f863ba4d9d..f38d6919390 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cli/PmdParametersParseResult.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cli/PmdParametersParseResult.java @@ -166,6 +166,13 @@ private static Map filterDeprecatedOptions(String... args) { m.put("-norulesetcompatibility", "--no-ruleset-compatibility"); m.put("-cache", "--cache"); m.put("-no-cache", "--no-cache"); + m.put("-v", "--use-version"); // In PMD 7, -v will enable verbose mode + m.put("-V", "--verbose"); // In PMD 7, -V will show the tool version + m.put("-min", "--minimum-priority"); + m.put("-version", "--use-version"); + m.put("-language", "--use-version"); + m.put("-l", "--use-version"); + SUGGESTED_REPLACEMENT = Collections.unmodifiableMap(m); } } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPD.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPD.java index b7a39e7112a..c999b3fbe05 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPD.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPD.java @@ -31,6 +31,10 @@ import net.sourceforge.pmd.util.database.SourceObject; import net.sourceforge.pmd.util.log.ScopedLogHandlersManager; +/** + * @deprecated This class is to be removed in PMD 7 in favor of a unified PmdCli entry point. + */ +@Deprecated public class CPD { private static final Logger LOGGER = Logger.getLogger(CPD.class.getName()); @@ -257,6 +261,10 @@ public CPDReport toReport() { return new CPDReport(matchAlgorithm.getMatches(), numberOfTokensPerFile); } + /** + * @deprecated This class is to be removed in PMD 7 in favor of a unified PmdCli entry point. + */ + @Deprecated public enum StatusCode { OK(0), ERROR(1), diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDCommandLineInterface.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDCommandLineInterface.java index e43e8f83669..990defedad1 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDCommandLineInterface.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDCommandLineInterface.java @@ -133,6 +133,7 @@ private static Map filterDeprecatedOptions(String... args) { m.put("--failOnViolation", "--fail-on-violation"); m.put("-failOnViolation", "--fail-on-violation"); m.put("--filelist", "--file-list"); + m.put("--files", "--dir"); SUGGESTED_REPLACEMENT = Collections.unmodifiableMap(m); } diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDConfiguration.java b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDConfiguration.java index 82906e807b5..1393e3d0fcf 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDConfiguration.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/cpd/CPDConfiguration.java @@ -116,7 +116,7 @@ public class CPDConfiguration extends AbstractConfiguration { required = false) private String skipBlocksPattern = Tokenizer.DEFAULT_SKIP_BLOCKS_PATTERN; - @Parameter(names = "--files", variableArity = true, description = "List of files and directories to process", + @Parameter(names = { "--files", "-d", "--dir" }, variableArity = true, description = "List of files and directories to process", required = false, converter = FileConverter.class) private List files; @@ -141,7 +141,7 @@ public class CPDConfiguration extends AbstractConfiguration { description = "By default CPD exits with status 4 if code duplications are found. Disable this option with '-failOnViolation false' to exit with 0 instead and just write the report.") private boolean failOnViolation = true; - @Parameter(names = { "--debug", "--verbose" }, description = "Debug mode.") + @Parameter(names = { "--debug", "--verbose", "-v", "-D" }, description = "Debug mode.") private boolean debug = false; // this has to be a public static class, so that JCommander can use it! @@ -156,7 +156,7 @@ public Language convert(String languageString) { } } - @Parameter(names = "--encoding", description = "Character encoding to use when processing files", required = false) + @Parameter(names = { "--encoding", "-e" }, description = "Character encoding to use when processing files", required = false) public void setEncoding(String encoding) { this.encoding = encoding; setSourceEncoding(encoding); diff --git a/pmd-dist/src/main/resources/scripts/run.sh b/pmd-dist/src/main/resources/scripts/run.sh index ece76fc949b..b07ac0e4bf1 100755 --- a/pmd-dist/src/main/resources/scripts/run.sh +++ b/pmd-dist/src/main/resources/scripts/run.sh @@ -10,7 +10,7 @@ usage() { } valid_app_options () { - echo "pmd, cpd, cpdgui, designer, bgastviewer, designerold, ast-dump" + echo "pmd, cpd, cpd-gui, designer, bgastviewer, designerold, ast-dump" } is_cygwin() { @@ -159,10 +159,12 @@ function add_openjfx_classpath() { then script_exit "The environment variable JAVAFX_HOME is missing." else + # The wildcard will include only jar files, but we need to access also + # property files such as javafx.properties that lay bare in the dir if [ -n "$classpath" ]; then - classpath="$classpath:${JAVAFX_HOME}/lib/*" + classpath="$classpath:${JAVAFX_HOME}/lib/*:${JAVAFX_HOME}/lib/" else - classpath="${JAVAFX_HOME}/lib/*" + classpath="${JAVAFX_HOME}/lib/*:${JAVAFX_HOME}/lib/" fi fi fi @@ -187,12 +189,18 @@ case "${APPNAME}" in readonly CLASSNAME="net.sourceforge.pmd.util.fxdesigner.DesignerStarter" ;; "designerold") + echo "'designerold' is deprecated and will be removed in PMD 7.0.0, try the new 'designer' instead." readonly CLASSNAME="net.sourceforge.pmd.util.designer.Designer" ;; "bgastviewer") + echo "'bgastviewer' is deprecated and will be removed in PMD 7.0.0, try the new 'designer' instead." readonly CLASSNAME="net.sourceforge.pmd.util.viewer.Viewer" ;; "cpdgui") + echo "'cpdgui' is deprecated and will be removed in PMD 7.0.0, use 'cpd-gui' instead." + readonly CLASSNAME="net.sourceforge.pmd.cpd.GUI" + ;; + "cpd-gui") readonly CLASSNAME="net.sourceforge.pmd.cpd.GUI" ;; "ast-dump") From 7d0208f6ac12161b6dca857995160e88bf294b95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Fri, 14 Oct 2022 23:56:11 -0300 Subject: [PATCH 02/34] Avoid NPEs --- .../main/java/net/sourceforge/pmd/PMDConfiguration.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pmd-core/src/main/java/net/sourceforge/pmd/PMDConfiguration.java b/pmd-core/src/main/java/net/sourceforge/pmd/PMDConfiguration.java index e25b657363a..023c0179122 100644 --- a/pmd-core/src/main/java/net/sourceforge/pmd/PMDConfiguration.java +++ b/pmd-core/src/main/java/net/sourceforge/pmd/PMDConfiguration.java @@ -525,7 +525,7 @@ public void addInputPath(Path inputPath) { */ @Deprecated public String getInputFilePath() { - return inputFilePath.toString(); + return inputFilePath == null ? null : inputFilePath.toString(); } public Path getInputFile() { @@ -537,7 +537,7 @@ public Path getInputFile() { */ @Deprecated public String getIgnoreFilePath() { - return ignoreFilePath.toString(); + return ignoreFilePath == null ? null : ignoreFilePath.toString(); } public Path getIgnoreFile() { @@ -596,7 +596,7 @@ public void setIgnoreFilePath(Path ignoreFilePath) { */ @Deprecated public String getInputUri() { - return inputUri.toString(); + return inputUri == null ? null : inputUri.toString(); } /** @@ -707,7 +707,7 @@ public void setReportFormat(String reportFormat) { */ @Deprecated public String getReportFile() { - return reportFile.toString(); + return reportFile == null ? null : reportFile.toString(); } /** From 9e92ca3d76fe7f505a53a2ef0340dfeaa3224ed8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Mon, 17 Oct 2022 00:45:59 -0300 Subject: [PATCH 03/34] Include CLI deprecations --- docs/pages/release_notes.md | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index ffc4e4ac9cd..e52f95ce985 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -22,6 +22,30 @@ This is a {{ site.pmd.release_type }} release. ### API Changes +#### PMD CLI + +* PMD now supports a new `--use-version` flag, which receives a language-version pair (such as `java-8` or `apex-54`). +This supersedes the usage of `-language` / `-l` and `-version` / `-v`, allowing for multiple versions to be set in a single run. +PMD 7 will completely remove support for `-language` and `-version` in favor of this new flag. + +* Support for `-V` is being deprecated in favor of `--verbose` in preparation for PMD 7. +In PMD 7, `-v` will enable verbose mode and `-V` will show the PMD version for conssitency with most Unix/Linux tools. + +* Support for `-min` is being deprecated in favor of `--minimum-priority` for consistency with most Unix/Linux tools, where `-min` would be equivalent to `-m -i -n`. + +#### CPD CLI + +* CPD now supports using `-d` or `--dir` as an alias to `--files`, in favor of consistency with PMD. +PMD 7 will remove support for `--files` in favor of these new flags. + +#### Linux run.sh parameters + +* Using `run.sh cpdgui` will now warn about it being deprecated. Use `run.sh cpd-gui` instead. + +* The old designer (`run.sh designerold`) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer: `run.sh designer`. + +* The old visual AST viewer (`run.sh bgastviewer`) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer: `run.sh designer` for a visual tool, or use `run.sh ast-dump` for a text-based aleternative. + ### External Contributions * [#4142](https://github.com/pmd/pmd/pull/4142): \[java] fix #4141 Update UncommentedEmptyConstructor - ignore @Autowired annotations - [Lynn](https://github.com/LynnBroe) (@LynnBroe) From 21306f36dbf71c452ae83cf7ca09b0d041ae0ac6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Mon, 17 Oct 2022 01:07:26 -0300 Subject: [PATCH 04/34] Add deprecations --- docs/pages/release_notes.md | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index e52f95ce985..0668f0c6e5e 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -46,6 +46,26 @@ PMD 7 will remove support for `--files` in favor of these new flags. * The old visual AST viewer (`run.sh bgastviewer`) is completely deprecated and will be removed in PMD 7. Switch to the new JavaFX designer: `run.sh designer` for a visual tool, or use `run.sh ast-dump` for a text-based aleternative. +#### Deprecated API + +The following APIs have been marked as deprecated for removal in PMD 7: + +- {% jdoc core::PMD %} and {% jdoc core::PMD.StatusCode %} - PMD 7 will ship with a revamped CLI split from pmd-core. To programatically launch analysis you can use {% jdoc core::PmdAnalysis %}. +- {% jdoc !!core::PMDConfiguration#getAllInputPaths() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getInputPathList() %} +- {% jdoc !!core::PMDConfiguration#setInputPaths(List) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setInputPathList(List) %} +- {% jdoc !!core::PMDConfiguration#addInputPath(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#addInputPath(Path) %} +- {% jdoc !!core::PMDConfiguration#getInputFilePath() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getInputFile() %} +- {% jdoc !!core::PMDConfiguration#getIgnoreFilePath() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getIgnoreFile() %} +- {% jdoc !!core::PMDConfiguration#setInputFilePath(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setInputFilePath(Path) %} +- {% jdoc !!core::PMDConfiguration#setIgnoreFilePath(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setIgnoreFilePath(Path) %} +- {% jdoc !!core::PMDConfiguration#getInputUri() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getUri() %} +- {% jdoc !!core::PMDConfiguration#setInputUri(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setInputUri(URI) %} +- {% jdoc !!core::PMDConfiguration#getReportFile() %} - It is now superceded by {% jdoc !!core::PMDConfiguration#getReportFilePath() %} +- {% jdoc !!core::PMDConfiguration#setReportFile(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setReportFile(Path) %} +- {% jdoc !!core::PMDConfiguration#isStressTest() %} and {% jdoc !!core::PMDConfiguration#setStressTest(boolean) %} - Will be removed with no replacement. +- {% jdoc !!core::PMDConfiguration#isBenchmark() %} and {% jdoc !!core::PMDConfiguration#setBenchmark(boolean) %} - Will be removed with no replacement, the CLI will still support it. +- {% jdoc core::CPD %} and {% jdoc core::CPD.StatusCode %} - PMD 7 will ship with a revamped CLI split from pmd-core. An alterative to programatically launch CPD analysis will be added in due time. + ### External Contributions * [#4142](https://github.com/pmd/pmd/pull/4142): \[java] fix #4141 Update UncommentedEmptyConstructor - ignore @Autowired annotations - [Lynn](https://github.com/LynnBroe) (@LynnBroe) From 637b701778f34c6bc57ae47abeb4926e9c7ecb55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Mon, 17 Oct 2022 01:10:41 -0300 Subject: [PATCH 05/34] Fix link to JavaFX --- docs/pages/pmd/userdocs/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/pmd/userdocs/installation.md b/docs/pages/pmd/userdocs/installation.md index 89aa58cf3ea..bf3fabb6218 100644 --- a/docs/pages/pmd/userdocs/installation.md +++ b/docs/pages/pmd/userdocs/installation.md @@ -23,7 +23,7 @@ sidebar: pmd_sidebar * For Windows: [Winzip](http://winzip.com) or the free [7-zip](http://www.7-zip.org/) * For Linux / Unix: [InfoZip](http://infozip.sourceforge.net/) -{% include note.html content="For executing the Designer (./run.sh designer) using [OpenJDK](http://jdk.java.net) or Java 11, you need additionally [OpenJFX](https://openjfx.io/). Download it, extract it and set the environment variable JAVAFX_HOME." %} +{% include note.html content="For executing the Designer (./run.sh designer) using [OpenJDK](http://jdk.java.net) or Java 11, you need additionally [JavaFX](https://gluonhq.com/products/javafx/). Download it, extract it and set the environment variable JAVAFX_HOME pointing at that directory." %} ### Installation From ecd7ab14ce9c338cc2c62d9684bdfc0e9d332063 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Mon, 17 Oct 2022 17:59:47 -0300 Subject: [PATCH 06/34] Update CLI docs --- docs/pages/pmd/userdocs/cli_reference.md | 17 +++++++++++++---- docs/pages/pmd/userdocs/cpd/cpd.md | 8 ++++---- 2 files changed, 17 insertions(+), 8 deletions(-) diff --git a/docs/pages/pmd/userdocs/cli_reference.md b/docs/pages/pmd/userdocs/cli_reference.md index 47e413805c6..d4aa8822b69 100644 --- a/docs/pages/pmd/userdocs/cli_reference.md +++ b/docs/pages/pmd/userdocs/cli_reference.md @@ -87,6 +87,8 @@ The tool comes with a rather extensive help text, simply running with `--help`! the given language `<lang>`. Parsing errors are ignored and unparsable files are skipped. +

Use `--use-version` to specify the language version to use, if it is not the default.

+

This option allows to use the xml language for files, that don't use xml as extension. See [example](#analyze-other-xml-formats) below.

" %} @@ -99,6 +101,13 @@ The tool comes with a rather extensive help text, simply running with `--help`! {% include custom/cli_option_row.html options="--help,-h,-H" description="Display help on usage." %} + {% include custom/cli_option_row.html options="--use-version" + option_arg="lang-version" + description="The language version PMD should use when parsing source code. +

Values are in the format of *language-version*.

+

This option can be repeated to configure multiple languages to be analyzed during a single run

+

See also [Supported Languages](#supported-languages).

" + %} {% include custom/cli_option_row.html options="-language,-l" option_arg="lang" description="Specify the language PMD should use. Used together with `-version`. See also [Supported Languages](#supported-languages)." @@ -184,16 +193,16 @@ This behavior has been introduced to ease PMD integration into scripts or hooks, The language is determined automatically by PMD from the file extensions. Some languages such as "Java" however support multiple versions. The default version will be used, which is usually the latest supported -version. If you want to use an older version, so that e.g. rules, that suggest usage of language features, -that are not available yet, won't be executed, you need to specify a specific version via the `-language` -and `-version` parameter. +non-preview version. If you want to use an older version, so that e.g. rules that suggest usage of language features +that are not available yet won't be executed, you need to specify a specific version via the `--use-version` +parameter. These parameters are irrelevant for languages that don't support different versions. Example: ``` shell -./run.sh pmd -d src/main/java -f text -R rulesets/java/quickstart.xml -language java -version 8 +./run.sh pmd -d src/main/java -f text -R rulesets/java/quickstart.xml --use-version java-1.8 ``` * [apex](pmd_rules_apex.html) (Salesforce Apex) diff --git a/docs/pages/pmd/userdocs/cpd/cpd.md b/docs/pages/pmd/userdocs/cpd/cpd.md index 22d594259b5..a3822e48195 100644 --- a/docs/pages/pmd/userdocs/cpd/cpd.md +++ b/docs/pages/pmd/userdocs/cpd/cpd.md @@ -62,7 +62,7 @@ Novice as much as advanced readers may want to [read on on Refactoring Guru](htt description="The minimum token length which should be reported as a duplicate." required="yes" %} - {% include custom/cli_option_row.html options="--files" + {% include custom/cli_option_row.html options="--files,--dir,-d" description="List of files and directories to process" required="yes" %} @@ -73,10 +73,10 @@ Novice as much as advanced readers may want to [read on on Refactoring Guru](htt description="Sources code language." default="java" %} - {% include custom/cli_option_row.html options="--debug,--verbose" + {% include custom/cli_option_row.html options="--debug,--verbose,-v,-D" description="Debug mode. Prints more log output." %} - {% include custom/cli_option_row.html options="--encoding" + {% include custom/cli_option_row.html options="--encoding,-e" description="Character encoding to use when processing files. If not specified, CPD uses the system default encoding." %} {% include custom/cli_option_row.html options="--skip-duplicate-files" @@ -368,7 +368,7 @@ For Windows: For Linux: - ./run.sh cpdgui + ./run.sh cpd-gui Here's a screenshot of CPD after running on the JDK 8 java.lang package: From 11a4940d6d0710fed16ddc5776cd8954e24fe6c3 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 4 Nov 2022 18:02:04 +0100 Subject: [PATCH 07/34] [java] ClassNamingConventions - add new property testClassPattern Fixes #2867 --- docs/pages/release_notes.md | 9 ++ .../pmd/lang/java/rule/AbstractJUnitRule.java | 10 +- .../codestyle/ClassNamingConventionsRule.java | 11 ++ .../resources/category/java/codestyle.xml | 6 +- .../codestyle/xml/ClassNamingConventions.xml | 101 ++++++++++++++++++ 5 files changed, 135 insertions(+), 2 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index e6743000d8d..0e772dae6df 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -14,7 +14,16 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy +#### Modified rules + +* The rule {% rule java/codestyle/ClassNamingConventions %} has a new property `testClassPattern`, which is applied + to test classes. By default, test classes should end with the suffix "Test". Test classes are classes, that + either inherit from JUnit 3 TestCase or have at least one method annotated with the Test annotations from + JUnit4/5 or TestNG. + ### Fixed Issues +* java-codestyle + * [#2867](https://github.com/pmd/pmd/issues/2867): \[java] Separate pattern for test classes in ClassNamingConventions rule for Java ### API Changes diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJUnitRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJUnitRule.java index 97e22c45596..667798e4dab 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJUnitRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJUnitRule.java @@ -111,7 +111,7 @@ protected void analyzeJUnitClass(ASTClassOrInterfaceDeclaration node) { public static boolean isTestClass(ASTClassOrInterfaceBody node) { return !isAbstractClass(node) && node.getParent() instanceof ASTClassOrInterfaceDeclaration - && (isTestClassJUnit3(node) || isTestClassJUnit4(node) || isTestClassJUnit5(node)); + && (isTestClassJUnit3(node) || isTestClassJUnit4(node) || isTestClassJUnit5(node) || isTestClassTestNg(node)); } private static boolean isAbstractClass(ASTClassOrInterfaceBody node) { @@ -149,6 +149,14 @@ public static boolean isTestClassJUnit5(ASTClassOrInterfaceBody node) { return false; } + private static boolean isTestClassTestNg(ASTClassOrInterfaceBody node) { + Node parent = node.getParent(); + if (parent instanceof TypeNode) { + TypeNode type = (TypeNode) parent; + return doesNodeContainJUnitAnnotation(type, TESTNG_ANNOTATION) || hasImports(type, TESTNG_ANNOTATION); + } + return false; + } public static boolean isTestMethod(ASTMethodDeclaration method) { if (method.isAbstract() || method.isNative() || method.isStatic()) { diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java index c14d2403869..c3dee9405da 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java @@ -11,12 +11,14 @@ import net.sourceforge.pmd.lang.java.ast.ASTAnyTypeBodyDeclaration.DeclarationKind; import net.sourceforge.pmd.lang.java.ast.ASTAnyTypeDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTAnyTypeDeclaration.TypeKind; +import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceBody; import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTEnumDeclaration; import net.sourceforge.pmd.lang.java.ast.ASTInitializer; import net.sourceforge.pmd.lang.java.ast.ASTMethodDeclaration; import net.sourceforge.pmd.lang.java.ast.AccessNode; import net.sourceforge.pmd.lang.java.ast.internal.PrettyPrintingUtil; +import net.sourceforge.pmd.lang.java.rule.AbstractJUnitRule; import net.sourceforge.pmd.properties.PropertyDescriptor; @@ -31,6 +33,9 @@ public class ClassNamingConventionsRule extends AbstractNamingConventionRule enumerationRegex = defaultProp("enum").build(); private final PropertyDescriptor annotationRegex = defaultProp("annotation").build(); private final PropertyDescriptor utilityClassRegex = defaultProp("utility class").build(); + private final PropertyDescriptor testClassRegex = defaultProp("test class") + .desc("Regex which applies to test class names. Since PMD 6.52.0.") + .defaultValue("[A-Z][a-zA-Z0-9]*Test").build(); public ClassNamingConventionsRule() { @@ -40,6 +45,7 @@ public ClassNamingConventionsRule() { definePropertyDescriptor(enumerationRegex); definePropertyDescriptor(annotationRegex); definePropertyDescriptor(utilityClassRegex); + definePropertyDescriptor(testClassRegex); addRuleChainVisit(ASTClassOrInterfaceDeclaration.class); addRuleChainVisit(ASTEnumDeclaration.class); @@ -108,12 +114,17 @@ private boolean isMainMethod(ASTAnyTypeBodyDeclaration bodyDeclaration) { && String[].class.equals(decl.getFormalParameters().iterator().next().getType()); } + private boolean isTestClass(ASTClassOrInterfaceDeclaration node) { + return AbstractJUnitRule.isTestClass(node.getFirstChildOfType(ASTClassOrInterfaceBody.class)); + } @Override public Object visit(ASTClassOrInterfaceDeclaration node, Object data) { if (node.isAbstract()) { checkMatches(node, abstractClassRegex, data); + } else if (isTestClass(node)) { + checkMatches(node, testClassRegex, data); } else if (isUtilityClass(node)) { checkMatches(node, utilityClassRegex, data); } else if (node.isInterface()) { diff --git a/pmd-java/src/main/resources/category/java/codestyle.xml b/pmd-java/src/main/resources/category/java/codestyle.xml index ec8f37cc46e..a1a3953db66 100644 --- a/pmd-java/src/main/resources/category/java/codestyle.xml +++ b/pmd-java/src/main/resources/category/java/codestyle.xml @@ -398,7 +398,7 @@ public class Foo extends Bar{ specific kind (e.g. enum or interface). Each regex can be configured through properties. - By default this rule uses the standard Java naming convention (Pascal case). + By default, this rule uses the standard Java naming convention (Pascal case). The rule can detect utility classes and enforce a different naming convention on those. E.g. setting the property `utilityClassPattern` to @@ -408,6 +408,10 @@ public class Foo extends Bar{ For this rule, a utility class is defined as: a concrete class that does not inherit from a super class or implement any interface and only has static fields or methods. + + This rule detects test classes using the following convention: Test classes are classes, that + either inherit from JUnit 3 TestCase or have at least one method annotated with the Test annotations from + JUnit4/5 or TestNG. 1 diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/ClassNamingConventions.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/ClassNamingConventions.xml index c186ae3e0a8..8a42551102b 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/ClassNamingConventions.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/ClassNamingConventions.xml @@ -288,4 +288,105 @@ public class MyConstants { } ]]> + + + Test class (JUnit3) #2867 + 1 + 2 + + + + + Test class (JUnit4) #2867 + 1 + 2 + + + + + Test class (JUnit5) #2867 + 1 + 2 + + + + + Test class (JUnit5) correctly named #2867 + 0 + + + + + Test class (JUnit5) with non-default testClassPattern #2867 + Test[A-Z][a-zA-Z0-9]* + 0 + + + + + Test class (JUnit5, Parameterized) #2867 + 1 + 3 + + + + + Test class (TestNG) #2867 + 1 + 2 + + + + + Not a test class (despite its name) #2867 + 0 + + From 1824f523dced6751fe31364ef5d96d533fb0938d Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 4 Nov 2022 20:10:37 +0100 Subject: [PATCH 08/34] [java] ClassNamingConventions - change default testClassPattern --- .../lang/java/rule/codestyle/ClassNamingConventionsRule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java index c3dee9405da..462bc7e49cd 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java @@ -35,7 +35,7 @@ public class ClassNamingConventionsRule extends AbstractNamingConventionRule utilityClassRegex = defaultProp("utility class").build(); private final PropertyDescriptor testClassRegex = defaultProp("test class") .desc("Regex which applies to test class names. Since PMD 6.52.0.") - .defaultValue("[A-Z][a-zA-Z0-9]*Test").build(); + .defaultValue("[A-Z][a-zA-Z0-9]*Tests?").build(); public ClassNamingConventionsRule() { From cd075d24599a74f726a711138ec9b50f790a3c95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 5 Nov 2022 15:48:04 +0100 Subject: [PATCH 09/34] Fix #4152 - support type annotations in more places --- pmd-java/etc/grammar/Java.jjt | 25 ++++++++++++------- .../pmd/lang/java/ast/ParserCornersTest.java | 6 ++--- .../lang/java/ast/ParserCornerCases18.java | 23 +++++++++++++++++ 3 files changed, 42 insertions(+), 12 deletions(-) diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index 3d4765cd61c..86bb21588a8 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -1541,8 +1541,8 @@ void FormalParameter() : } { ( "final" {jjtThis.setFinal(true);} | Annotation() )* - Type() ("|" {checkForBadMultipleExceptionsCatching();} Type())* - [ "..." {checkForBadVariableArgumentsUsage();} {jjtThis.setVarargs();} ] + Type() ("|" {checkForBadMultipleExceptionsCatching();} (AnnotationNoNode())* Type())* + [ (AnnotationNoNode())* "..." {checkForBadVariableArgumentsUsage();} {jjtThis.setVarargs();} ] VariableDeclaratorId() } @@ -1586,18 +1586,16 @@ void Type(): Token t; } { - LOOKAHEAD(2) ReferenceType() + LOOKAHEAD( | PrimitiveType() (AnnotationNoNode())* "[" "]" ) ReferenceType() | PrimitiveType() } void ReferenceType(): {} { - // The grammar here is mildly wrong, the annotations can be before each [] - // This will wait for #997 - PrimitiveType() (TypeAnnotation())* ( LOOKAHEAD(2) "[" "]" { jjtThis.bumpArrayDepth(); })+ + PrimitiveType() (LOOKAHEAD((AnnotationNoNode())* "[" "]") (AnnotationNoNode())* "[" "]" { jjtThis.bumpArrayDepth(); })+ | - ( ClassOrInterfaceType()) (TypeAnnotation())* ( LOOKAHEAD(2) "[" "]" { jjtThis.bumpArrayDepth(); })* + ClassOrInterfaceType() (LOOKAHEAD((AnnotationNoNode())* "[" "]") (AnnotationNoNode())* "[" "]" { jjtThis.bumpArrayDepth(); })* } void ClassOrInterfaceType(): @@ -1989,8 +1987,8 @@ void PrimaryPrefix() : | LOOKAHEAD(3) "(" Expression() ")" | AllocationExpression() | LOOKAHEAD( ResultType() "." "class" ) ResultType() "." "class" -| LOOKAHEAD( Name() "::" ) Name() -| LOOKAHEAD( ReferenceType() MethodReference() ) ReferenceType() MethodReference() +| LOOKAHEAD( Name() "::" ) Name() // followed by method reference in PrimarySuffix +| LOOKAHEAD( "@" | Type() "::" ) (AnnotationNoNode())* (LOOKAHEAD(2) ReferenceType()|PrimitiveType()) // followed by method reference in PrimarySuffix | Name() } @@ -2533,6 +2531,15 @@ void RSIGNEDSHIFT(): // TODO 7.0.0 make #void /* Annotation syntax follows. */ + +// Todo PMD7 remove this, this is transitional in the PMD6 branch. +void AnnotationNoNode() #void: +{checkForBadTypeAnnotations();} +{ + Annotation() + {jjtree.popNode();} +} + void Annotation(): {} { diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java index 686e9f3c6c6..ecdb31ef3cb 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/ParserCornersTest.java @@ -148,10 +148,10 @@ public void testParsersCases17() { public void testParsersCases18() throws Exception { ASTCompilationUnit cu = java8.parseResource("ParserCornerCases18.java"); - Assert.assertEquals(21, cu.findChildNodesWithXPath("//FormalParameter").size()); - Assert.assertEquals(4, + Assert.assertEquals(24, cu.findChildNodesWithXPath("//FormalParameter").size()); + Assert.assertEquals(5, cu.findChildNodesWithXPath("//FormalParameter[@ExplicitReceiverParameter='true']").size()); - Assert.assertEquals(17, + Assert.assertEquals(19, cu.findChildNodesWithXPath("//FormalParameter[@ExplicitReceiverParameter='false']").size()); } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases18.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases18.java index d6564e90b88..8651c40fe58 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases18.java +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases18.java @@ -189,6 +189,29 @@ public Object[] createNonNullArray() { return new Object @NonNull[0]; } + // this comes from https://github.com/pmd/pmd/issues/4152 + public static T[][] check(T @Anno[] @Anno [] arr) { + if (arr == null) { + throw new NullPointerException(); + } + return arr; + } + + // this comes from https://github.com/pmd/pmd/issues/4152 + public Function func(Main this) { + return @A Main.Inner::new; // this line lead to the crash + } + + // this comes from https://github.com/pmd/pmd/issues/4152 + public static byte max(final byte @NotNull ... array) { return 0;} + + // this comes from https://github.com/pmd/pmd/issues/4152 + @Retention(RetentionPolicy.CLASS) + @Target({ TYPE_USE }) + @interface Anno { + } + + private static void testMultiDimArrayWithAnnotations() { // ever used a 3D-Array in java?? Object x = new Object @NonNull[2] @Nullable[1] @NonNull[3]; From b39ba3c560e94c369a43fdf21b444be523e88319 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 5 Nov 2022 16:30:01 +0100 Subject: [PATCH 10/34] Add new tests Refs #3643 --- pmd-java/etc/grammar/Java.jjt | 16 ++-- .../pmd/lang/java/ast/JDKVersionTest.java | 20 +++++ .../java5/annotation_array_init.java | 5 ++ .../jdkversiontests/java5/generic_ctors.java | 19 +++++ .../java5/generic_super_ctor.java | 10 +++ .../java8/type_annotations.java | 73 +++++++++++++++++++ 6 files changed, 135 insertions(+), 8 deletions(-) create mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java5/annotation_array_init.java create mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java5/generic_ctors.java create mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java5/generic_super_ctor.java create mode 100644 pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java8/type_annotations.java diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index 86bb21588a8..689c5ed7664 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -1483,7 +1483,7 @@ void VariableDeclaratorId() : { (LOOKAHEAD(2) t= "." { checkforBadExplicitReceiverParameter(); jjtThis.setExplicitReceiverParameter(); image=t.image + ".this"; } | t= { checkforBadExplicitReceiverParameter(); jjtThis.setExplicitReceiverParameter(); image = t.image;} - | t= { image = t.image; } ( "[" "]" { jjtThis.bumpArrayDepth(); })* + | t= { image = t.image; } ( (AnnotationNoNode())* "[" "]" { jjtThis.bumpArrayDepth(); })* ) { checkForBadAssertUsage(image, "a variable name"); @@ -1526,7 +1526,7 @@ void MethodDeclarator() : checkForBadEnumUsage(t.image, "a method name"); jjtThis.setImage( t.image ); } - FormalParameters() ( "[" "]" )* + FormalParameters() ( (AnnotationNoNode())* "[" "]" )* } @@ -1606,7 +1606,7 @@ void ClassOrInterfaceType(): { t= {s.append(t.image);} [ LOOKAHEAD(2) TypeArguments() ] - ( LOOKAHEAD(2) "." t= {s.append('.').append(t.image);} [ LOOKAHEAD(2) TypeArguments() ] )* + ( LOOKAHEAD(2) "." (AnnotationNoNode())* t= {s.append('.').append(t.image);} [ LOOKAHEAD(2) TypeArguments() ] )* {jjtThis.setImage(s.toString());} } @@ -1832,7 +1832,7 @@ void InstanceOfExpression() #InstanceOfExpression(>1): {} { RelationalExpression() - [ "instanceof" + [ "instanceof" (AnnotationNoNode())* ( LOOKAHEAD("final" | "@") {checkforBadInstanceOfPattern();} Pattern() | @@ -2103,11 +2103,11 @@ void AllocationExpression(): void ArrayDimsAndInits() : {} { + LOOKAHEAD((TypeAnnotation())* "[" "]") + ((AnnotationNoNode())* "[" "]" {jjtThis.bumpArrayDepth();})+ ArrayInitializer() +| ( LOOKAHEAD((TypeAnnotation())* "[" UnaryExprNotPmStart() ) (AnnotationNoNode())* "[" Expression() "]" {jjtThis.bumpArrayDepth();} )+ + ( LOOKAHEAD((TypeAnnotation())* "[") (AnnotationNoNode())* "[" "]" {jjtThis.bumpArrayDepth();} )* - LOOKAHEAD(2) - ( LOOKAHEAD(2) (TypeAnnotation())* "[" Expression() "]" {jjtThis.bumpArrayDepth();})+ ( LOOKAHEAD(2) "[" "]" {jjtThis.bumpArrayDepth();} )* -| - ( "[" "]" {jjtThis.bumpArrayDepth();})+ ArrayInitializer() } diff --git a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/JDKVersionTest.java b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/JDKVersionTest.java index 97fda691338..f2dfb3c082d 100644 --- a/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/JDKVersionTest.java +++ b/pmd-java/src/test/java/net/sourceforge/pmd/lang/java/ast/JDKVersionTest.java @@ -84,6 +84,21 @@ public void testVarargsShouldPassWith15() { java5.parseResource("jdk15_varargs.java"); } + @Test + public void testGenericCtorCalls() { + java5.parseResource("java5/generic_ctors.java"); + } + + @Test + public void testGenericSuperCtorCalls() { + java5.parseResource("java5/generic_super_ctor.java"); + } + + @Test + public void testAnnotArrayInitializer() { + java5.parseResource("java5/annotation_array_init.java"); + } + @Test(expected = ParseException.class) public void testVarargsShouldFailWith14() { java4.parseResource("jdk15_varargs.java"); @@ -217,6 +232,11 @@ public final void testPrivateMethods() { java8.parse("public class Foo { private void bar() { } }"); } + @Test + public final void testTypeAnnotations() { + java8.parseResource("java8/type_annotations.java"); + } + @Test public final void testNestedPrivateMethods() { java8.parse("public interface Baz { public static class Foo { private void bar() { } } }"); diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java5/annotation_array_init.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java5/annotation_array_init.java new file mode 100644 index 00000000000..6ba17872676 --- /dev/null +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java5/annotation_array_init.java @@ -0,0 +1,5 @@ +// From https://github.com/checkstyle/checkstyle/blob/checkstyle-9.1/src/test/resources/com/puppycrawl/tools/checkstyle/grammar/antlr4/InputAntlr4AstRegressionSingleCommaInArrayInit.java +class AnnotationCommaArrayInit { + @Foo({,}) void b() { } + @interface Foo { int[] value(); } +} diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java5/generic_ctors.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java5/generic_ctors.java new file mode 100644 index 00000000000..abf6d12295f --- /dev/null +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java5/generic_ctors.java @@ -0,0 +1,19 @@ + +// From https://github.com/checkstyle/checkstyle/blob/checkstyle-9.1/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/genericwhitespace/InputGenericWhitespaceDefault.java +// and https://github.com/checkstyle/checkstyle/blob/checkstyle-9.1/src/test/resources/com/puppycrawl/tools/checkstyle/grammar/antlr4/InputAntlr4AstRegressionUncommon4.java +class GenericConstructor { + Object ok = new Object(); + Object okWithPackage = new java.lang.Object(); + Object ok2 = new Outer.Inner(); + Object o3 = new Outer().new NonStatic(); + Object o4 = new GenericOuter(); + Object o5 = new GenericOuter().new GenericInner(); +} +class Outer { + static class Inner {} + class NonStatic {} +} +class GenericOuter { + class GenericInner { } +} + diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java5/generic_super_ctor.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java5/generic_super_ctor.java new file mode 100644 index 00000000000..a762aac9540 --- /dev/null +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java5/generic_super_ctor.java @@ -0,0 +1,10 @@ +// From https://github.com/checkstyle/checkstyle/blob/checkstyle-9.1/src/test/resources/com/puppycrawl/tools/checkstyle/grammar/InputRegressionJavaClass2.java +class c4 { + class c4a {} + + public c4() { super(); } +} +class c5 extends c4.c4a { + c5() { new c4().super(); } + c5(int a) { new c4().super(); } +} diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java8/type_annotations.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java8/type_annotations.java new file mode 100644 index 00000000000..9940d49cab2 --- /dev/null +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java8/type_annotations.java @@ -0,0 +1,73 @@ +/* + * BSD-style license; for more info see http://pmd.sourceforge.net/license.html + */ + +// From https://github.com/checkstyle/checkstyle/blob/checkstyle-9.1/src/it/resources/com/google/checkstyle/test/chapter4formatting/rule462horizontalwhitespace/InputNoWhitespaceBeforeAnnotations.java +// and https://github.com/checkstyle/checkstyle/blob/checkstyle-9.1/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfterArrayDeclarationsAndAnno.java +// and https://github.com/checkstyle/checkstyle/blob/checkstyle-9.1/src/test/resources/com/puppycrawl/tools/checkstyle/checks/whitespace/nowhitespaceafter/InputNoWhitespaceAfterNewTypeStructure.java +// and https://github.com/checkstyle/checkstyle/blob/checkstyle-9.1/src/test/resources/com/puppycrawl/tools/checkstyle/grammar/java8/InputAnnotations12.java +@Target(ElementType.TYPE_USE) +@interface NonNull {} + +class AnnotedArrayType { + @NonNull int @NonNull[] @NonNull[] field1; + @NonNull int @NonNull [] @NonNull [] field2; + public String m2()@NonNull[]@NonNull[] { return null; } + public String@NonNull[]@NonNull[] m2a() { return null; } + public void run() { + for (String a@NonNull[] : m2()) { + } + } + void vararg(@NonNull String @NonNull [] @NonNull ... vararg2) { } + public void vararg2(@NonNull int @NonNull ... vararg) {} + public void vararg3(@NonNull int[] @NonNull ... vararg) {} +} +// From https://github.com/checkstyle/checkstyle/blob/checkstyle-9.1/src/test/resources/com/puppycrawl/tools/checkstyle/checks/coding/avoidnoargumentsuperconstructorcall/InputAvoidNoArgumentSuperConstructorCall.java +// and https://github.com/checkstyle/checkstyle/blob/checkstyle-9.1/src/test/resources/com/puppycrawl/tools/checkstyle/grammar/antlr4/InputAntlr4AstRegressionAnnotationOnQualifiedTypes.java +// and https://github.com/checkstyle/checkstyle/blob/checkstyle-9.1/src/test/resources/com/puppycrawl/tools/checkstyle/grammar/antlr4/InputAntlr4AstRegressionNestedTypeParametersAndArrayDeclarators.java +@Target({ + ElementType.FIELD, ElementType.LOCAL_VARIABLE, ElementType.PARAMETER, + ElementType.TYPE_PARAMETER, ElementType.TYPE_USE}) +@interface TypeAnnotation { +} + +class Rectangle2D { + class Double{} +} +class TypeAnnotations { + // We can use type Annotations with generic type arguments + private Map.@TypeAnnotation Entry entry; + // Type annotations in instanceof statements + boolean isNonNull = "string" instanceof @TypeAnnotation String; + // java.awt.geom.Rectangle2D + public final Rectangle2D.@TypeAnnotation Double getRect1() { + return new Rectangle2D.Double(); + } + public final Rectangle2D.Double getRect2() { + return new Rectangle2D.@TypeAnnotation Double(); + } + public final Rectangle2D.Double getRect3() { + Rectangle2D.@TypeAnnotation Double rect = null; + int[][] i = new int @TypeAnnotation [1] @TypeAnnotation[]; + return rect; + } + + class Outer { + class Inner { + class Inner2 { + } + } + class GInner { + class GInner2 {} + } + class Static {} + class GStatic { + class GStatic2 {} + } + } + class MyList { } + class Test1 { + @TypeAnnotation Outer . @TypeAnnotation GInner<@TypeAnnotation MyList<@TypeAnnotation Object @TypeAnnotation[] @TypeAnnotation[]>> + .@TypeAnnotation GInner2<@TypeAnnotation Integer, @TypeAnnotation Object> @TypeAnnotation[] @TypeAnnotation[] f4arrtop; + } +} From 92ccf1b0ea00e06ae98e044c24c3743c8e21e3d7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 5 Nov 2022 16:31:17 +0100 Subject: [PATCH 11/34] Support array init with just a comma Refs #3643 --- pmd-java/etc/grammar/Java.jjt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index 689c5ed7664..2072359aad8 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -2595,7 +2595,7 @@ void MemberValue(): void MemberValueArrayInitializer(): {} { - "{" (MemberValue() ( LOOKAHEAD(2) "," MemberValue() )* [ "," ])? "}" + "{" (MemberValue() ( LOOKAHEAD(2) "," MemberValue() )*)? [ "," ] "}" } /* From 2027d2f57fe4cb38e23a2cc988bed97a03995fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 5 Nov 2022 17:05:46 +0100 Subject: [PATCH 12/34] Support generic ctors --- pmd-java/etc/grammar/Java.jjt | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index 2072359aad8..06f4d66829e 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -736,6 +736,12 @@ public class JavaParser { token_source.setSuppressMarker(marker); } + /** + * Keeps track during tree construction, whether we are currently building an + * explicit constructor invocation. Then the PrimaryExpression that may prefix + * a qualified super constructor call may not consume "super" tokens. + */ + private boolean inExplicitConstructorInvoc = false; } PARSER_END(JavaParser) @@ -1559,13 +1565,14 @@ Token t;} } void ExplicitConstructorInvocation() : -{} -{ - LOOKAHEAD("this" Arguments() ";") "this" {jjtThis.setIsThis();} Arguments() ";" +{boolean prev = inExplicitConstructorInvoc; inExplicitConstructorInvoc = true;} +{ ( + LOOKAHEAD([TypeArguments()] "this" Arguments() ";") [TypeArguments()] "this" {jjtThis.setIsThis();} | - LOOKAHEAD(TypeArguments() "this" Arguments() ";") TypeArguments() "this" {jjtThis.setIsThis();} Arguments() ";" -| - [ LOOKAHEAD(PrimaryExpression() ".") PrimaryExpression() "." ] [ TypeArguments() ] "super" {jjtThis.setIsSuper();} Arguments() ";" + [ LOOKAHEAD(PrimaryExpression() "." [TypeArguments()] "super" ) PrimaryExpression() "." ] [ TypeArguments() ] "super" {jjtThis.setIsSuper();} + ) + {inExplicitConstructorInvoc = prev;} + Arguments() ";" } void Initializer() : @@ -1957,9 +1964,18 @@ void SwitchExpression() : void PrimaryExpression() : {} { - PrimaryPrefix() ( LOOKAHEAD(2) PrimarySuffix() )* + PrimaryPrefix() ( LOOKAHEAD(SuffixLAhead()) PrimarySuffix() )* } +private void SuffixLAhead() #void: +{} +{ + "::" | "[" | "(" + | LOOKAHEAD({!inExplicitConstructorInvoc}) "." + | LOOKAHEAD({inExplicitConstructorInvoc}) "." ( | TypeArguments() | "new") // not super or this in this case +} + + void MemberSelector(): { Token t; @@ -2077,10 +2093,12 @@ void ArgumentList() : void AllocationExpression(): {} { - "new" (TypeAnnotation())* + "new" (LOOKAHEAD(2) PrimitiveType() ArrayDimsAndInits() | + [TypeArguments()] + (AnnotationNoNode())* ClassOrInterfaceType() ( ArrayDimsAndInits() From 00c06343a5109f624cfd1ca87356ad492e1e927d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sun, 6 Nov 2022 21:50:33 +0100 Subject: [PATCH 13/34] Fix tests --- pmd-java/etc/grammar/Java.jjt | 4 ++-- .../pmd/lang/java/ast/ASTTypePattern.java | 3 ++- .../pmd/lang/java/ast/ASTPatternTest.kt | 16 ++++++++-------- .../java16/PatternMatchingInstanceof.txt | 3 --- .../java/ast/jdkversiontests/java16/Records.txt | 3 --- 5 files changed, 12 insertions(+), 17 deletions(-) diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index 06f4d66829e..7a6508ee021 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -1383,7 +1383,7 @@ void RecordComponent(): { (RecordComponentModifier())* Type() - [ "..." {jjtThis.setVarargs();} ] + [ (AnnotationNoNode())* "..." {jjtThis.setVarargs();} ] VariableDeclaratorId() } @@ -2033,7 +2033,7 @@ void LambdaParameter() #FormalParameter : { ( "final" {jjtThis.setFinal(true);} | Annotation() )* LambdaParameterType() - [ "..." {checkForBadVariableArgumentsUsage();} {jjtThis.setVarargs();} ] + [(AnnotationNoNode())* "..." {checkForBadVariableArgumentsUsage();} {jjtThis.setVarargs();} ] VariableDeclaratorId() } diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTTypePattern.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTTypePattern.java index 4994d6a278e..8748d4084be 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTTypePattern.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTTypePattern.java @@ -5,6 +5,7 @@ package net.sourceforge.pmd.lang.java.ast; import java.util.List; +import java.util.Objects; import net.sourceforge.pmd.annotation.Experimental; @@ -48,7 +49,7 @@ public List getDeclaredAnnotations() { * Gets the type against which the expression is tested. */ public ASTType getTypeNode() { - return getFirstChildOfType(ASTType.class); + return Objects.requireNonNull(getFirstChildOfType(ASTType.class)); } /** Returns the declared variable. */ diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTPatternTest.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTPatternTest.kt index 65cbcc16f48..1050fea4404 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTPatternTest.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTPatternTest.kt @@ -5,10 +5,9 @@ package net.sourceforge.pmd.lang.java.ast import io.kotest.matchers.shouldBe -import net.sourceforge.pmd.lang.ast.test.shouldBe as typeShouldBe -import net.sourceforge.pmd.lang.java.ast.JavaVersion -import net.sourceforge.pmd.lang.java.ast.JavaVersion.* +import net.sourceforge.pmd.lang.java.ast.JavaVersion.J16 import java.io.IOException +import net.sourceforge.pmd.lang.ast.test.shouldBe as typeShouldBe class ASTPatternTest : ParserTestSpec({ val typePatternsVersions = JavaVersion.since(J16) @@ -55,11 +54,12 @@ class ASTPatternTest : ParserTestSpec({ "obj instanceof @Deprecated Class c" should matchExpr { unspecifiedChild() child { - child(ignoreChildren = true) { - it.annotationName shouldBe "Deprecated" - } - - it.isAnnotationPresent("java.lang.Deprecated") shouldBe true +// TODO PMD 7 reenable +// child(ignoreChildren = true) { +// it.annotationName shouldBe "Deprecated" +// } +// +// it.isAnnotationPresent("java.lang.Deprecated") shouldBe true it::getTypeNode typeShouldBe child(ignoreChildren = true) {} diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt index 00f533dd0ee..c10b239bb72 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt @@ -379,9 +379,6 @@ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false] | | | | +- Name[@Image = "obj"] | | | +- TypePattern[@ParenthesisDepth = 0] - | | | +- Annotation[@AnnotationName = "Deprecated"] - | | | | +- MarkerAnnotation[@AnnotationName = "Deprecated"] - | | | | +- Name[@Image = "Deprecated"] | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"] | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0] | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt index d0248e939c1..d90f725a9e7 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt @@ -198,9 +198,6 @@ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"] | | | +- ReferenceType[@Array = false, @ArrayDepth = 0] | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false] - | | | +- Annotation[@AnnotationName = "Nullable"] - | | | +- MarkerAnnotation[@AnnotationName = "Nullable"] - | | | +- Name[@Image = "Nullable"] | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "x", @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "x"] | +- RecordBody[] +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD] From 36f19eda9262cd6fbc146bb030770f00f4792368 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sun, 6 Nov 2022 22:14:09 +0100 Subject: [PATCH 14/34] Push actual annotation nodes This is to avoid having rules like UnusedImports fail to see an annotation usage. This makes the tree rather messy when there are type annotations though. --- pmd-java/etc/grammar/Java.jjt | 63 ++++++++----------- .../java/ast/ASTInstanceOfExpression.java | 2 +- .../pmd/lang/java/ast/ASTPatternTest.kt | 11 ++-- .../java16/PatternMatchingInstanceof.txt | 3 + .../ast/jdkversiontests/java16/Records.txt | 3 + 5 files changed, 37 insertions(+), 45 deletions(-) diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index 7a6508ee021..f50de9e97a6 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -1383,7 +1383,7 @@ void RecordComponent(): { (RecordComponentModifier())* Type() - [ (AnnotationNoNode())* "..." {jjtThis.setVarargs();} ] + [ (TypeAnnotation())* "..." {jjtThis.setVarargs();} ] VariableDeclaratorId() } @@ -1489,7 +1489,7 @@ void VariableDeclaratorId() : { (LOOKAHEAD(2) t= "." { checkforBadExplicitReceiverParameter(); jjtThis.setExplicitReceiverParameter(); image=t.image + ".this"; } | t= { checkforBadExplicitReceiverParameter(); jjtThis.setExplicitReceiverParameter(); image = t.image;} - | t= { image = t.image; } ( (AnnotationNoNode())* "[" "]" { jjtThis.bumpArrayDepth(); })* + | t= { image = t.image; } ( (TypeAnnotation())* "[" "]" { jjtThis.bumpArrayDepth(); })* ) { checkForBadAssertUsage(image, "a variable name"); @@ -1532,7 +1532,7 @@ void MethodDeclarator() : checkForBadEnumUsage(t.image, "a method name"); jjtThis.setImage( t.image ); } - FormalParameters() ( (AnnotationNoNode())* "[" "]" )* + FormalParameters() ( (TypeAnnotation())* "[" "]" )* } @@ -1547,8 +1547,8 @@ void FormalParameter() : } { ( "final" {jjtThis.setFinal(true);} | Annotation() )* - Type() ("|" {checkForBadMultipleExceptionsCatching();} (AnnotationNoNode())* Type())* - [ (AnnotationNoNode())* "..." {checkForBadVariableArgumentsUsage();} {jjtThis.setVarargs();} ] + Type() ("|" {checkForBadMultipleExceptionsCatching();} (TypeAnnotation())* Type())* + [ (TypeAnnotation())* "..." {checkForBadVariableArgumentsUsage();} {jjtThis.setVarargs();} ] VariableDeclaratorId() } @@ -1593,16 +1593,16 @@ void Type(): Token t; } { - LOOKAHEAD( | PrimitiveType() (AnnotationNoNode())* "[" "]" ) ReferenceType() + LOOKAHEAD( | PrimitiveType() (TypeAnnotation())* "[" "]" ) ReferenceType() | PrimitiveType() } void ReferenceType(): {} { - PrimitiveType() (LOOKAHEAD((AnnotationNoNode())* "[" "]") (AnnotationNoNode())* "[" "]" { jjtThis.bumpArrayDepth(); })+ + PrimitiveType() (LOOKAHEAD((TypeAnnotation())* "[" "]") (TypeAnnotation())* "[" "]" { jjtThis.bumpArrayDepth(); })+ | - ClassOrInterfaceType() (LOOKAHEAD((AnnotationNoNode())* "[" "]") (AnnotationNoNode())* "[" "]" { jjtThis.bumpArrayDepth(); })* + ClassOrInterfaceType() (LOOKAHEAD((TypeAnnotation())* "[" "]") (TypeAnnotation())* "[" "]" { jjtThis.bumpArrayDepth(); })* } void ClassOrInterfaceType(): @@ -1613,7 +1613,7 @@ void ClassOrInterfaceType(): { t= {s.append(t.image);} [ LOOKAHEAD(2) TypeArguments() ] - ( LOOKAHEAD(2) "." (AnnotationNoNode())* t= {s.append('.').append(t.image);} [ LOOKAHEAD(2) TypeArguments() ] )* + ( LOOKAHEAD(2) "." (TypeAnnotation())* t= {s.append('.').append(t.image);} [ LOOKAHEAD(2) TypeArguments() ] )* {jjtThis.setImage(s.toString());} } @@ -1745,8 +1745,6 @@ void AssignmentOperator() : | "|=" {jjtThis.setImage("|="); jjtThis.setCompound();} } -// TODO Setting isTernary is unnecessary, since the node is only pushed on the stack if there is at least one child, -// ie if it's a ternary void ConditionalExpression() #ConditionalExpression(>1) : {} { @@ -1792,7 +1790,7 @@ void EqualityExpression() #EqualityExpression(>1): void Pattern() #void: {} { - LOOKAHEAD(ReferenceType() "(") RecordPattern() + LOOKAHEAD((Annotation())* ReferenceType() "(") RecordPattern() | LOOKAHEAD("(") ParenthesizedPattern() | TypePattern() [ GuardedPatternCondition() #GuardedPattern(2) {checkForGuardedPatterns();} ] } @@ -1820,7 +1818,7 @@ void TypePattern(): void RecordPattern(): { checkForRecordPatterns(); } { - ReferenceType() RecordStructurePattern() [ VariableDeclaratorId() ] + (Annotation())* ReferenceType() RecordStructurePattern() [ VariableDeclaratorId() ] } void RecordStructurePattern() #ComponentPatternList: @@ -1839,16 +1837,15 @@ void InstanceOfExpression() #InstanceOfExpression(>1): {} { RelationalExpression() - [ "instanceof" (AnnotationNoNode())* + [ "instanceof" ( - LOOKAHEAD("final" | "@") {checkforBadInstanceOfPattern();} Pattern() - | - LOOKAHEAD("(") Pattern() {checkForParenthesizedInstanceOfPattern();} - | - LOOKAHEAD(ReferenceType() "(") RecordPattern() - | - Type() - [ {checkforBadInstanceOfPattern();} VariableDeclaratorId() #TypePattern(2) ] + // Note: this can be simplified when support for java 18 preview is removed. + // Here the production Pattern is inlined to avoid that a following conditional && + // be parsed as a pattern guard. + LOOKAHEAD("final" | (Annotation())* Type() ) {checkforBadInstanceOfPattern();} TypePattern() + | LOOKAHEAD((Annotation())* ReferenceType() "(") {checkForRecordPatterns();} RecordPattern() + | LOOKAHEAD("(") {checkForParenthesizedInstanceOfPattern();} ParenthesizedPattern() + | (Annotation())* Type() ) ] } @@ -2004,7 +2001,7 @@ void PrimaryPrefix() : | AllocationExpression() | LOOKAHEAD( ResultType() "." "class" ) ResultType() "." "class" | LOOKAHEAD( Name() "::" ) Name() // followed by method reference in PrimarySuffix -| LOOKAHEAD( "@" | Type() "::" ) (AnnotationNoNode())* (LOOKAHEAD(2) ReferenceType()|PrimitiveType()) // followed by method reference in PrimarySuffix +| LOOKAHEAD( "@" | Type() "::" ) (Annotation())* (LOOKAHEAD(2) ReferenceType()|PrimitiveType()) // followed by method reference in PrimarySuffix | Name() } @@ -2033,7 +2030,7 @@ void LambdaParameter() #FormalParameter : { ( "final" {jjtThis.setFinal(true);} | Annotation() )* LambdaParameterType() - [(AnnotationNoNode())* "..." {checkForBadVariableArgumentsUsage();} {jjtThis.setVarargs();} ] + [(TypeAnnotation())* "..." {checkForBadVariableArgumentsUsage();} {jjtThis.setVarargs();} ] VariableDeclaratorId() } @@ -2098,7 +2095,7 @@ void AllocationExpression(): PrimitiveType() ArrayDimsAndInits() | [TypeArguments()] - (AnnotationNoNode())* + (TypeAnnotation())* ClassOrInterfaceType() ( ArrayDimsAndInits() @@ -2121,10 +2118,9 @@ void AllocationExpression(): void ArrayDimsAndInits() : {} { - LOOKAHEAD((TypeAnnotation())* "[" "]") - ((AnnotationNoNode())* "[" "]" {jjtThis.bumpArrayDepth();})+ ArrayInitializer() -| ( LOOKAHEAD((TypeAnnotation())* "[" UnaryExprNotPmStart() ) (AnnotationNoNode())* "[" Expression() "]" {jjtThis.bumpArrayDepth();} )+ - ( LOOKAHEAD((TypeAnnotation())* "[") (AnnotationNoNode())* "[" "]" {jjtThis.bumpArrayDepth();} )* + LOOKAHEAD((TypeAnnotation())* "[" "]") ((TypeAnnotation())* "[" "]" {jjtThis.bumpArrayDepth();})+ ArrayInitializer() +| ( LOOKAHEAD((TypeAnnotation())* "[" UnaryExprNotPmStart() ) (TypeAnnotation())* "[" Expression() "]" {jjtThis.bumpArrayDepth();} )+ + ( LOOKAHEAD((TypeAnnotation())* "[") (TypeAnnotation())* "[" "]" {jjtThis.bumpArrayDepth();} )* } @@ -2549,15 +2545,6 @@ void RSIGNEDSHIFT(): // TODO 7.0.0 make #void /* Annotation syntax follows. */ - -// Todo PMD7 remove this, this is transitional in the PMD6 branch. -void AnnotationNoNode() #void: -{checkForBadTypeAnnotations();} -{ - Annotation() - {jjtree.popNode();} -} - void Annotation(): {} { diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTInstanceOfExpression.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTInstanceOfExpression.java index e20c5917bc3..2f14dad482c 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTInstanceOfExpression.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/ast/ASTInstanceOfExpression.java @@ -46,7 +46,7 @@ public Object jjtAccept(JavaParserVisitor visitor, Object data) { * Gets the type against which the expression is tested. */ public ASTType getTypeNode() { - JavaNode child = getChild(1); + JavaNode child = getChild(getNumChildren() - 1); return child instanceof ASTType ? (ASTType) child : ((ASTTypePattern) child).getTypeNode(); } diff --git a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTPatternTest.kt b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTPatternTest.kt index 1050fea4404..7862e26d66a 100644 --- a/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTPatternTest.kt +++ b/pmd-java/src/test/kotlin/net/sourceforge/pmd/lang/java/ast/ASTPatternTest.kt @@ -54,12 +54,11 @@ class ASTPatternTest : ParserTestSpec({ "obj instanceof @Deprecated Class c" should matchExpr { unspecifiedChild() child { -// TODO PMD 7 reenable -// child(ignoreChildren = true) { -// it.annotationName shouldBe "Deprecated" -// } -// -// it.isAnnotationPresent("java.lang.Deprecated") shouldBe true + child(ignoreChildren = true) { + it.annotationName shouldBe "Deprecated" + } + + it.isAnnotationPresent("java.lang.Deprecated") shouldBe true it::getTypeNode typeShouldBe child(ignoreChildren = true) {} diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt index c10b239bb72..00f533dd0ee 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/PatternMatchingInstanceof.txt @@ -379,6 +379,9 @@ | | | | +- PrimaryPrefix[@SuperModifier = false, @ThisModifier = false] | | | | +- Name[@Image = "obj"] | | | +- TypePattern[@ParenthesisDepth = 0] + | | | +- Annotation[@AnnotationName = "Deprecated"] + | | | | +- MarkerAnnotation[@AnnotationName = "Deprecated"] + | | | | +- Name[@Image = "Deprecated"] | | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"] | | | | +- ReferenceType[@Array = false, @ArrayDepth = 0] | | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt index d90f725a9e7..25289146b8a 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Records.txt @@ -198,6 +198,9 @@ | | +- Type[@Array = false, @ArrayDepth = 0, @ArrayType = false, @TypeImage = "String"] | | | +- ReferenceType[@Array = false, @ArrayDepth = 0] | | | +- ClassOrInterfaceType[@AnonymousClass = false, @Array = false, @ArrayDepth = 0, @Image = "String", @ReferenceToClassSameCompilationUnit = false] + | | +- Annotation[@AnnotationName = "Nullable"] + | | | +- MarkerAnnotation[@AnnotationName = "Nullable"] + | | | +- Name[@Image = "Nullable"] | | +- VariableDeclaratorId[@Array = false, @ArrayDepth = 0, @ArrayType = false, @ExceptionBlockParameter = false, @ExplicitReceiverParameter = false, @Field = false, @Final = true, @ForeachVariable = false, @FormalParameter = false, @Image = "x", @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @ResourceDeclaration = false, @TypeInferred = false, @VariableName = "x"] | +- RecordBody[] +- ClassOrInterfaceBodyDeclaration[@AnonymousInnerClass = false, @EnumChild = false, @Kind = DeclarationKind.RECORD] From 735197cff4a7a2bd79ea8ef4af5dc084730293b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 7 Nov 2022 00:44:22 +0100 Subject: [PATCH 15/34] Support other cases found in checkstyle --- pmd-java/etc/grammar/Java.jjt | 6 +++--- .../java/ast/jdkversiontests/java8/type_annotations.java | 3 +++ 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pmd-java/etc/grammar/Java.jjt b/pmd-java/etc/grammar/Java.jjt index f50de9e97a6..2a9a99a72bc 100644 --- a/pmd-java/etc/grammar/Java.jjt +++ b/pmd-java/etc/grammar/Java.jjt @@ -1460,7 +1460,7 @@ void ClassOrInterfaceBodyDeclaration(): | LOOKAHEAD({isKeyword("enum")}) EnumDeclaration(modifiers) | LOOKAHEAD({isKeyword("record")}) RecordDeclaration(modifiers) | LOOKAHEAD( [ TypeParameters() ] "(" ) ConstructorDeclaration(modifiers) - | LOOKAHEAD( Type() ( "[" "]" )* ( "," | "=" | ";" ) ) FieldDeclaration(modifiers) + | LOOKAHEAD( Type() ( (Annotation())* "[" "]" )* ( "," | "=" | ";" ) ) FieldDeclaration(modifiers) | LOOKAHEAD(2) MethodDeclaration(modifiers) | LOOKAHEAD(2) AnnotationTypeDeclaration(modifiers) ) @@ -2091,8 +2091,8 @@ void AllocationExpression(): {} { "new" - (LOOKAHEAD(2) - PrimitiveType() ArrayDimsAndInits() + (LOOKAHEAD((TypeAnnotation())* PrimitiveType()) + (TypeAnnotation())* PrimitiveType() ArrayDimsAndInits() | [TypeArguments()] (TypeAnnotation())* diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java8/type_annotations.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java8/type_annotations.java index 9940d49cab2..e7e878218b4 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java8/type_annotations.java +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java8/type_annotations.java @@ -12,6 +12,8 @@ class AnnotedArrayType { @NonNull int @NonNull[] @NonNull[] field1; @NonNull int @NonNull [] @NonNull [] field2; + private @NonNull int array2 @NonNull [] @NonNull []; + public String m2()@NonNull[]@NonNull[] { return null; } public String@NonNull[]@NonNull[] m2a() { return null; } public void run() { @@ -49,6 +51,7 @@ public final Rectangle2D.Double getRect2() { public final Rectangle2D.Double getRect3() { Rectangle2D.@TypeAnnotation Double rect = null; int[][] i = new int @TypeAnnotation [1] @TypeAnnotation[]; + int[][] i = new @TypeAnnotation int [1] @TypeAnnotation[]; return rect; } From eaa6d43eab15e3840c6ea5711fe1717386d14aaf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Mon, 7 Nov 2022 23:53:24 +0100 Subject: [PATCH 16/34] fix invalid test code --- .../lang/java/ast/jdkversiontests/java8/type_annotations.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java8/type_annotations.java b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java8/type_annotations.java index e7e878218b4..96df8a5624a 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java8/type_annotations.java +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java8/type_annotations.java @@ -51,7 +51,7 @@ public final Rectangle2D.Double getRect2() { public final Rectangle2D.Double getRect3() { Rectangle2D.@TypeAnnotation Double rect = null; int[][] i = new int @TypeAnnotation [1] @TypeAnnotation[]; - int[][] i = new @TypeAnnotation int [1] @TypeAnnotation[]; + i = new @TypeAnnotation int [1] @TypeAnnotation[]; return rect; } From 1b42676c1b33ee630061ebc6454a3170ccba26ed Mon Sep 17 00:00:00 2001 From: Jeroen van Wilgenburg <251901+jvwilge@users.noreply.github.com> Date: Wed, 9 Nov 2022 10:18:18 +0100 Subject: [PATCH 17/34] Add supported languages Languages were missing in the documentation --- docs/pages/pmd/userdocs/cpd/cpd.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/pages/pmd/userdocs/cpd/cpd.md b/docs/pages/pmd/userdocs/cpd/cpd.md index 22d594259b5..4bb9562baa8 100644 --- a/docs/pages/pmd/userdocs/cpd/cpd.md +++ b/docs/pages/pmd/userdocs/cpd/cpd.md @@ -220,8 +220,10 @@ This behavior has been introduced to ease CPD integration into scripts or hooks, * Dart * EcmaScript (JavaScript) * Fortran +* Gherkin (Cucumber) * Go * Groovy +* Html * Java * Jsp * Kotlin From 3eb291c8111e15c67f84b1043cdcc8d57c72b8ac Mon Sep 17 00:00:00 2001 From: LynnBroe Date: Thu, 10 Nov 2022 00:18:14 +0800 Subject: [PATCH 18/34] fix #4200 --- pmd-java/src/main/resources/category/java/design.xml | 2 ++ ...ClassWithOnlyPrivateConstructorsShouldBeFinal.xml | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/pmd-java/src/main/resources/category/java/design.xml b/pmd-java/src/main/resources/category/java/design.xml index 0146f66ff08..81f3de30475 100644 --- a/pmd-java/src/main/resources/category/java/design.xml +++ b/pmd-java/src/main/resources/category/java/design.xml @@ -339,6 +339,8 @@ is invoked by a inner class. + + + [java] ClassWithOnlyPrivateConstructorsShouldBeFinal should consider lombok's @Value #4200 + 0 + From f21f63b9059c453529acec946d80f46428b25f0c Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 10 Nov 2022 10:57:19 +0100 Subject: [PATCH 19/34] [java] Improve ClassNamingConventions for testClassPatterns Don't consider nested classes. Add TestCase as valid pattern by default. --- .../codestyle/ClassNamingConventionsRule.java | 4 +-- .../codestyle/xml/ClassNamingConventions.xml | 28 +++++++++++++++++++ 2 files changed, 30 insertions(+), 2 deletions(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java index 462bc7e49cd..d28281db86e 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/ClassNamingConventionsRule.java @@ -35,7 +35,7 @@ public class ClassNamingConventionsRule extends AbstractNamingConventionRule utilityClassRegex = defaultProp("utility class").build(); private final PropertyDescriptor testClassRegex = defaultProp("test class") .desc("Regex which applies to test class names. Since PMD 6.52.0.") - .defaultValue("[A-Z][a-zA-Z0-9]*Tests?").build(); + .defaultValue("^Test.*$|^[A-Z][a-zA-Z0-9]*Test(s|Case)?$").build(); public ClassNamingConventionsRule() { @@ -115,7 +115,7 @@ private boolean isMainMethod(ASTAnyTypeBodyDeclaration bodyDeclaration) { } private boolean isTestClass(ASTClassOrInterfaceDeclaration node) { - return AbstractJUnitRule.isTestClass(node.getFirstChildOfType(ASTClassOrInterfaceBody.class)); + return !node.isNested() && AbstractJUnitRule.isTestClass(node.getFirstChildOfType(ASTClassOrInterfaceBody.class)); } @Override diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/ClassNamingConventions.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/ClassNamingConventions.xml index 8a42551102b..d9b1853c1e0 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/ClassNamingConventions.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/ClassNamingConventions.xml @@ -387,6 +387,34 @@ public class Foo { public class FooTest { public void testBar() { } } +]]> + + + + Don't consider nested classes #2867 + 0 + + + + + TestCase should be a valid pattern by default #2867 + 0 + From a6256f90a5d20595ff763853503f2acd1dea8119 Mon Sep 17 00:00:00 2001 From: LynnBroe Date: Thu, 10 Nov 2022 18:00:07 +0800 Subject: [PATCH 20/34] fix #4201 --- .../codestyle/CommentDefaultAccessModifierRule.java | 3 ++- .../codestyle/xml/CommentDefaultAccessModifier.xml | 13 +++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java index f6f9fb0fbcc..f3167bddb21 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/codestyle/CommentDefaultAccessModifierRule.java @@ -66,6 +66,7 @@ protected Collection defaultSuppressionAnnotations() { ignoredStrings.add("org.junit.jupiter.api.BeforeAll"); ignoredStrings.add("org.junit.jupiter.api.AfterEach"); ignoredStrings.add("org.junit.jupiter.api.AfterAll"); + ignoredStrings.add("lombok.Value"); return ignoredStrings; } @@ -140,7 +141,7 @@ private boolean shouldReport(final AccessNode decl) { boolean isConcreteClass = parentClassOrInterface.getTypeKind() == ASTAnyTypeDeclaration.TypeKind.CLASS; // ignore if it's inside an interface / Annotation - return isConcreteClass && isMissingComment(decl); + return isConcreteClass && isMissingComment(decl) && !hasIgnoredAnnotation(parentClassOrInterface); } protected boolean hasIgnoredAnnotation(AccessNode node) { diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/CommentDefaultAccessModifier.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/CommentDefaultAccessModifier.xml index 3b3c76f2d88..085a0f7e2f7 100755 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/CommentDefaultAccessModifier.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/CommentDefaultAccessModifier.xml @@ -395,6 +395,19 @@ class SomeTest { @Test void test() {} +} + ]]> + + + + [java] CommentDefaultAccessModifier should consider lombok's @Value #4201 + 0 + From b2e580863b0f8bcfacac972134f0b697f6218d20 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 10 Nov 2022 11:13:12 +0100 Subject: [PATCH 21/34] Add @jvwilge as a contributor --- .all-contributorsrc | 9 ++ docs/pages/pmd/projectdocs/credits.md | 145 +++++++++++++------------- 2 files changed, 82 insertions(+), 72 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 41897ad6901..9c4e2cfc8fe 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6988,6 +6988,15 @@ "contributions": [ "doc" ] + }, + { + "login": "jvwilge", + "name": "Jeroen van Wilgenburg", + "avatar_url": "https://avatars.githubusercontent.com/u/251901?v=4", + "profile": "https://vanwilgenburg.wordpress.com/", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 989c94097ba..fae30463d07 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -340,652 +340,653 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Jens Gerdes

๐Ÿ›
Jeroen Borgers

๐Ÿ› ๐Ÿ’ป ๐Ÿ“ข +
Jeroen van Wilgenburg

๐Ÿ“–
Jerome Russ

๐Ÿ›
JerritEic

๐Ÿ’ป ๐Ÿ“– ๐Ÿ›
Jiri Pejchal

๐Ÿ›
Jithin Sunny

๐Ÿ› -
Jiล™รญ ล korpil

๐Ÿ› +
Jiล™รญ ล korpil

๐Ÿ›
Joao Machado

๐Ÿ›
Jochen Krauss

๐Ÿ›
Johan Hammar

๐Ÿ›
John Karp

๐Ÿ›
John Zhang

๐Ÿ›
John-Teng

๐Ÿ’ป ๐Ÿ› -
Jon Moroney

๐Ÿ’ป ๐Ÿ› +
Jon Moroney

๐Ÿ’ป ๐Ÿ›
Jonas Geiregat

๐Ÿ›
Jonathan Wiesel

๐Ÿ’ป ๐Ÿ›
Jordan

๐Ÿ›
Jordi Llach

๐Ÿ›
Jorge Solรณrzano

๐Ÿ›
JorneVL

๐Ÿ› -
Jose Palafox

๐Ÿ› +
Jose Palafox

๐Ÿ›
Jose Stovall

๐Ÿ›
Joseph

๐Ÿ’ป
Joseph Heenan

๐Ÿ›
Josh Feingold

๐Ÿ’ป ๐Ÿ›
Josh Holthaus

๐Ÿ›
Joshua S Arquilevich

๐Ÿ› -
Joรฃo Ferreira

๐Ÿ’ป ๐Ÿ› +
Joรฃo Ferreira

๐Ÿ’ป ๐Ÿ›
Joรฃo Pedro Schmitt

๐Ÿ›
Juan Martรญn Sotuyo Dodero

๐Ÿ’ป ๐Ÿ“– ๐Ÿ› ๐Ÿšง
Juan Pablo Civile

๐Ÿ›
Julian Voronetsky

๐Ÿ›
Julien

๐Ÿ›
Julius

๐Ÿ› -
JustPRV

๐Ÿ› +
JustPRV

๐Ÿ›
Jรถrn Huxhorn

๐Ÿ›
KThompso

๐Ÿ›
Kai Amundsen

๐Ÿ›
Karel Vervaeke

๐Ÿ›
Karl-Andero Mere

๐Ÿ›
Karl-Philipp Richter

๐Ÿ› -
Karsten Silz

๐Ÿ› +
Karsten Silz

๐Ÿ›
Kazuma Watanabe

๐Ÿ›
Kev

๐Ÿ›
Keve Mรผller

๐Ÿ›
Kevin Guerra

๐Ÿ’ป
Kevin Jones

๐Ÿ›
Kevin Wayne

๐Ÿ› -
Kieran Black

๐Ÿ› +
Kieran Black

๐Ÿ›
Kirill Zubov

๐Ÿ›
Kirk Clemens

๐Ÿ’ป ๐Ÿ›
Klaus Hartl

๐Ÿ›
Koen Van Looveren

๐Ÿ›
Kris Scheibe

๐Ÿ’ป ๐Ÿ›
Kunal Thanki

๐Ÿ› -
LaLucid

๐Ÿ’ป +
LaLucid

๐Ÿ’ป
Larry Diamond

๐Ÿ’ป ๐Ÿ›
Lars Knickrehm

๐Ÿ›
Leo Gutierrez

๐Ÿ›
LiGaOg

๐Ÿ’ป
Lintsi

๐Ÿ›
Linus Fernandes

๐Ÿ› -
Lixon Lookose

๐Ÿ› +
Lixon Lookose

๐Ÿ›
Logesh

๐Ÿ›
Lorenzo Gabriele

๐Ÿ›
Loรฏc Ledoyen

๐Ÿ›
Lucas Silva

๐Ÿ›
Lucas Soncini

๐Ÿ’ป ๐Ÿ›
Luis Alcantar

๐Ÿ’ป -
Lukasz Slonina

๐Ÿ› +
Lukasz Slonina

๐Ÿ›
Lukebray

๐Ÿ›
Lynn

๐Ÿ’ป ๐Ÿ›
Lyor Goldstein

๐Ÿ›
MCMicS

๐Ÿ›
Macarse

๐Ÿ›
Machine account for PMD

๐Ÿ’ป -
Maciek Siemczyk

๐Ÿ› +
Maciek Siemczyk

๐Ÿ›
Maikel Steneker

๐Ÿ’ป ๐Ÿ›
Maksim Moiseikin

๐Ÿ›
Manfred Koch

๐Ÿ›
Manuel Moya Ferrer

๐Ÿ’ป ๐Ÿ›
Manuel Ryan

๐Ÿ›
Marat Vyshegorodtsev

๐Ÿ› -
Marcel Hรคrle

๐Ÿ› +
Marcel Hรคrle

๐Ÿ›
Marcello Fialho

๐Ÿ›
Marcin Rataj

๐Ÿ›
Mark Adamcin

๐Ÿ›
Mark Hall

๐Ÿ’ป ๐Ÿ›
Mark Kolich

๐Ÿ›
Mark Pritchard

๐Ÿ› -
Markus Rathgeb

๐Ÿ› +
Markus Rathgeb

๐Ÿ›
Marquis Wang

๐Ÿ›
MartGit

๐Ÿ›
Martin Feldsztejn

๐Ÿ›
Martin Lehmann

๐Ÿ›
Martin Spamer

๐Ÿ›
Martin Tarjรกnyi

๐Ÿ› -
MatFl

๐Ÿ› +
MatFl

๐Ÿ›
Mateusz Stefanski

๐Ÿ›
Mathieu Gouin

๐Ÿ›
MatiasComercio

๐Ÿ’ป ๐Ÿ›
Matt Benson

๐Ÿ›
Matt De Poorter

๐Ÿ›
Matt Hargett

๐Ÿ’ป ๐Ÿ’ต -
Matt Harrah

๐Ÿ› +
Matt Harrah

๐Ÿ›
Matt Nelson

๐Ÿ›
Matthew Amos

๐Ÿ›
Matthew Duggan

๐Ÿ›
Matthew Hall

๐Ÿ›
Matรญas Fraga

๐Ÿ’ป ๐Ÿ›
Maxime Robert

๐Ÿ’ป ๐Ÿ› -
MetaBF

๐Ÿ› +
MetaBF

๐Ÿ›
Michael

๐Ÿ›
Michael Bell

๐Ÿ›
Michael Bernstein

๐Ÿ›
Michael Clay

๐Ÿ›
Michael Dombrowski

๐Ÿ›
Michael Hausegger

๐Ÿ› -
Michael Hoefer

๐Ÿ› +
Michael Hoefer

๐Ÿ›
Michael Mรถbius

๐Ÿ›
Michael N. Lipp

๐Ÿ›
Michael Pellegrini

๐Ÿ›
Michal Kordas

๐Ÿ›
Michaล‚ Borek

๐Ÿ›
Michaล‚ Kuliล„ski

๐Ÿ› -
Miguel Nรบรฑez Dรญaz-Montes

๐Ÿ› +
Miguel Nรบรฑez Dรญaz-Montes

๐Ÿ›
Mihai Ionut

๐Ÿ›
Mirek Hankus

๐Ÿ›
Mladjan Gadzic

๐Ÿ›
MrAngry52

๐Ÿ›
Muminur Choudhury

๐Ÿ›
Mykhailo Palahuta

๐Ÿ’ป ๐Ÿ› -
Nagendra Kumar Singh

๐Ÿ› +
Nagendra Kumar Singh

๐Ÿ›
Nahuel Barrios

๐Ÿ›
Nathan Braun

๐Ÿ›
Nathan Reynolds

๐Ÿ›
Nathan Reynolds

๐Ÿ›
Nathanaรซl

๐Ÿ›
Naveen

๐Ÿ’ป -
Nazdravi

๐Ÿ› +
Nazdravi

๐Ÿ›
Neha-Dhonde

๐Ÿ›
Nicholas Doyle

๐Ÿ›
Nick Butcher

๐Ÿ›
Nico Gallinal

๐Ÿ›
Nicola Dal Maso

๐Ÿ›
Nicolas Filotto

๐Ÿ’ป -
Nicolas Vuillamy

๐Ÿ“– +
Nicolas Vuillamy

๐Ÿ“–
Nikita Chursin

๐Ÿ›
Niklas Baudy

๐Ÿ›
Nikolas Havrikov

๐Ÿ›
Nilesh Virkar

๐Ÿ›
Nimit Patel

๐Ÿ›
Niranjan Harpale

๐Ÿ› -
Noah Sussman

๐Ÿ› +
Noah Sussman

๐Ÿ›
Noah0120

๐Ÿ›
Noam Tamim

๐Ÿ›
Noel Grandin

๐Ÿ›
Olaf Haalstra

๐Ÿ›
Oleg Andreych

๐Ÿ’ป ๐Ÿ›
Oleg Pavlenko

๐Ÿ› -
Oleksii Dykov

๐Ÿ’ป ๐Ÿ› +
Oleksii Dykov

๐Ÿ’ป ๐Ÿ›
Oliver Eikemeier

๐Ÿ›
Oliver Siegmar

๐Ÿ’ต
Olivier Parent

๐Ÿ’ป ๐Ÿ›
Ollie Abbey

๐Ÿ’ป ๐Ÿ›
OverDrone

๐Ÿ›
Ozan Gulle

๐Ÿ’ป ๐Ÿ› -
PUNEET JAIN

๐Ÿ› +
PUNEET JAIN

๐Ÿ›
Parbati Bose

๐Ÿ›
Paul Berg

๐Ÿ›
Pavel Bludov

๐Ÿ›
Pavel Miฤka

๐Ÿ›
Pedro Nuno Santos

๐Ÿ›
Pedro Rijo

๐Ÿ› -
Pelisse Romain

๐Ÿ’ป ๐Ÿ“– ๐Ÿ› +
Pelisse Romain

๐Ÿ’ป ๐Ÿ“– ๐Ÿ›
Per Abich

๐Ÿ’ป
Pete Davids

๐Ÿ›
Peter Bruin

๐Ÿ›
Peter Chittum

๐Ÿ’ป ๐Ÿ›
Peter Cudmore

๐Ÿ›
Peter Kasson

๐Ÿ› -
Peter Kofler

๐Ÿ› +
Peter Kofler

๐Ÿ›
Peter Paul Bakker

๐Ÿ’ป
Pham Hai Trung

๐Ÿ›
Philip Graf

๐Ÿ’ป ๐Ÿ›
Philip Hachey

๐Ÿ›
Philippe Ozil

๐Ÿ›
Phinehas Artemix

๐Ÿ› -
Phokham Nonava

๐Ÿ› +
Phokham Nonava

๐Ÿ›
Piotr Szymaล„ski

๐Ÿ›
Piotrek ลปygieล‚o

๐Ÿ’ป ๐Ÿ› ๐Ÿ“–
Pranay Jaiswal

๐Ÿ›
Prasad Kamath

๐Ÿ›
Prasanna

๐Ÿ›
Presh-AR

๐Ÿ› -
Puneet1726

๐Ÿ› +
Puneet1726

๐Ÿ›
Rafael Cortรชs

๐Ÿ›
RaheemShaik999

๐Ÿ›
RajeshR

๐Ÿ’ป ๐Ÿ›
Ramachandra Mohan

๐Ÿ›
Ramel0921

๐Ÿ›
Raquel Pau

๐Ÿ› -
Ravikiran Janardhana

๐Ÿ› +
Ravikiran Janardhana

๐Ÿ›
Reda Benhemmouche

๐Ÿ›
Renato Oliveira

๐Ÿ’ป ๐Ÿ›
Rich DiCroce

๐Ÿ›
Riot R1cket

๐Ÿ›
Rishabh Jain

๐Ÿ›
RishabhDeep Singh

๐Ÿ› -
Robbie Martinus

๐Ÿ’ป ๐Ÿ› +
Robbie Martinus

๐Ÿ’ป ๐Ÿ›
Robert Henry

๐Ÿ›
Robert Painsi

๐Ÿ›
Robert Russell

๐Ÿ›
Robert Sรถsemann

๐Ÿ’ป ๐Ÿ“– ๐Ÿ“ข ๐Ÿ›
Robert Whitebit

๐Ÿ›
Robin Richtsfeld

๐Ÿ› -
Robin Stocker

๐Ÿ’ป ๐Ÿ› +
Robin Stocker

๐Ÿ’ป ๐Ÿ›
Robin Wils

๐Ÿ›
RochusOest

๐Ÿ›
Rodolfo Noviski

๐Ÿ›
Rodrigo Casara

๐Ÿ›
Rodrigo Fernandes

๐Ÿ›
Roman Salvador

๐Ÿ’ป ๐Ÿ› -
Ronald Blaschke

๐Ÿ› +
Ronald Blaschke

๐Ÿ›
Rรณbert Papp

๐Ÿ›
Saikat Sengupta

๐Ÿ›
Saksham Handu

๐Ÿ›
Saladoc

๐Ÿ›
Salesforce Bob Lightning

๐Ÿ›
Sam Carlberg

๐Ÿ› -
Satoshi Kubo

๐Ÿ› +
Satoshi Kubo

๐Ÿ›
Scott Kennedy

๐Ÿ›
Scott Wells

๐Ÿ› ๐Ÿ’ป
Scrsloota

๐Ÿ’ป
Sebastian Bรถgl

๐Ÿ›
Sebastian Schuberth

๐Ÿ›
Sebastian Schwarz

๐Ÿ› -
Sergey Gorbaty

๐Ÿ› +
Sergey Gorbaty

๐Ÿ›
Sergey Kozlov

๐Ÿ›
Sergey Yanzin

๐Ÿ’ป ๐Ÿ›
Seth Wilcox

๐Ÿ’ป
Shubham

๐Ÿ’ป ๐Ÿ›
Simon Abykov

๐Ÿ’ป ๐Ÿ›
Simon Xiao

๐Ÿ› -
Srinivasan Venkatachalam

๐Ÿ› +
Srinivasan Venkatachalam

๐Ÿ›
Stanislav Gromov

๐Ÿ›
Stanislav Myachenkov

๐Ÿ’ป
Stefan Birkner

๐Ÿ›
Stefan Bohn

๐Ÿ›
Stefan Endrullis

๐Ÿ›
Stefan Klรถss-Schuster

๐Ÿ› -
Stefan Wolf

๐Ÿ› +
Stefan Wolf

๐Ÿ›
Stephan H. Wissel

๐Ÿ›
Stephen

๐Ÿ›
Stephen Friedrich

๐Ÿ›
Steve Babula

๐Ÿ’ป
Stexxe

๐Ÿ›
Stian Lรฅgstad

๐Ÿ› -
StuartClayton5

๐Ÿ› +
StuartClayton5

๐Ÿ›
Supun Arunoda

๐Ÿ›
Suren Abrahamyan

๐Ÿ›
Suvashri

๐Ÿ“–
SwatiBGupta1110

๐Ÿ›
SyedThoufich

๐Ÿ›
Szymon Sasin

๐Ÿ› -
T-chuangxin

๐Ÿ› +
T-chuangxin

๐Ÿ›
TERAI Atsuhiro

๐Ÿ›
TIOBE Software

๐Ÿ’ป ๐Ÿ›
Taylor Smock

๐Ÿ›
Techeira Damiรกn

๐Ÿ’ป ๐Ÿ›
Ted Husted

๐Ÿ›
TehBakker

๐Ÿ› -
The Gitter Badger

๐Ÿ› +
The Gitter Badger

๐Ÿ›
Theodoor

๐Ÿ›
Thiago Henrique Hรผpner

๐Ÿ›
Thibault Meyer

๐Ÿ›
Thomas Gรผttler

๐Ÿ›
Thomas Jones-Low

๐Ÿ›
Thomas Smith

๐Ÿ’ป ๐Ÿ› -
ThrawnCA

๐Ÿ› +
ThrawnCA

๐Ÿ›
Thunderforge

๐Ÿ’ป ๐Ÿ›
Tim van der Lippe

๐Ÿ›
Tobias Weimer

๐Ÿ’ป ๐Ÿ›
Tom Copeland

๐Ÿ› ๐Ÿ’ป ๐Ÿ“–
Tom Daly

๐Ÿ›
Tomer Figenblat

๐Ÿ› -
Tomi De Lucca

๐Ÿ’ป ๐Ÿ› +
Tomi De Lucca

๐Ÿ’ป ๐Ÿ›
Torsten Kleiber

๐Ÿ›
TrackerSB

๐Ÿ›
Tyson Stewart

๐Ÿ›
Ullrich Hafner

๐Ÿ›
Utku Cuhadaroglu

๐Ÿ’ป ๐Ÿ›
Valentin Brandl

๐Ÿ› -
Valeria

๐Ÿ› +
Valeria

๐Ÿ›
Valery Yatsynovich

๐Ÿ“–
Vasily Anisimov

๐Ÿ›
Vibhor Goyal

๐Ÿ›
Vickenty Fesunov

๐Ÿ›
Victor Noรซl

๐Ÿ›
Vincent Galloy

๐Ÿ’ป -
Vincent HUYNH

๐Ÿ› +
Vincent HUYNH

๐Ÿ›
Vincent Maurin

๐Ÿ›
Vincent Privat

๐Ÿ›
Vishhwas

๐Ÿ›
Vitaly

๐Ÿ›
Vitaly Polonetsky

๐Ÿ›
Vojtech Polivka

๐Ÿ› -
Vsevolod Zholobov

๐Ÿ› +
Vsevolod Zholobov

๐Ÿ›
Vyom Yadav

๐Ÿ’ป
Wang Shidong

๐Ÿ›
Waqas Ahmed

๐Ÿ›
Wayne J. Earl

๐Ÿ›
Wchenghui

๐Ÿ›
Will Winder

๐Ÿ› -
William Brockhus

๐Ÿ’ป ๐Ÿ› +
William Brockhus

๐Ÿ’ป ๐Ÿ›
Wilson Kurniawan

๐Ÿ›
Wim Deblauwe

๐Ÿ›
Woongsik Choi

๐Ÿ›
XenoAmess

๐Ÿ’ป ๐Ÿ›
Yang

๐Ÿ’ป
YaroslavTER

๐Ÿ› -
Yasar Shaikh

๐Ÿ’ป +
Yasar Shaikh

๐Ÿ’ป
Young Chan

๐Ÿ’ป ๐Ÿ›
YuJin Kim

๐Ÿ›
Yuri Dolzhenko

๐Ÿ›
Yurii Dubinka

๐Ÿ›
Zoltan Farkas

๐Ÿ›
Zustin

๐Ÿ› -
aaronhurst-google

๐Ÿ› ๐Ÿ’ป +
aaronhurst-google

๐Ÿ› ๐Ÿ’ป
alexmodis

๐Ÿ›
andreoss

๐Ÿ›
andrey81inmd

๐Ÿ’ป ๐Ÿ›
anicoara

๐Ÿ›
arunprasathav

๐Ÿ›
asiercamara

๐Ÿ› -
astillich-igniti

๐Ÿ’ป +
astillich-igniti

๐Ÿ’ป
avesolovksyy

๐Ÿ›
avishvat

๐Ÿ›
avivmu

๐Ÿ›
axelbarfod1

๐Ÿ›
b-3-n

๐Ÿ›
balbhadra9

๐Ÿ› -
base23de

๐Ÿ› +
base23de

๐Ÿ›
bergander

๐Ÿ›
berkam

๐Ÿ’ป ๐Ÿ›
breizh31

๐Ÿ›
caesarkim

๐Ÿ›
carolyujing

๐Ÿ›
cbfiddle

๐Ÿ› -
cesares-basilico

๐Ÿ› +
cesares-basilico

๐Ÿ›
chrite

๐Ÿ›
cobratbq

๐Ÿ›
coladict

๐Ÿ›
cosmoJFH

๐Ÿ›
cristalp

๐Ÿ›
crunsk

๐Ÿ› -
cwholmes

๐Ÿ› +
cwholmes

๐Ÿ›
cyberjj999

๐Ÿ›
cyw3

๐Ÿ›
d1ss0nanz

๐Ÿ›
dalizi007

๐Ÿ’ป
danbrycefairsailcom

๐Ÿ›
dariansanity

๐Ÿ› -
darrenmiliband

๐Ÿ› +
darrenmiliband

๐Ÿ›
davidburstrom

๐Ÿ›
dbirkman-paloalto

๐Ÿ›
deepak-patra

๐Ÿ›
dependabot[bot]

๐Ÿ’ป ๐Ÿ›
dinesh150

๐Ÿ›
diziaq

๐Ÿ› -
dreaminpast123

๐Ÿ› +
dreaminpast123

๐Ÿ›
duanyanan

๐Ÿ›
dutt-sanjay

๐Ÿ›
dylanleung

๐Ÿ›
dzeigler

๐Ÿ›
ekkirala

๐Ÿ›
emersonmoura

๐Ÿ› -
fairy

๐Ÿ› +
fairy

๐Ÿ›
filiprafalowicz

๐Ÿ’ป
foxmason

๐Ÿ›
frankegabor

๐Ÿ›
frankl

๐Ÿ›
freafrea

๐Ÿ›
fsapatin

๐Ÿ› -
gracia19

๐Ÿ› +
gracia19

๐Ÿ›
guo fei

๐Ÿ›
gurmsc5

๐Ÿ›
gwilymatgearset

๐Ÿ’ป ๐Ÿ›
haigsn

๐Ÿ›
hemanshu070

๐Ÿ›
henrik242

๐Ÿ› -
hongpuwu

๐Ÿ› +
hongpuwu

๐Ÿ›
hvbtup

๐Ÿ’ป ๐Ÿ›
igniti GmbH

๐Ÿ›
ilovezfs

๐Ÿ›
itaigilo

๐Ÿ›
jakivey32

๐Ÿ›
jbennett2091

๐Ÿ› -
jcamerin

๐Ÿ› +
jcamerin

๐Ÿ›
jkeener1

๐Ÿ›
jmetertea

๐Ÿ›
johnra2

๐Ÿ’ป
josemanuelrolon

๐Ÿ’ป ๐Ÿ›
kabroxiko

๐Ÿ’ป ๐Ÿ›
karwer

๐Ÿ› -
kaulonline

๐Ÿ› +
kaulonline

๐Ÿ›
kdaemonv

๐Ÿ›
kenji21

๐Ÿ’ป ๐Ÿ›
kfranic

๐Ÿ›
khalidkh

๐Ÿ›
koalalam

๐Ÿ›
krzyk

๐Ÿ› -
lasselindqvist

๐Ÿ› +
lasselindqvist

๐Ÿ›
lgemeinhardt

๐Ÿ›
lihuaib

๐Ÿ›
lonelyma1021

๐Ÿ›
lpeddy

๐Ÿ›
lujiefsi

๐Ÿ’ป
lukelukes

๐Ÿ’ป -
lyriccoder

๐Ÿ› +
lyriccoder

๐Ÿ›
marcelmore

๐Ÿ›
matchbox

๐Ÿ›
matthiaskraaz

๐Ÿ›
meandonlyme

๐Ÿ›
mikesive

๐Ÿ›
milossesic

๐Ÿ› -
mohan-chinnappan-n

๐Ÿ’ป +
mohan-chinnappan-n

๐Ÿ’ป
mriddell95

๐Ÿ›
mrlzh

๐Ÿ›
msloan

๐Ÿ›
mucharlaravalika

๐Ÿ›
mvenneman

๐Ÿ›
nareshl119

๐Ÿ› -
nicolas-harraudeau-sonarsource

๐Ÿ› +
nicolas-harraudeau-sonarsource

๐Ÿ›
noerremark

๐Ÿ›
novsirion

๐Ÿ›
oggboy

๐Ÿ›
oinume

๐Ÿ›
orimarko

๐Ÿ’ป ๐Ÿ›
pacvz

๐Ÿ’ป -
pallavi agarwal

๐Ÿ› +
pallavi agarwal

๐Ÿ›
parksungrin

๐Ÿ›
patpatpat123

๐Ÿ›
patriksevallius

๐Ÿ›
pbrajesh1

๐Ÿ›
phoenix384

๐Ÿ›
piotrszymanski-sc

๐Ÿ’ป -
plan3d

๐Ÿ› +
plan3d

๐Ÿ›
poojasix

๐Ÿ›
prabhushrikant

๐Ÿ›
pujitha8783

๐Ÿ›
r-r-a-j

๐Ÿ›
raghujayjunk

๐Ÿ›
rajeshveera

๐Ÿ› -
rajeswarreddy88

๐Ÿ› +
rajeswarreddy88

๐Ÿ›
recdevs

๐Ÿ›
reudismam

๐Ÿ’ป ๐Ÿ›
rijkt

๐Ÿ›
rillig-tk

๐Ÿ›
rmohan20

๐Ÿ’ป ๐Ÿ›
rnveach

๐Ÿ› -
rxmicro

๐Ÿ› +
rxmicro

๐Ÿ›
ryan-gustafson

๐Ÿ’ป ๐Ÿ›
sabi0

๐Ÿ›
scais

๐Ÿ›
sebbASF

๐Ÿ›
sergeygorbaty

๐Ÿ’ป
shilko2013

๐Ÿ› -
shiomiyan

๐Ÿ“– +
shiomiyan

๐Ÿ“–
simeonKondr

๐Ÿ›
snajberk

๐Ÿ›
sniperrifle2004

๐Ÿ›
snuyanzin

๐Ÿ› ๐Ÿ’ป
sratz

๐Ÿ›
stonio

๐Ÿ› -
sturton

๐Ÿ’ป ๐Ÿ› +
sturton

๐Ÿ’ป ๐Ÿ›
sudharmohan

๐Ÿ›
suruchidawar

๐Ÿ›
svenfinitiv

๐Ÿ›
tashiscool

๐Ÿ›
test-git-hook

๐Ÿ›
testation21

๐Ÿ’ป ๐Ÿ› -
thanosa

๐Ÿ› +
thanosa

๐Ÿ›
tiandiyixian

๐Ÿ›
tobwoerk

๐Ÿ›
tprouvot

๐Ÿ› ๐Ÿ’ป
trentchilders

๐Ÿ›
triandicAnt

๐Ÿ›
trishul14

๐Ÿ› -
tsui

๐Ÿ› +
tsui

๐Ÿ›
winhkey

๐Ÿ›
witherspore

๐Ÿ›
wjljack

๐Ÿ›
wuchiuwong

๐Ÿ›
xingsong

๐Ÿ›
xioayuge

๐Ÿ› -
xnYi9wRezm

๐Ÿ’ป ๐Ÿ› +
xnYi9wRezm

๐Ÿ’ป ๐Ÿ›
xuanuy

๐Ÿ›
xyf0921

๐Ÿ›
yalechen-cyw3

๐Ÿ›
yasuharu-sato

๐Ÿ›
zenglian

๐Ÿ›
zgrzyt93

๐Ÿ’ป ๐Ÿ› -
zh3ng

๐Ÿ› +
zh3ng

๐Ÿ›
zt_soft

๐Ÿ›
ztt79

๐Ÿ›
zzzzfeng

๐Ÿ› From 81dd7e5688baa49faf3e4d0b3c380a2728d0ff67 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Thu, 10 Nov 2022 11:13:26 +0100 Subject: [PATCH 22/34] [doc] Update release notes (#4198) --- docs/pages/release_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index e6743000d8d..9899c461f33 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -20,6 +20,7 @@ This is a {{ site.pmd.release_type }} release. ### External Contributions * [#4184](https://github.com/pmd/pmd/pull/4184): \[java]\[doc] TestClassWithoutTestCases - fix small typo in description - [Valery Yatsynovich](https://github.com/valfirst) (@valfirst) +* [#4198](https://github.com/pmd/pmd/pull/4198): \[doc] Add supported CPD languages - [Jeroen van Wilgenburg](https://github.com/jvwilge) (@jvwilge) {% endtocmaker %} From 6c5c34bb03dd1ca0825e556f3e0a96659af1e39f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 10 Nov 2022 12:26:46 -0300 Subject: [PATCH 23/34] Update docs/pages/pmd/userdocs/cli_reference.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Clรฉment Fournier --- docs/pages/pmd/userdocs/cli_reference.md | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/docs/pages/pmd/userdocs/cli_reference.md b/docs/pages/pmd/userdocs/cli_reference.md index d4aa8822b69..5e28616aad1 100644 --- a/docs/pages/pmd/userdocs/cli_reference.md +++ b/docs/pages/pmd/userdocs/cli_reference.md @@ -103,9 +103,12 @@ The tool comes with a rather extensive help text, simply running with `--help`! %} {% include custom/cli_option_row.html options="--use-version" option_arg="lang-version" - description="The language version PMD should use when parsing source code. + description="The specific language version PMD should use when parsing source code for a given language.

Values are in the format of *language-version*.

-

This option can be repeated to configure multiple languages to be analyzed during a single run

+

This option can be repeated to configure several languages for the same run.

+

Note that this option does not change how languages are assigned to files. + It only changes something if the project you analyze contains some files that PMD detects as the given language. + Language detection is only influenced by file extensions and the `--force-language` option.

See also [Supported Languages](#supported-languages).

" %} {% include custom/cli_option_row.html options="-language,-l" From c513d72d592adf9486ab2974db828249ff9c740c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Juan=20Mart=C3=ADn=20Sotuyo=20Dodero?= Date: Thu, 10 Nov 2022 12:33:52 -0300 Subject: [PATCH 24/34] Fix typo --- docs/pages/release_notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 0668f0c6e5e..f6b0209ef80 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -29,7 +29,7 @@ This supersedes the usage of `-language` / `-l` and `-version` / `-v`, allowing PMD 7 will completely remove support for `-language` and `-version` in favor of this new flag. * Support for `-V` is being deprecated in favor of `--verbose` in preparation for PMD 7. -In PMD 7, `-v` will enable verbose mode and `-V` will show the PMD version for conssitency with most Unix/Linux tools. +In PMD 7, `-v` will enable verbose mode and `-V` will show the PMD version for consistency with most Unix/Linux tools. * Support for `-min` is being deprecated in favor of `--minimum-priority` for consistency with most Unix/Linux tools, where `-min` would be equivalent to `-m -i -n`. From ed1e84ec5825507940d8236ab5a3c42d05154e00 Mon Sep 17 00:00:00 2001 From: Eldrick Wega Date: Thu, 10 Nov 2022 23:33:08 +0000 Subject: [PATCH 25/34] Provide Scala Update --- README.md | 3 +- package-lock.json | 697 +--------------------------------------------- 2 files changed, 3 insertions(+), 697 deletions(-) diff --git a/README.md b/README.md index 6874690e229..23d218722b5 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,8 @@ It uses JavaCC and Antlr to parse source files into abstract syntax trees (AST) Rules can be written in Java or using a XPath query. It supports Java, JavaScript, Salesforce.com Apex and Visualforce, -Modelica, PLSQL, Apache Velocity, XML, XSL, Scala. +Modelica, PLSQL, Apache Velocity, XML, XSL. +Scala is supported, but there are currently no Scala rules available. Additionally it includes **CPD**, the copy-paste-detector. CPD finds duplicated code in C/C++, C#, Dart, Fortran, Go, Groovy, Java, JavaScript, JSP, Kotlin, Lua, Matlab, Modelica, diff --git a/package-lock.json b/package-lock.json index 766fca3610a..0b8d2e6f488 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,701 +1,6 @@ { - "name": "pmd", - "lockfileVersion": 2, "requires": true, - "packages": { - "": { - "devDependencies": { - "all-contributors-cli": "^6.20.0" - } - }, - "node_modules/@babel/runtime": { - "version": "7.16.7", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz", - "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==", - "dev": true, - "dependencies": { - "regenerator-runtime": "^0.13.4" - }, - "engines": { - "node": ">=6.9.0" - } - }, - "node_modules/all-contributors-cli": { - "version": "6.20.0", - "resolved": "https://registry.npmjs.org/all-contributors-cli/-/all-contributors-cli-6.20.0.tgz", - "integrity": "sha512-trEQlL1s1u8FSWSwY2w9uL4GCG7Fo9HIW5rm5LtlE0SQHSolfXQBzJib07Qes5j52/t72wjuE6sEKkuRrwiuuQ==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.7.6", - "async": "^3.0.1", - "chalk": "^4.0.0", - "didyoumean": "^1.2.1", - "inquirer": "^7.0.4", - "json-fixer": "^1.5.1", - "lodash": "^4.11.2", - "node-fetch": "^2.6.0", - "pify": "^5.0.0", - "yargs": "^15.0.1" - }, - "bin": { - "all-contributors": "dist/cli.js" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/ansi-escapes": { - "version": "4.3.2", - "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", - "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", - "dev": true, - "dependencies": { - "type-fest": "^0.21.3" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/ansi-regex": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", - "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/ansi-styles": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", - "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, - "dependencies": { - "color-convert": "^2.0.1" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/chalk/ansi-styles?sponsor=1" - } - }, - "node_modules/async": { - "version": "3.2.3", - "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", - "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", - "dev": true - }, - "node_modules/camelcase": { - "version": "5.3.1", - "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", - "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/chalk": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", - "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.1.0", - "supports-color": "^7.1.0" - }, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/chalk/chalk?sponsor=1" - } - }, - "node_modules/chardet": { - "version": "0.7.0", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", - "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", - "dev": true - }, - "node_modules/cli-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", - "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", - "dev": true, - "dependencies": { - "restore-cursor": "^3.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/cli-width": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", - "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", - "dev": true, - "engines": { - "node": ">= 10" - } - }, - "node_modules/cliui": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", - "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", - "dev": true, - "dependencies": { - "string-width": "^4.2.0", - "strip-ansi": "^6.0.0", - "wrap-ansi": "^6.2.0" - } - }, - "node_modules/color-convert": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", - "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, - "dependencies": { - "color-name": "~1.1.4" - }, - "engines": { - "node": ">=7.0.0" - } - }, - "node_modules/color-name": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true - }, - "node_modules/decamelize": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", - "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/didyoumean": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", - "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", - "dev": true - }, - "node_modules/emoji-regex": { - "version": "8.0.0", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true - }, - "node_modules/escape-string-regexp": { - "version": "1.0.5", - "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", - "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", - "dev": true, - "engines": { - "node": ">=0.8.0" - } - }, - "node_modules/external-editor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", - "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", - "dev": true, - "dependencies": { - "chardet": "^0.7.0", - "iconv-lite": "^0.4.24", - "tmp": "^0.0.33" - }, - "engines": { - "node": ">=4" - } - }, - "node_modules/figures": { - "version": "3.2.0", - "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", - "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", - "dev": true, - "dependencies": { - "escape-string-regexp": "^1.0.5" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/find-up": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", - "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", - "dev": true, - "dependencies": { - "locate-path": "^5.0.0", - "path-exists": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/get-caller-file": { - "version": "2.0.5", - "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", - "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", - "dev": true, - "engines": { - "node": "6.* || 8.* || >= 10.*" - } - }, - "node_modules/has-flag": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", - "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/iconv-lite": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", - "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", - "dev": true, - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/inquirer": { - "version": "7.3.3", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", - "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", - "dev": true, - "dependencies": { - "ansi-escapes": "^4.2.1", - "chalk": "^4.1.0", - "cli-cursor": "^3.1.0", - "cli-width": "^3.0.0", - "external-editor": "^3.0.3", - "figures": "^3.0.0", - "lodash": "^4.17.19", - "mute-stream": "0.0.8", - "run-async": "^2.4.0", - "rxjs": "^6.6.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0", - "through": "^2.3.6" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/is-fullwidth-code-point": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", - "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/json-fixer": { - "version": "1.6.13", - "resolved": "https://registry.npmjs.org/json-fixer/-/json-fixer-1.6.13.tgz", - "integrity": "sha512-DKQ71M+0uwAG3QsUkeVgh6XREw/OkpnTfHfM+sdmxRjHvYZ8PlcMVF4ibsHQ1ckR63NROs68qUr1I0u6yPVePQ==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.14.6", - "chalk": "^4.1.2", - "pegjs": "^0.10.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/locate-path": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", - "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", - "dev": true, - "dependencies": { - "p-locate": "^4.1.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/lodash": { - "version": "4.17.21", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", - "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", - "dev": true - }, - "node_modules/mimic-fn": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", - "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/mute-stream": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", - "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", - "dev": true - }, - "node_modules/node-fetch": { - "version": "2.6.7", - "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", - "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", - "dev": true, - "dependencies": { - "whatwg-url": "^5.0.0" - }, - "engines": { - "node": "4.x || >=6.0.0" - }, - "peerDependencies": { - "encoding": "^0.1.0" - }, - "peerDependenciesMeta": { - "encoding": { - "optional": true - } - } - }, - "node_modules/onetime": { - "version": "5.1.2", - "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", - "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", - "dev": true, - "dependencies": { - "mimic-fn": "^2.1.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/os-tmpdir": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", - "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/p-limit": { - "version": "2.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", - "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", - "dev": true, - "dependencies": { - "p-try": "^2.0.0" - }, - "engines": { - "node": ">=6" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/p-locate": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", - "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", - "dev": true, - "dependencies": { - "p-limit": "^2.2.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/p-try": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", - "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", - "dev": true, - "engines": { - "node": ">=6" - } - }, - "node_modules/path-exists": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", - "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/pegjs": { - "version": "0.10.0", - "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz", - "integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0=", - "dev": true, - "bin": { - "pegjs": "bin/pegjs" - }, - "engines": { - "node": ">=0.10" - } - }, - "node_modules/pify": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-5.0.0.tgz", - "integrity": "sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/regenerator-runtime": { - "version": "0.13.9", - "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", - "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==", - "dev": true - }, - "node_modules/require-directory": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", - "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", - "dev": true, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/require-main-filename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", - "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", - "dev": true - }, - "node_modules/restore-cursor": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", - "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", - "dev": true, - "dependencies": { - "onetime": "^5.1.0", - "signal-exit": "^3.0.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/run-async": { - "version": "2.4.1", - "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", - "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", - "dev": true, - "engines": { - "node": ">=0.12.0" - } - }, - "node_modules/rxjs": { - "version": "6.6.7", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", - "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", - "dev": true, - "dependencies": { - "tslib": "^1.9.0" - }, - "engines": { - "npm": ">=2.0.0" - } - }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "dev": true - }, - "node_modules/set-blocking": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", - "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", - "dev": true - }, - "node_modules/signal-exit": { - "version": "3.0.6", - "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", - "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==", - "dev": true - }, - "node_modules/string-width": { - "version": "4.2.3", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", - "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, - "dependencies": { - "emoji-regex": "^8.0.0", - "is-fullwidth-code-point": "^3.0.0", - "strip-ansi": "^6.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/strip-ansi": { - "version": "6.0.1", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", - "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, - "dependencies": { - "ansi-regex": "^5.0.1" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/supports-color": { - "version": "7.2.0", - "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", - "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", - "dev": true, - "dependencies": { - "has-flag": "^4.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/through": { - "version": "2.3.8", - "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", - "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", - "dev": true - }, - "node_modules/tmp": { - "version": "0.0.33", - "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", - "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", - "dev": true, - "dependencies": { - "os-tmpdir": "~1.0.2" - }, - "engines": { - "node": ">=0.6.0" - } - }, - "node_modules/tr46": { - "version": "0.0.3", - "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", - "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", - "dev": true - }, - "node_modules/tslib": { - "version": "1.14.1", - "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", - "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", - "dev": true - }, - "node_modules/type-fest": { - "version": "0.21.3", - "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", - "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", - "dev": true, - "engines": { - "node": ">=10" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, - "node_modules/webidl-conversions": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", - "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", - "dev": true - }, - "node_modules/whatwg-url": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", - "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", - "dev": true, - "dependencies": { - "tr46": "~0.0.3", - "webidl-conversions": "^3.0.0" - } - }, - "node_modules/which-module": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", - "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", - "dev": true - }, - "node_modules/wrap-ansi": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", - "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", - "dev": true, - "dependencies": { - "ansi-styles": "^4.0.0", - "string-width": "^4.1.0", - "strip-ansi": "^6.0.0" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/y18n": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", - "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", - "dev": true - }, - "node_modules/yargs": { - "version": "15.4.1", - "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", - "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", - "dev": true, - "dependencies": { - "cliui": "^6.0.0", - "decamelize": "^1.2.0", - "find-up": "^4.1.0", - "get-caller-file": "^2.0.1", - "require-directory": "^2.1.1", - "require-main-filename": "^2.0.0", - "set-blocking": "^2.0.0", - "string-width": "^4.2.0", - "which-module": "^2.0.0", - "y18n": "^4.0.0", - "yargs-parser": "^18.1.2" - }, - "engines": { - "node": ">=8" - } - }, - "node_modules/yargs-parser": { - "version": "18.1.3", - "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", - "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", - "dev": true, - "dependencies": { - "camelcase": "^5.0.0", - "decamelize": "^1.2.0" - }, - "engines": { - "node": ">=6" - } - } - }, + "lockfileVersion": 1, "dependencies": { "@babel/runtime": { "version": "7.16.7", From 6234b15ce7b0802ecc110dd0eb4ac1c8c9e385a1 Mon Sep 17 00:00:00 2001 From: LynnBroe Date: Fri, 11 Nov 2022 14:22:22 +0800 Subject: [PATCH 26/34] revise --- .../java/rule/codestyle/xml/CommentDefaultAccessModifier.xml | 2 +- .../xml/ClassWithOnlyPrivateConstructorsShouldBeFinal.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/CommentDefaultAccessModifier.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/CommentDefaultAccessModifier.xml index 085a0f7e2f7..1e449b0df09 100755 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/CommentDefaultAccessModifier.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/codestyle/xml/CommentDefaultAccessModifier.xml @@ -407,7 +407,7 @@ class SomeTest { import lombok.Value; @Value public class Test { - int fo$o; + int foo; } ]]> diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/ClassWithOnlyPrivateConstructorsShouldBeFinal.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/ClassWithOnlyPrivateConstructorsShouldBeFinal.xml index 9d46d9bee2e..83cdf10afa7 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/ClassWithOnlyPrivateConstructorsShouldBeFinal.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/design/xml/ClassWithOnlyPrivateConstructorsShouldBeFinal.xml @@ -196,7 +196,7 @@ import lombok.Value; @Value public class Test { - private Test(int a, int b, int c, String abc, long d, double p, String[] arr, int data, long in, float fl, String res) {} + private Test(int a, int b) {} } ]]> From f28bb76d35dbfeecdbcd58b950b78d4ee0597e94 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 11 Nov 2022 10:28:28 +0100 Subject: [PATCH 27/34] [doc] Update release notes (#4200, #4201, #4202) --- docs/pages/release_notes.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 9899c461f33..b8ffe43f9ec 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -15,12 +15,17 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy ### Fixed Issues +* java-codestyle + * [#4201](https://github.com/pmd/pmd/issues/4201): \[java] CommentDefaultAccessModifier should consider lombok's @Value +* java-design + * [#4200](https://github.com/pmd/pmd/issues/4200): \[java] ClassWithOnlyPrivateConstructorsShouldBeFinal should consider lombok's @Value ### API Changes ### External Contributions * [#4184](https://github.com/pmd/pmd/pull/4184): \[java]\[doc] TestClassWithoutTestCases - fix small typo in description - [Valery Yatsynovich](https://github.com/valfirst) (@valfirst) * [#4198](https://github.com/pmd/pmd/pull/4198): \[doc] Add supported CPD languages - [Jeroen van Wilgenburg](https://github.com/jvwilge) (@jvwilge) +* [#4202](https://github.com/pmd/pmd/pull/4202): \[java] Fix #4200 and #4201: ClassWithOnlyPrivateConstructorsShouldBeFinal, CommentDefaultAccessModifier: Exclude lombok @Value annotation - [Lynn](https://github.com/LynnBroe) (@LynnBroe) {% endtocmaker %} From c010561045a19edcaecc8287f6e334f3245eeb42 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 11 Nov 2022 10:44:55 +0100 Subject: [PATCH 28/34] [doc] Update release notes (#3643, #4152, #4197) --- docs/pages/release_notes.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index e6743000d8d..942d051d58b 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -15,6 +15,9 @@ This is a {{ site.pmd.release_type }} release. ### New and noteworthy ### Fixed Issues +* java + * [#3643](https://github.com/pmd/pmd/issues/3643): \[java] More parser edge cases + * [#4152](https://github.com/pmd/pmd/issues/4152): \[java] Parse error on array type annotations ### API Changes From d842ea2a90e12a8be43b70ad0e7ae8561056b137 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 11 Nov 2022 12:19:00 +0100 Subject: [PATCH 29/34] Revert package-lock.json --- package-lock.json | 697 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 696 insertions(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 0b8d2e6f488..766fca3610a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,701 @@ { + "name": "pmd", + "lockfileVersion": 2, "requires": true, - "lockfileVersion": 1, + "packages": { + "": { + "devDependencies": { + "all-contributors-cli": "^6.20.0" + } + }, + "node_modules/@babel/runtime": { + "version": "7.16.7", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.16.7.tgz", + "integrity": "sha512-9E9FJowqAsytyOY6LG+1KuueckRL+aQW+mKvXRXnuFGyRAyepJPmEo9vgMfXUA6O9u3IeEdv9MAkppFcaQwogQ==", + "dev": true, + "dependencies": { + "regenerator-runtime": "^0.13.4" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/all-contributors-cli": { + "version": "6.20.0", + "resolved": "https://registry.npmjs.org/all-contributors-cli/-/all-contributors-cli-6.20.0.tgz", + "integrity": "sha512-trEQlL1s1u8FSWSwY2w9uL4GCG7Fo9HIW5rm5LtlE0SQHSolfXQBzJib07Qes5j52/t72wjuE6sEKkuRrwiuuQ==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.7.6", + "async": "^3.0.1", + "chalk": "^4.0.0", + "didyoumean": "^1.2.1", + "inquirer": "^7.0.4", + "json-fixer": "^1.5.1", + "lodash": "^4.11.2", + "node-fetch": "^2.6.0", + "pify": "^5.0.0", + "yargs": "^15.0.1" + }, + "bin": { + "all-contributors": "dist/cli.js" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/ansi-escapes": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.2.tgz", + "integrity": "sha512-gKXj5ALrKWQLsYG9jlTRmR/xKluxHV+Z9QEwNIgCfM1/uwPMCuzVVnh5mwTd+OuBZcwSIMbqssNWRm1lE51QaQ==", + "dev": true, + "dependencies": { + "type-fest": "^0.21.3" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/async": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/async/-/async-3.2.3.tgz", + "integrity": "sha512-spZRyzKL5l5BZQrr/6m/SqFdBN0q3OCI0f9rjfBzCMBIP4p75P620rR3gTmaksNOhmzgdxcaxdNfMy6anrbM0g==", + "dev": true + }, + "node_modules/camelcase": { + "version": "5.3.1", + "resolved": "https://registry.npmjs.org/camelcase/-/camelcase-5.3.1.tgz", + "integrity": "sha512-L28STB170nwWS63UjtlEOE3dldQApaJXZkOI1uMFfzf3rRuPegHaHesyee+YxQ+W6SvRDQV6UrdOdRiR153wJg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/chardet": { + "version": "0.7.0", + "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz", + "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==", + "dev": true + }, + "node_modules/cli-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz", + "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==", + "dev": true, + "dependencies": { + "restore-cursor": "^3.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/cli-width": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz", + "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==", + "dev": true, + "engines": { + "node": ">= 10" + } + }, + "node_modules/cliui": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-6.0.0.tgz", + "integrity": "sha512-t6wbgtoCXvAzst7QgXxJYqPt0usEfbgQdftEPbLL/cvv6HPE5VgvqCuAIDR0NgU52ds6rFwqrgakNLrHEjCbrQ==", + "dev": true, + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.0", + "wrap-ansi": "^6.2.0" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/decamelize": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/decamelize/-/decamelize-1.2.0.tgz", + "integrity": "sha1-9lNNFRSCabIDUue+4m9QH5oZEpA=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", + "dev": true + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true + }, + "node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ=", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/external-editor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz", + "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==", + "dev": true, + "dependencies": { + "chardet": "^0.7.0", + "iconv-lite": "^0.4.24", + "tmp": "^0.0.33" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/figures": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz", + "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==", + "dev": true, + "dependencies": { + "escape-string-regexp": "^1.0.5" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "dependencies": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "dev": true, + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, + "node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/iconv-lite": { + "version": "0.4.24", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", + "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==", + "dev": true, + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/inquirer": { + "version": "7.3.3", + "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz", + "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==", + "dev": true, + "dependencies": { + "ansi-escapes": "^4.2.1", + "chalk": "^4.1.0", + "cli-cursor": "^3.1.0", + "cli-width": "^3.0.0", + "external-editor": "^3.0.3", + "figures": "^3.0.0", + "lodash": "^4.17.19", + "mute-stream": "0.0.8", + "run-async": "^2.4.0", + "rxjs": "^6.6.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0", + "through": "^2.3.6" + }, + "engines": { + "node": ">=8.0.0" + } + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/json-fixer": { + "version": "1.6.13", + "resolved": "https://registry.npmjs.org/json-fixer/-/json-fixer-1.6.13.tgz", + "integrity": "sha512-DKQ71M+0uwAG3QsUkeVgh6XREw/OkpnTfHfM+sdmxRjHvYZ8PlcMVF4ibsHQ1ckR63NROs68qUr1I0u6yPVePQ==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.14.6", + "chalk": "^4.1.2", + "pegjs": "^0.10.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "dependencies": { + "p-locate": "^4.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/lodash": { + "version": "4.17.21", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz", + "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg==", + "dev": true + }, + "node_modules/mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/mute-stream": { + "version": "0.0.8", + "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz", + "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==", + "dev": true + }, + "node_modules/node-fetch": { + "version": "2.6.7", + "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz", + "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==", + "dev": true, + "dependencies": { + "whatwg-url": "^5.0.0" + }, + "engines": { + "node": "4.x || >=6.0.0" + }, + "peerDependencies": { + "encoding": "^0.1.0" + }, + "peerDependenciesMeta": { + "encoding": { + "optional": true + } + } + }, + "node_modules/onetime": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz", + "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==", + "dev": true, + "dependencies": { + "mimic-fn": "^2.1.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/os-tmpdir": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz", + "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "dependencies": { + "p-try": "^2.0.0" + }, + "engines": { + "node": ">=6" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "dependencies": { + "p-limit": "^2.2.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true, + "engines": { + "node": ">=6" + } + }, + "node_modules/path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/pegjs": { + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/pegjs/-/pegjs-0.10.0.tgz", + "integrity": "sha1-z4uvrm7d/0tafvsYUmnqr0YQ3b0=", + "dev": true, + "bin": { + "pegjs": "bin/pegjs" + }, + "engines": { + "node": ">=0.10" + } + }, + "node_modules/pify": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/pify/-/pify-5.0.0.tgz", + "integrity": "sha512-eW/gHNMlxdSP6dmG6uJip6FXN0EQBwm2clYYd8Wul42Cwu/DK8HEftzsapcNdYe2MfLiIwZqsDk2RDEsTE79hA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/regenerator-runtime": { + "version": "0.13.9", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.13.9.tgz", + "integrity": "sha512-p3VT+cOEgxFsRRA9X4lkI1E+k2/CtnKtU4gcxyaCUreilL/vqI6CdZ3wxVUx3UOUg+gnUOQQcRI7BmSI656MYA==", + "dev": true + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I=", + "dev": true, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/require-main-filename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-2.0.0.tgz", + "integrity": "sha512-NKN5kMDylKuldxYLSUfrbo5Tuzh4hd+2E8NPPX02mZtn1VuREQToYe/ZdlJy+J3uCpfaiGF05e7B8W0iXbQHmg==", + "dev": true + }, + "node_modules/restore-cursor": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz", + "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==", + "dev": true, + "dependencies": { + "onetime": "^5.1.0", + "signal-exit": "^3.0.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/run-async": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz", + "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==", + "dev": true, + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/rxjs": { + "version": "6.6.7", + "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.7.tgz", + "integrity": "sha512-hTdwr+7yYNIT5n4AMYp85KA6yw2Va0FLa3Rguvbpa4W3I5xynaBZo41cM3XM+4Q6fRMj3sBYIR1VAmZMXYJvRQ==", + "dev": true, + "dependencies": { + "tslib": "^1.9.0" + }, + "engines": { + "npm": ">=2.0.0" + } + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "dev": true + }, + "node_modules/set-blocking": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/set-blocking/-/set-blocking-2.0.0.tgz", + "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=", + "dev": true + }, + "node_modules/signal-exit": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.6.tgz", + "integrity": "sha512-sDl4qMFpijcGw22U5w63KmD3cZJfBuFlVNbVMKje2keoKML7X2UzWbc4XrmEbDwg0NXJc3yv4/ox7b+JWb57kQ==", + "dev": true + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/through": { + "version": "2.3.8", + "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz", + "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU=", + "dev": true + }, + "node_modules/tmp": { + "version": "0.0.33", + "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz", + "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==", + "dev": true, + "dependencies": { + "os-tmpdir": "~1.0.2" + }, + "engines": { + "node": ">=0.6.0" + } + }, + "node_modules/tr46": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", + "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o=", + "dev": true + }, + "node_modules/tslib": { + "version": "1.14.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", + "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==", + "dev": true + }, + "node_modules/type-fest": { + "version": "0.21.3", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.21.3.tgz", + "integrity": "sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/webidl-conversions": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz", + "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE=", + "dev": true + }, + "node_modules/whatwg-url": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz", + "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=", + "dev": true, + "dependencies": { + "tr46": "~0.0.3", + "webidl-conversions": "^3.0.0" + } + }, + "node_modules/which-module": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", + "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", + "dev": true + }, + "node_modules/wrap-ansi": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz", + "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/y18n": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-4.0.3.tgz", + "integrity": "sha512-JKhqTOwSrqNA1NY5lSztJ1GrBiUodLMmIZuLiDaMRJ+itFd+ABVE8XBjOvIWL+rSqNDC74LCSFmlb/U4UZ4hJQ==", + "dev": true + }, + "node_modules/yargs": { + "version": "15.4.1", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-15.4.1.tgz", + "integrity": "sha512-aePbxDmcYW++PaqBsJ+HYUFwCdv4LVvdnhBy78E57PIor8/OVvhMrADFFEDh8DHDFRv/O9i3lPhsENjO7QX0+A==", + "dev": true, + "dependencies": { + "cliui": "^6.0.0", + "decamelize": "^1.2.0", + "find-up": "^4.1.0", + "get-caller-file": "^2.0.1", + "require-directory": "^2.1.1", + "require-main-filename": "^2.0.0", + "set-blocking": "^2.0.0", + "string-width": "^4.2.0", + "which-module": "^2.0.0", + "y18n": "^4.0.0", + "yargs-parser": "^18.1.2" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/yargs-parser": { + "version": "18.1.3", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-18.1.3.tgz", + "integrity": "sha512-o50j0JeToy/4K6OZcaQmW6lyXXKhq7csREXcDwk2omFPJEwUNOVtJKvmDr9EI1fAJZUyZcRF7kxGBWmRXudrCQ==", + "dev": true, + "dependencies": { + "camelcase": "^5.0.0", + "decamelize": "^1.2.0" + }, + "engines": { + "node": ">=6" + } + } + }, "dependencies": { "@babel/runtime": { "version": "7.16.7", From 43aa917687d310d46e9eeb37787bcabfe6ffdb7c Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 11 Nov 2022 12:19:54 +0100 Subject: [PATCH 30/34] [doc] Update release notes (#4205) --- docs/pages/release_notes.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index 8825fd8f9a2..21e14b24d24 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -65,6 +65,7 @@ The following APIs have been marked as deprecated for removal in PMD 7: ### External Contributions * [#4184](https://github.com/pmd/pmd/pull/4184): \[java]\[doc] TestClassWithoutTestCases - fix small typo in description - [Valery Yatsynovich](https://github.com/valfirst) (@valfirst) * [#4198](https://github.com/pmd/pmd/pull/4198): \[doc] Add supported CPD languages - [Jeroen van Wilgenburg](https://github.com/jvwilge) (@jvwilge) +* [#4205](https://github.com/pmd/pmd/pull/4205): \[doc] Clarify Scala support (no built-in rules) - [Eldrick Wega](https://github.com/Eldrick19) (@Eldrick19) {% endtocmaker %} From 2bfc8da9d20907881cf04e1f8c21c2b9796b9a5d Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 11 Nov 2022 12:20:09 +0100 Subject: [PATCH 31/34] Add @Eldrick19 as a contributor --- .all-contributorsrc | 9 ++ docs/pages/pmd/projectdocs/credits.md | 169 +++++++++++++------------- 2 files changed, 95 insertions(+), 83 deletions(-) diff --git a/.all-contributorsrc b/.all-contributorsrc index 9c4e2cfc8fe..a23959f808f 100644 --- a/.all-contributorsrc +++ b/.all-contributorsrc @@ -6997,6 +6997,15 @@ "contributions": [ "doc" ] + }, + { + "login": "Eldrick19", + "name": "Eldrick Wega", + "avatar_url": "https://avatars.githubusercontent.com/u/26189114?v=4", + "profile": "https://github.com/Eldrick19", + "contributions": [ + "doc" + ] } ], "contributorsPerLine": 7, diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index fae30463d07..93472e0ded4 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -240,758 +240,761 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d
Elder S.

๐Ÿ› +
Eldrick Wega

๐Ÿ“–
Emile

๐Ÿ›
Eric

๐Ÿ›
Eric Kintzer

๐Ÿ›
Eric Perret

๐Ÿ›
Eric Squires

๐Ÿ› -
Erich L Foster

๐Ÿ› +
Erich L Foster

๐Ÿ›
Erik Bleske

๐Ÿ›
Ernst Reissner

๐Ÿ›
Ewan Tempero

๐Ÿ›
F.W. Dekker

๐Ÿ›
FSchliephacke

๐Ÿ›
Facundo

๐Ÿ› -
Federico Giust

๐Ÿ› +
Federico Giust

๐Ÿ›
Fedor Sherstobitov

๐Ÿ›
Felix Lampe

๐Ÿ›
Filip Golonka

๐Ÿ›
Filipe Esperandio

๐Ÿ’ป ๐Ÿ›
Filippo Nova

๐Ÿ›
Francesco la Torre

๐Ÿ› -
Francisco Duarte

๐Ÿ› +
Francisco Duarte

๐Ÿ›
Frieder Bluemle

๐Ÿ›
Frits Jalvingh

๐Ÿ’ป ๐Ÿ›
G. Bazior

๐Ÿ›
Gabe Henkes

๐Ÿ›
Gary Gregory

๐Ÿ›
Genoud Magloire

๐Ÿ› -
Geoffrey555

๐Ÿ› +
Geoffrey555

๐Ÿ›
Georg Romstorfer

๐Ÿ›
Gio

๐Ÿ›
Gol

๐Ÿ›
Gonzalo Exequiel Ibars Ingman

๐Ÿ’ป ๐Ÿ›
GooDer

๐Ÿ›
Gregor Riegler

๐Ÿ› -
Grzegorz Olszewski

๐Ÿ› +
Grzegorz Olszewski

๐Ÿ›
Gunther Schrijvers

๐Ÿ’ป ๐Ÿ›
Gustavo Krieger

๐Ÿ›
Guy Elsmore-Paddock

๐Ÿ›
Gรถrkem Mรผlayim

๐Ÿ›
Hanzel Godinez

๐Ÿ›
Haoliang Chen

๐Ÿ› -
Harsh Kukreja

๐Ÿ› +
Harsh Kukreja

๐Ÿ›
Heber

๐Ÿ›
Henning Schmiedehausen

๐Ÿ’ป ๐Ÿ›
Henning von Bargen

๐Ÿ’ป
Hervรฉ Boutemy

๐Ÿ›
Himanshu Pandey

๐Ÿ›
Hokwang Lee

๐Ÿ› -
Hooperbloob

๐Ÿ’ป +
Hooperbloob

๐Ÿ’ป
Hung PHAN

๐Ÿ›
IDoCodingStuffs

๐Ÿ’ป ๐Ÿ›
Iccen Gan

๐Ÿ›
Ignacio Mariano Tirabasso

๐Ÿ›
Igor Melnichenko

๐Ÿ›
Igor Moreno

๐Ÿ› -
Intelesis-MS

๐Ÿ› +
Intelesis-MS

๐Ÿ›
Iroha_

๐Ÿ›
Ishan Srivastava

๐Ÿ›
Ivano Guerini

๐Ÿ›
Ivar Andreas Bonsaksen

๐Ÿ›
Ivo ล mรญd

๐Ÿ›
JJengility

๐Ÿ› -
Jake Hemmerle

๐Ÿ› +
Jake Hemmerle

๐Ÿ›
James Harrison

๐Ÿ› ๐Ÿ’ป
Jan

๐Ÿ›
Jan Aertgeerts

๐Ÿ’ป ๐Ÿ›
Jan Brรผmmer

๐Ÿ›
Jan Tล™รญska

๐Ÿ›
Jan-Lukas Else

๐Ÿ› -
Jason Qiu

๐Ÿ’ป ๐Ÿ“– +
Jason Qiu

๐Ÿ’ป ๐Ÿ“–
Jason Williams

๐Ÿ›
Jean-Paul Mayer

๐Ÿ›
Jean-Simon Larochelle

๐Ÿ›
Jeff Bartolotta

๐Ÿ’ป ๐Ÿ›
Jeff Hube

๐Ÿ’ป ๐Ÿ›
Jeff Jensen

๐Ÿ› -
Jeff May

๐Ÿ› +
Jeff May

๐Ÿ›
Jens Gerdes

๐Ÿ›
Jeroen Borgers

๐Ÿ› ๐Ÿ’ป ๐Ÿ“ข
Jeroen van Wilgenburg

๐Ÿ“–
Jerome Russ

๐Ÿ›
JerritEic

๐Ÿ’ป ๐Ÿ“– ๐Ÿ›
Jiri Pejchal

๐Ÿ› -
Jithin Sunny

๐Ÿ› +
Jithin Sunny

๐Ÿ›
Jiล™รญ ล korpil

๐Ÿ›
Joao Machado

๐Ÿ›
Jochen Krauss

๐Ÿ›
Johan Hammar

๐Ÿ›
John Karp

๐Ÿ›
John Zhang

๐Ÿ› -
John-Teng

๐Ÿ’ป ๐Ÿ› +
John-Teng

๐Ÿ’ป ๐Ÿ›
Jon Moroney

๐Ÿ’ป ๐Ÿ›
Jonas Geiregat

๐Ÿ›
Jonathan Wiesel

๐Ÿ’ป ๐Ÿ›
Jordan

๐Ÿ›
Jordi Llach

๐Ÿ›
Jorge Solรณrzano

๐Ÿ› -
JorneVL

๐Ÿ› +
JorneVL

๐Ÿ›
Jose Palafox

๐Ÿ›
Jose Stovall

๐Ÿ›
Joseph

๐Ÿ’ป
Joseph Heenan

๐Ÿ›
Josh Feingold

๐Ÿ’ป ๐Ÿ›
Josh Holthaus

๐Ÿ› -
Joshua S Arquilevich

๐Ÿ› +
Joshua S Arquilevich

๐Ÿ›
Joรฃo Ferreira

๐Ÿ’ป ๐Ÿ›
Joรฃo Pedro Schmitt

๐Ÿ›
Juan Martรญn Sotuyo Dodero

๐Ÿ’ป ๐Ÿ“– ๐Ÿ› ๐Ÿšง
Juan Pablo Civile

๐Ÿ›
Julian Voronetsky

๐Ÿ›
Julien

๐Ÿ› -
Julius

๐Ÿ› +
Julius

๐Ÿ›
JustPRV

๐Ÿ›
Jรถrn Huxhorn

๐Ÿ›
KThompso

๐Ÿ›
Kai Amundsen

๐Ÿ›
Karel Vervaeke

๐Ÿ›
Karl-Andero Mere

๐Ÿ› -
Karl-Philipp Richter

๐Ÿ› +
Karl-Philipp Richter

๐Ÿ›
Karsten Silz

๐Ÿ›
Kazuma Watanabe

๐Ÿ›
Kev

๐Ÿ›
Keve Mรผller

๐Ÿ›
Kevin Guerra

๐Ÿ’ป
Kevin Jones

๐Ÿ› -
Kevin Wayne

๐Ÿ› +
Kevin Wayne

๐Ÿ›
Kieran Black

๐Ÿ›
Kirill Zubov

๐Ÿ›
Kirk Clemens

๐Ÿ’ป ๐Ÿ›
Klaus Hartl

๐Ÿ›
Koen Van Looveren

๐Ÿ›
Kris Scheibe

๐Ÿ’ป ๐Ÿ› -
Kunal Thanki

๐Ÿ› +
Kunal Thanki

๐Ÿ›
LaLucid

๐Ÿ’ป
Larry Diamond

๐Ÿ’ป ๐Ÿ›
Lars Knickrehm

๐Ÿ›
Leo Gutierrez

๐Ÿ›
LiGaOg

๐Ÿ’ป
Lintsi

๐Ÿ› -
Linus Fernandes

๐Ÿ› +
Linus Fernandes

๐Ÿ›
Lixon Lookose

๐Ÿ›
Logesh

๐Ÿ›
Lorenzo Gabriele

๐Ÿ›
Loรฏc Ledoyen

๐Ÿ›
Lucas Silva

๐Ÿ›
Lucas Soncini

๐Ÿ’ป ๐Ÿ› -
Luis Alcantar

๐Ÿ’ป +
Luis Alcantar

๐Ÿ’ป
Lukasz Slonina

๐Ÿ›
Lukebray

๐Ÿ›
Lynn

๐Ÿ’ป ๐Ÿ›
Lyor Goldstein

๐Ÿ›
MCMicS

๐Ÿ›
Macarse

๐Ÿ› -
Machine account for PMD

๐Ÿ’ป +
Machine account for PMD

๐Ÿ’ป
Maciek Siemczyk

๐Ÿ›
Maikel Steneker

๐Ÿ’ป ๐Ÿ›
Maksim Moiseikin

๐Ÿ›
Manfred Koch

๐Ÿ›
Manuel Moya Ferrer

๐Ÿ’ป ๐Ÿ›
Manuel Ryan

๐Ÿ› -
Marat Vyshegorodtsev

๐Ÿ› +
Marat Vyshegorodtsev

๐Ÿ›
Marcel Hรคrle

๐Ÿ›
Marcello Fialho

๐Ÿ›
Marcin Rataj

๐Ÿ›
Mark Adamcin

๐Ÿ›
Mark Hall

๐Ÿ’ป ๐Ÿ›
Mark Kolich

๐Ÿ› -
Mark Pritchard

๐Ÿ› +
Mark Pritchard

๐Ÿ›
Markus Rathgeb

๐Ÿ›
Marquis Wang

๐Ÿ›
MartGit

๐Ÿ›
Martin Feldsztejn

๐Ÿ›
Martin Lehmann

๐Ÿ›
Martin Spamer

๐Ÿ› -
Martin Tarjรกnyi

๐Ÿ› +
Martin Tarjรกnyi

๐Ÿ›
MatFl

๐Ÿ›
Mateusz Stefanski

๐Ÿ›
Mathieu Gouin

๐Ÿ›
MatiasComercio

๐Ÿ’ป ๐Ÿ›
Matt Benson

๐Ÿ›
Matt De Poorter

๐Ÿ› -
Matt Hargett

๐Ÿ’ป ๐Ÿ’ต +
Matt Hargett

๐Ÿ’ป ๐Ÿ’ต
Matt Harrah

๐Ÿ›
Matt Nelson

๐Ÿ›
Matthew Amos

๐Ÿ›
Matthew Duggan

๐Ÿ›
Matthew Hall

๐Ÿ›
Matรญas Fraga

๐Ÿ’ป ๐Ÿ› -
Maxime Robert

๐Ÿ’ป ๐Ÿ› +
Maxime Robert

๐Ÿ’ป ๐Ÿ›
MetaBF

๐Ÿ›
Michael

๐Ÿ›
Michael Bell

๐Ÿ›
Michael Bernstein

๐Ÿ›
Michael Clay

๐Ÿ›
Michael Dombrowski

๐Ÿ› -
Michael Hausegger

๐Ÿ› +
Michael Hausegger

๐Ÿ›
Michael Hoefer

๐Ÿ›
Michael Mรถbius

๐Ÿ›
Michael N. Lipp

๐Ÿ›
Michael Pellegrini

๐Ÿ›
Michal Kordas

๐Ÿ›
Michaล‚ Borek

๐Ÿ› -
Michaล‚ Kuliล„ski

๐Ÿ› +
Michaล‚ Kuliล„ski

๐Ÿ›
Miguel Nรบรฑez Dรญaz-Montes

๐Ÿ›
Mihai Ionut

๐Ÿ›
Mirek Hankus

๐Ÿ›
Mladjan Gadzic

๐Ÿ›
MrAngry52

๐Ÿ›
Muminur Choudhury

๐Ÿ› -
Mykhailo Palahuta

๐Ÿ’ป ๐Ÿ› +
Mykhailo Palahuta

๐Ÿ’ป ๐Ÿ›
Nagendra Kumar Singh

๐Ÿ›
Nahuel Barrios

๐Ÿ›
Nathan Braun

๐Ÿ›
Nathan Reynolds

๐Ÿ›
Nathan Reynolds

๐Ÿ›
Nathanaรซl

๐Ÿ› -
Naveen

๐Ÿ’ป +
Naveen

๐Ÿ’ป
Nazdravi

๐Ÿ›
Neha-Dhonde

๐Ÿ›
Nicholas Doyle

๐Ÿ›
Nick Butcher

๐Ÿ›
Nico Gallinal

๐Ÿ›
Nicola Dal Maso

๐Ÿ› -
Nicolas Filotto

๐Ÿ’ป +
Nicolas Filotto

๐Ÿ’ป
Nicolas Vuillamy

๐Ÿ“–
Nikita Chursin

๐Ÿ›
Niklas Baudy

๐Ÿ›
Nikolas Havrikov

๐Ÿ›
Nilesh Virkar

๐Ÿ›
Nimit Patel

๐Ÿ› -
Niranjan Harpale

๐Ÿ› +
Niranjan Harpale

๐Ÿ›
Noah Sussman

๐Ÿ›
Noah0120

๐Ÿ›
Noam Tamim

๐Ÿ›
Noel Grandin

๐Ÿ›
Olaf Haalstra

๐Ÿ›
Oleg Andreych

๐Ÿ’ป ๐Ÿ› -
Oleg Pavlenko

๐Ÿ› +
Oleg Pavlenko

๐Ÿ›
Oleksii Dykov

๐Ÿ’ป ๐Ÿ›
Oliver Eikemeier

๐Ÿ›
Oliver Siegmar

๐Ÿ’ต
Olivier Parent

๐Ÿ’ป ๐Ÿ›
Ollie Abbey

๐Ÿ’ป ๐Ÿ›
OverDrone

๐Ÿ› -
Ozan Gulle

๐Ÿ’ป ๐Ÿ› +
Ozan Gulle

๐Ÿ’ป ๐Ÿ›
PUNEET JAIN

๐Ÿ›
Parbati Bose

๐Ÿ›
Paul Berg

๐Ÿ›
Pavel Bludov

๐Ÿ›
Pavel Miฤka

๐Ÿ›
Pedro Nuno Santos

๐Ÿ› -
Pedro Rijo

๐Ÿ› +
Pedro Rijo

๐Ÿ›
Pelisse Romain

๐Ÿ’ป ๐Ÿ“– ๐Ÿ›
Per Abich

๐Ÿ’ป
Pete Davids

๐Ÿ›
Peter Bruin

๐Ÿ›
Peter Chittum

๐Ÿ’ป ๐Ÿ›
Peter Cudmore

๐Ÿ› -
Peter Kasson

๐Ÿ› +
Peter Kasson

๐Ÿ›
Peter Kofler

๐Ÿ›
Peter Paul Bakker

๐Ÿ’ป
Pham Hai Trung

๐Ÿ›
Philip Graf

๐Ÿ’ป ๐Ÿ›
Philip Hachey

๐Ÿ›
Philippe Ozil

๐Ÿ› -
Phinehas Artemix

๐Ÿ› +
Phinehas Artemix

๐Ÿ›
Phokham Nonava

๐Ÿ›
Piotr Szymaล„ski

๐Ÿ›
Piotrek ลปygieล‚o

๐Ÿ’ป ๐Ÿ› ๐Ÿ“–
Pranay Jaiswal

๐Ÿ›
Prasad Kamath

๐Ÿ›
Prasanna

๐Ÿ› -
Presh-AR

๐Ÿ› +
Presh-AR

๐Ÿ›
Puneet1726

๐Ÿ›
Rafael Cortรชs

๐Ÿ›
RaheemShaik999

๐Ÿ›
RajeshR

๐Ÿ’ป ๐Ÿ›
Ramachandra Mohan

๐Ÿ›
Ramel0921

๐Ÿ› -
Raquel Pau

๐Ÿ› +
Raquel Pau

๐Ÿ›
Ravikiran Janardhana

๐Ÿ›
Reda Benhemmouche

๐Ÿ›
Renato Oliveira

๐Ÿ’ป ๐Ÿ›
Rich DiCroce

๐Ÿ›
Riot R1cket

๐Ÿ›
Rishabh Jain

๐Ÿ› -
RishabhDeep Singh

๐Ÿ› +
RishabhDeep Singh

๐Ÿ›
Robbie Martinus

๐Ÿ’ป ๐Ÿ›
Robert Henry

๐Ÿ›
Robert Painsi

๐Ÿ›
Robert Russell

๐Ÿ›
Robert Sรถsemann

๐Ÿ’ป ๐Ÿ“– ๐Ÿ“ข ๐Ÿ›
Robert Whitebit

๐Ÿ› -
Robin Richtsfeld

๐Ÿ› +
Robin Richtsfeld

๐Ÿ›
Robin Stocker

๐Ÿ’ป ๐Ÿ›
Robin Wils

๐Ÿ›
RochusOest

๐Ÿ›
Rodolfo Noviski

๐Ÿ›
Rodrigo Casara

๐Ÿ›
Rodrigo Fernandes

๐Ÿ› -
Roman Salvador

๐Ÿ’ป ๐Ÿ› +
Roman Salvador

๐Ÿ’ป ๐Ÿ›
Ronald Blaschke

๐Ÿ›
Rรณbert Papp

๐Ÿ›
Saikat Sengupta

๐Ÿ›
Saksham Handu

๐Ÿ›
Saladoc

๐Ÿ›
Salesforce Bob Lightning

๐Ÿ› -
Sam Carlberg

๐Ÿ› +
Sam Carlberg

๐Ÿ›
Satoshi Kubo

๐Ÿ›
Scott Kennedy

๐Ÿ›
Scott Wells

๐Ÿ› ๐Ÿ’ป
Scrsloota

๐Ÿ’ป
Sebastian Bรถgl

๐Ÿ›
Sebastian Schuberth

๐Ÿ› -
Sebastian Schwarz

๐Ÿ› +
Sebastian Schwarz

๐Ÿ›
Sergey Gorbaty

๐Ÿ›
Sergey Kozlov

๐Ÿ›
Sergey Yanzin

๐Ÿ’ป ๐Ÿ›
Seth Wilcox

๐Ÿ’ป
Shubham

๐Ÿ’ป ๐Ÿ›
Simon Abykov

๐Ÿ’ป ๐Ÿ› -
Simon Xiao

๐Ÿ› +
Simon Xiao

๐Ÿ›
Srinivasan Venkatachalam

๐Ÿ›
Stanislav Gromov

๐Ÿ›
Stanislav Myachenkov

๐Ÿ’ป
Stefan Birkner

๐Ÿ›
Stefan Bohn

๐Ÿ›
Stefan Endrullis

๐Ÿ› -
Stefan Klรถss-Schuster

๐Ÿ› +
Stefan Klรถss-Schuster

๐Ÿ›
Stefan Wolf

๐Ÿ›
Stephan H. Wissel

๐Ÿ›
Stephen

๐Ÿ›
Stephen Friedrich

๐Ÿ›
Steve Babula

๐Ÿ’ป
Stexxe

๐Ÿ› -
Stian Lรฅgstad

๐Ÿ› +
Stian Lรฅgstad

๐Ÿ›
StuartClayton5

๐Ÿ›
Supun Arunoda

๐Ÿ›
Suren Abrahamyan

๐Ÿ›
Suvashri

๐Ÿ“–
SwatiBGupta1110

๐Ÿ›
SyedThoufich

๐Ÿ› -
Szymon Sasin

๐Ÿ› +
Szymon Sasin

๐Ÿ›
T-chuangxin

๐Ÿ›
TERAI Atsuhiro

๐Ÿ›
TIOBE Software

๐Ÿ’ป ๐Ÿ›
Taylor Smock

๐Ÿ›
Techeira Damiรกn

๐Ÿ’ป ๐Ÿ›
Ted Husted

๐Ÿ› -
TehBakker

๐Ÿ› +
TehBakker

๐Ÿ›
The Gitter Badger

๐Ÿ›
Theodoor

๐Ÿ›
Thiago Henrique Hรผpner

๐Ÿ›
Thibault Meyer

๐Ÿ›
Thomas Gรผttler

๐Ÿ›
Thomas Jones-Low

๐Ÿ› -
Thomas Smith

๐Ÿ’ป ๐Ÿ› +
Thomas Smith

๐Ÿ’ป ๐Ÿ›
ThrawnCA

๐Ÿ›
Thunderforge

๐Ÿ’ป ๐Ÿ›
Tim van der Lippe

๐Ÿ›
Tobias Weimer

๐Ÿ’ป ๐Ÿ›
Tom Copeland

๐Ÿ› ๐Ÿ’ป ๐Ÿ“–
Tom Daly

๐Ÿ› -
Tomer Figenblat

๐Ÿ› +
Tomer Figenblat

๐Ÿ›
Tomi De Lucca

๐Ÿ’ป ๐Ÿ›
Torsten Kleiber

๐Ÿ›
TrackerSB

๐Ÿ›
Tyson Stewart

๐Ÿ›
Ullrich Hafner

๐Ÿ›
Utku Cuhadaroglu

๐Ÿ’ป ๐Ÿ› -
Valentin Brandl

๐Ÿ› +
Valentin Brandl

๐Ÿ›
Valeria

๐Ÿ›
Valery Yatsynovich

๐Ÿ“–
Vasily Anisimov

๐Ÿ›
Vibhor Goyal

๐Ÿ›
Vickenty Fesunov

๐Ÿ›
Victor Noรซl

๐Ÿ› -
Vincent Galloy

๐Ÿ’ป +
Vincent Galloy

๐Ÿ’ป
Vincent HUYNH

๐Ÿ›
Vincent Maurin

๐Ÿ›
Vincent Privat

๐Ÿ›
Vishhwas

๐Ÿ›
Vitaly

๐Ÿ›
Vitaly Polonetsky

๐Ÿ› -
Vojtech Polivka

๐Ÿ› +
Vojtech Polivka

๐Ÿ›
Vsevolod Zholobov

๐Ÿ›
Vyom Yadav

๐Ÿ’ป
Wang Shidong

๐Ÿ›
Waqas Ahmed

๐Ÿ›
Wayne J. Earl

๐Ÿ›
Wchenghui

๐Ÿ› -
Will Winder

๐Ÿ› +
Will Winder

๐Ÿ›
William Brockhus

๐Ÿ’ป ๐Ÿ›
Wilson Kurniawan

๐Ÿ›
Wim Deblauwe

๐Ÿ›
Woongsik Choi

๐Ÿ›
XenoAmess

๐Ÿ’ป ๐Ÿ›
Yang

๐Ÿ’ป -
YaroslavTER

๐Ÿ› +
YaroslavTER

๐Ÿ›
Yasar Shaikh

๐Ÿ’ป
Young Chan

๐Ÿ’ป ๐Ÿ›
YuJin Kim

๐Ÿ›
Yuri Dolzhenko

๐Ÿ›
Yurii Dubinka

๐Ÿ›
Zoltan Farkas

๐Ÿ› -
Zustin

๐Ÿ› +
Zustin

๐Ÿ›
aaronhurst-google

๐Ÿ› ๐Ÿ’ป
alexmodis

๐Ÿ›
andreoss

๐Ÿ›
andrey81inmd

๐Ÿ’ป ๐Ÿ›
anicoara

๐Ÿ›
arunprasathav

๐Ÿ› -
asiercamara

๐Ÿ› +
asiercamara

๐Ÿ›
astillich-igniti

๐Ÿ’ป
avesolovksyy

๐Ÿ›
avishvat

๐Ÿ›
avivmu

๐Ÿ›
axelbarfod1

๐Ÿ›
b-3-n

๐Ÿ› -
balbhadra9

๐Ÿ› +
balbhadra9

๐Ÿ›
base23de

๐Ÿ›
bergander

๐Ÿ›
berkam

๐Ÿ’ป ๐Ÿ›
breizh31

๐Ÿ›
caesarkim

๐Ÿ›
carolyujing

๐Ÿ› -
cbfiddle

๐Ÿ› +
cbfiddle

๐Ÿ›
cesares-basilico

๐Ÿ›
chrite

๐Ÿ›
cobratbq

๐Ÿ›
coladict

๐Ÿ›
cosmoJFH

๐Ÿ›
cristalp

๐Ÿ› -
crunsk

๐Ÿ› +
crunsk

๐Ÿ›
cwholmes

๐Ÿ›
cyberjj999

๐Ÿ›
cyw3

๐Ÿ›
d1ss0nanz

๐Ÿ›
dalizi007

๐Ÿ’ป
danbrycefairsailcom

๐Ÿ› -
dariansanity

๐Ÿ› +
dariansanity

๐Ÿ›
darrenmiliband

๐Ÿ›
davidburstrom

๐Ÿ›
dbirkman-paloalto

๐Ÿ›
deepak-patra

๐Ÿ›
dependabot[bot]

๐Ÿ’ป ๐Ÿ›
dinesh150

๐Ÿ› -
diziaq

๐Ÿ› +
diziaq

๐Ÿ›
dreaminpast123

๐Ÿ›
duanyanan

๐Ÿ›
dutt-sanjay

๐Ÿ›
dylanleung

๐Ÿ›
dzeigler

๐Ÿ›
ekkirala

๐Ÿ› -
emersonmoura

๐Ÿ› +
emersonmoura

๐Ÿ›
fairy

๐Ÿ›
filiprafalowicz

๐Ÿ’ป
foxmason

๐Ÿ›
frankegabor

๐Ÿ›
frankl

๐Ÿ›
freafrea

๐Ÿ› -
fsapatin

๐Ÿ› +
fsapatin

๐Ÿ›
gracia19

๐Ÿ›
guo fei

๐Ÿ›
gurmsc5

๐Ÿ›
gwilymatgearset

๐Ÿ’ป ๐Ÿ›
haigsn

๐Ÿ›
hemanshu070

๐Ÿ› -
henrik242

๐Ÿ› +
henrik242

๐Ÿ›
hongpuwu

๐Ÿ›
hvbtup

๐Ÿ’ป ๐Ÿ›
igniti GmbH

๐Ÿ›
ilovezfs

๐Ÿ›
itaigilo

๐Ÿ›
jakivey32

๐Ÿ› -
jbennett2091

๐Ÿ› +
jbennett2091

๐Ÿ›
jcamerin

๐Ÿ›
jkeener1

๐Ÿ›
jmetertea

๐Ÿ›
johnra2

๐Ÿ’ป
josemanuelrolon

๐Ÿ’ป ๐Ÿ›
kabroxiko

๐Ÿ’ป ๐Ÿ› -
karwer

๐Ÿ› +
karwer

๐Ÿ›
kaulonline

๐Ÿ›
kdaemonv

๐Ÿ›
kenji21

๐Ÿ’ป ๐Ÿ›
kfranic

๐Ÿ›
khalidkh

๐Ÿ›
koalalam

๐Ÿ› -
krzyk

๐Ÿ› +
krzyk

๐Ÿ›
lasselindqvist

๐Ÿ›
lgemeinhardt

๐Ÿ›
lihuaib

๐Ÿ›
lonelyma1021

๐Ÿ›
lpeddy

๐Ÿ›
lujiefsi

๐Ÿ’ป -
lukelukes

๐Ÿ’ป +
lukelukes

๐Ÿ’ป
lyriccoder

๐Ÿ›
marcelmore

๐Ÿ›
matchbox

๐Ÿ›
matthiaskraaz

๐Ÿ›
meandonlyme

๐Ÿ›
mikesive

๐Ÿ› -
milossesic

๐Ÿ› +
milossesic

๐Ÿ›
mohan-chinnappan-n

๐Ÿ’ป
mriddell95

๐Ÿ›
mrlzh

๐Ÿ›
msloan

๐Ÿ›
mucharlaravalika

๐Ÿ›
mvenneman

๐Ÿ› -
nareshl119

๐Ÿ› +
nareshl119

๐Ÿ›
nicolas-harraudeau-sonarsource

๐Ÿ›
noerremark

๐Ÿ›
novsirion

๐Ÿ›
oggboy

๐Ÿ›
oinume

๐Ÿ›
orimarko

๐Ÿ’ป ๐Ÿ› -
pacvz

๐Ÿ’ป +
pacvz

๐Ÿ’ป
pallavi agarwal

๐Ÿ›
parksungrin

๐Ÿ›
patpatpat123

๐Ÿ›
patriksevallius

๐Ÿ›
pbrajesh1

๐Ÿ›
phoenix384

๐Ÿ› -
piotrszymanski-sc

๐Ÿ’ป +
piotrszymanski-sc

๐Ÿ’ป
plan3d

๐Ÿ›
poojasix

๐Ÿ›
prabhushrikant

๐Ÿ›
pujitha8783

๐Ÿ›
r-r-a-j

๐Ÿ›
raghujayjunk

๐Ÿ› -
rajeshveera

๐Ÿ› +
rajeshveera

๐Ÿ›
rajeswarreddy88

๐Ÿ›
recdevs

๐Ÿ›
reudismam

๐Ÿ’ป ๐Ÿ›
rijkt

๐Ÿ›
rillig-tk

๐Ÿ›
rmohan20

๐Ÿ’ป ๐Ÿ› -
rnveach

๐Ÿ› +
rnveach

๐Ÿ›
rxmicro

๐Ÿ›
ryan-gustafson

๐Ÿ’ป ๐Ÿ›
sabi0

๐Ÿ›
scais

๐Ÿ›
sebbASF

๐Ÿ›
sergeygorbaty

๐Ÿ’ป -
shilko2013

๐Ÿ› +
shilko2013

๐Ÿ›
shiomiyan

๐Ÿ“–
simeonKondr

๐Ÿ›
snajberk

๐Ÿ›
sniperrifle2004

๐Ÿ›
snuyanzin

๐Ÿ› ๐Ÿ’ป
sratz

๐Ÿ› -
stonio

๐Ÿ› +
stonio

๐Ÿ›
sturton

๐Ÿ’ป ๐Ÿ›
sudharmohan

๐Ÿ›
suruchidawar

๐Ÿ›
svenfinitiv

๐Ÿ›
tashiscool

๐Ÿ›
test-git-hook

๐Ÿ› -
testation21

๐Ÿ’ป ๐Ÿ› +
testation21

๐Ÿ’ป ๐Ÿ›
thanosa

๐Ÿ›
tiandiyixian

๐Ÿ›
tobwoerk

๐Ÿ›
tprouvot

๐Ÿ› ๐Ÿ’ป
trentchilders

๐Ÿ›
triandicAnt

๐Ÿ› -
trishul14

๐Ÿ› +
trishul14

๐Ÿ›
tsui

๐Ÿ›
winhkey

๐Ÿ›
witherspore

๐Ÿ›
wjljack

๐Ÿ›
wuchiuwong

๐Ÿ›
xingsong

๐Ÿ› -
xioayuge

๐Ÿ› +
xioayuge

๐Ÿ›
xnYi9wRezm

๐Ÿ’ป ๐Ÿ›
xuanuy

๐Ÿ›
xyf0921

๐Ÿ›
yalechen-cyw3

๐Ÿ›
yasuharu-sato

๐Ÿ›
zenglian

๐Ÿ› -
zgrzyt93

๐Ÿ’ป ๐Ÿ› +
zgrzyt93

๐Ÿ’ป ๐Ÿ›
zh3ng

๐Ÿ›
zt_soft

๐Ÿ›
ztt79

๐Ÿ›
zzzzfeng

๐Ÿ›
รrpรกd Magosรกnyi

๐Ÿ›
ไปป่ดตๆฐ

๐Ÿ› + +
่Œ…ๅปถๅฎ‰

๐Ÿ’ป From 4ef342cd28af6b9b3bed0f4ad3ddc0955d969a82 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 11 Nov 2022 12:22:06 +0100 Subject: [PATCH 32/34] [doc] Fix jdoc links in release notes --- docs/pages/release_notes.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index e4bad66ba17..a6b2776a3ff 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -67,7 +67,7 @@ The following APIs have been marked as deprecated for removal in PMD 7: - {% jdoc !!core::PMDConfiguration#setReportFile(String) %} - It is now superceded by {% jdoc !!core::PMDConfiguration#setReportFile(Path) %} - {% jdoc !!core::PMDConfiguration#isStressTest() %} and {% jdoc !!core::PMDConfiguration#setStressTest(boolean) %} - Will be removed with no replacement. - {% jdoc !!core::PMDConfiguration#isBenchmark() %} and {% jdoc !!core::PMDConfiguration#setBenchmark(boolean) %} - Will be removed with no replacement, the CLI will still support it. -- {% jdoc core::CPD %} and {% jdoc core::CPD.StatusCode %} - PMD 7 will ship with a revamped CLI split from pmd-core. An alterative to programatically launch CPD analysis will be added in due time. +- {% jdoc core::cpd.CPD %} and {% jdoc core::cpd.CPD.StatusCode %} - PMD 7 will ship with a revamped CLI split from pmd-core. An alterative to programatically launch CPD analysis will be added in due time. ### External Contributions * [#4184](https://github.com/pmd/pmd/pull/4184): \[java]\[doc] TestClassWithoutTestCases - fix small typo in description - [Valery Yatsynovich](https://github.com/valfirst) (@valfirst) From 86eab418a9af7ced5d7226940668b02ecc6cd988 Mon Sep 17 00:00:00 2001 From: Andreas Dangel Date: Fri, 11 Nov 2022 15:43:31 +0100 Subject: [PATCH 33/34] [java] TestClassWithoutTestCases - don't consider nested TestNG classes --- .../pmd/lang/java/rule/AbstractJUnitRule.java | 2 +- .../xml/TestClassWithoutTestCases.xml | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJUnitRule.java b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJUnitRule.java index 667798e4dab..15cfb929dfe 100644 --- a/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJUnitRule.java +++ b/pmd-java/src/main/java/net/sourceforge/pmd/lang/java/rule/AbstractJUnitRule.java @@ -153,7 +153,7 @@ private static boolean isTestClassTestNg(ASTClassOrInterfaceBody node) { Node parent = node.getParent(); if (parent instanceof TypeNode) { TypeNode type = (TypeNode) parent; - return doesNodeContainJUnitAnnotation(type, TESTNG_ANNOTATION) || hasImports(type, TESTNG_ANNOTATION); + return doesNodeContainJUnitAnnotation(type, TESTNG_ANNOTATION); } return false; } diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/TestClassWithoutTestCases.xml b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/TestClassWithoutTestCases.xml index 1ede8353eb9..684378946cd 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/TestClassWithoutTestCases.xml +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/errorprone/xml/TestClassWithoutTestCases.xml @@ -359,6 +359,34 @@ public final class TestInputConfiguration { public static final class InnerTest { } } +]]> + + + + Don't consider nested classes (JUnit4) + 0 + + + + + Don't consider nested classes (TestNG) + 0 + From 2f06def8ae6d03ff3952adedb8cc93bff0711cdf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Fournier?= Date: Sat, 12 Nov 2022 18:54:31 +0100 Subject: [PATCH 34/34] Apply suggestions from code review --- docs/pages/release_notes.md | 2 +- pmd-java/src/main/resources/category/java/codestyle.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/pages/release_notes.md b/docs/pages/release_notes.md index cb68529fc1c..a68097d939a 100644 --- a/docs/pages/release_notes.md +++ b/docs/pages/release_notes.md @@ -17,7 +17,7 @@ This is a {{ site.pmd.release_type }} release. #### Modified rules * The rule {% rule java/codestyle/ClassNamingConventions %} has a new property `testClassPattern`, which is applied - to test classes. By default, test classes should end with the suffix "Test". Test classes are classes, that + to test classes. By default, test classes should end with the suffix "Test". Test classes are top-level classes, that either inherit from JUnit 3 TestCase or have at least one method annotated with the Test annotations from JUnit4/5 or TestNG. diff --git a/pmd-java/src/main/resources/category/java/codestyle.xml b/pmd-java/src/main/resources/category/java/codestyle.xml index a1a3953db66..6f918c76f25 100644 --- a/pmd-java/src/main/resources/category/java/codestyle.xml +++ b/pmd-java/src/main/resources/category/java/codestyle.xml @@ -409,7 +409,7 @@ public class Foo extends Bar{ inherit from a super class or implement any interface and only has static fields or methods. - This rule detects test classes using the following convention: Test classes are classes, that + This rule detects test classes using the following convention: Test classes are top-level classes, that either inherit from JUnit 3 TestCase or have at least one method annotated with the Test annotations from JUnit4/5 or TestNG.