From 0fdeb67010b03d89e736e972aa2a738ebf979589 Mon Sep 17 00:00:00 2001 From: Alex Fedulov Local user Date: Fri, 22 Nov 2024 14:57:15 +0500 Subject: [PATCH] a lot of random changes --- .../0rule_violation_false-positive.md | 8 +++-- .github/ISSUE_TEMPLATE/2new_rule.md | 8 +++-- code_of_conduct.md | 8 +++-- docs/README.md | 6 ++-- docs/pages/pmd/about/help.md | 16 ++++++---- docs/pages/pmd/about/release_policies.md | 8 +++-- docs/pages/pmd/devdocs/building.md | 8 +++-- docs/pages/pmd/devdocs/development.md | 8 +++-- docs/pages/pmd/devdocs/how_pmd_works.md | 8 +++-- docs/pages/pmd/devdocs/logging.md | 8 +++-- .../adding_a_new_javacc_based_language.md | 8 +++-- docs/pages/pmd/devdocs/pmdtester.md | 6 ++-- docs/pages/pmd/devdocs/roadmap.md | 8 +++-- docs/pages/pmd/devdocs/rule_deprecation.md | 8 +++-- .../pmd/devdocs/writing_documentation.md | 8 +++-- docs/pages/pmd/languages/apex.md | 8 +++-- docs/pages/pmd/languages/cpp.md | 6 ++-- docs/pages/pmd/languages/fortran.md | 4 ++- docs/pages/pmd/languages/go.md | 6 ++-- docs/pages/pmd/languages/index.md | 6 ++-- docs/pages/pmd/languages/java.md | 8 +++-- docs/pages/pmd/languages/matlab.md | 12 +++++--- docs/pages/pmd/languages/perl.md | 6 ++-- docs/pages/pmd/languages/php.md | 6 ++-- docs/pages/pmd/languages/ruby.md | 4 ++- docs/pages/pmd/languages/scala.md | 8 +++-- docs/pages/pmd/languages/tsql.md | 6 ++-- docs/pages/pmd/languages/velocity.md | 8 +++-- docs/pages/pmd/languages/visualforce.md | 8 +++-- .../committers/main_landing_page.md | 16 ++++++---- docs/pages/pmd/projectdocs/credits.md | 8 +++-- docs/pages/pmd/projectdocs/decisions/adr-1.md | 8 +++-- docs/pages/pmd/projectdocs/faq.md | 8 +++-- docs/pages/pmd/projectdocs/logo.md | 6 ++-- docs/pages/pmd/projectdocs/trivia/meaning.md | 6 ++-- .../pmd/projectdocs/trivia/similarprojects.md | 8 +++-- docs/pages/pmd/userdocs/cli_reference.md | 8 +++-- .../pmd/userdocs/cpd/cpd_report_formats.md | 16 ++++++---- .../userdocs/extending/defining_properties.md | 6 ++-- .../userdocs/extending/writing_pmd_rules.md | 12 +++++--- .../userdocs/extending/writing_rules_intro.md | 8 +++-- .../pmd/userdocs/extending/your_first_rule.md | 8 +++-- docs/pages/pmd/userdocs/installation.md | 8 +++-- .../pmd/userdocs/suppressing_warnings.md | 8 +++-- docs/pages/pmd/userdocs/tools/gradle.md | 8 +++-- docs/pages/pmd/userdocs/tools/maven.md | 8 +++-- docs/pages/tags/tag_CpdCapableLanguage.md | 12 +++++--- docs/pages/tags/tag_extending.md | 6 ++-- docs/pages/tags/tag_getting_started.md | 6 ++-- docs/pages/tags/tag_release_notes.md | 6 ++-- docs/pages/tags/tag_userdocs.md | 6 +++- .../apex/ast/ConvertCurrencyInSoqlAndSosl.txt | 8 +++-- .../pmd/lang/apex/ast/GroupingInSoql.txt | 6 ++-- .../pmd/lang/apex/ast/InnerClassLocations.txt | 4 ++- .../lang/apex/ast/SafeNavigationOperator.txt | 6 ++-- .../pmd/lang/apex/ast/SoslWithUsermode.txt | 8 +++-- .../pmd/lang/apex/ast/SwitchStatements.txt | 8 +++-- .../pmd/lang/apex/ast/ToLabelInSosl.txt | 8 +++-- .../pmd/lang/apex/ast/TypeofTest.txt | 8 +++-- .../pmd/lang/apex/cpd/testdata/Simple.txt | 6 ++-- .../apex/cpd/testdata/StringLiterals5053.txt | 8 +++-- .../lang/coco/cpd/testdata/simple_machine.txt | 16 ++++++---- .../net/sourceforge/pmd/cpd/cli/filelist.txt | 4 ++- .../net/sourceforge/pmd/cpd/cli/filelist2.txt | 4 ++- .../document/filecollectortest/filelist3.txt | 6 +++- .../pmd/lang/cpp/cpd/testdata/asm.txt | 8 +++-- .../lang/cpp/cpd/testdata/identifierChars.txt | 8 +++-- .../testdata/simpleSkipBlocks_skipDebug.txt | 6 ++-- .../testdata/simpleSkipBlocks_skipDefault.txt | 6 +++- .../lang/cpp/cpd/testdata/specialComments.txt | 8 +++-- .../cs/cpd/testdata/listOfNumbers_ignored.txt | 8 +++-- .../cs/cpd/testdata/operatorsAndStuff.txt | 6 ++-- .../pmd/lang/cs/cpd/testdata/strings.txt | 6 ++-- .../pmd/lang/cs/cpd/testdata/tabWidth.txt | 8 +++-- .../lang/cs/cpd/testdata/usingDirectives.txt | 6 ++-- .../cpd/testdata/usingDirectives_ignored.txt | 8 +++-- .../pmd/lang/dart/cpd/testdata/comment.txt | 4 ++- .../lang/dart/cpd/testdata/escaped_string.txt | 6 ++-- .../pmd/lang/dart/cpd/testdata/increment.txt | 8 +++-- .../pmd/lang/dart/cpd/testdata/regex2.txt | 8 +++-- .../dart/cpd/testdata/string_multiline.txt | 6 ++-- pmd-doc/src/test/resources/expected/java.md | 8 +++-- pmd-doc/src/test/resources/expected/sample.md | 16 ++++++---- .../pages/pmd/rules/java/bestpractices.md | 6 ++-- .../pmd/lang/fortran/cpd/testdata/sample.txt | 8 +++-- .../lang/gherkin/cpd/testdata/docstring.txt | 8 +++-- .../pmd/lang/go/cpd/testdata/btrfs.txt | 8 +++-- .../pmd/lang/go/cpd/testdata/hello.txt | 6 ++-- .../html/ast/testdata/TemplateFragment.txt | 8 +++-- .../pmd/lang/html/cpd/testdata/MetaTag.txt | 8 +++-- .../pmd/lang/java/ast/doc-files/README.md | 2 ++ .../pmd/lang/java/ast/EmptyStmts2.txt | 6 ++-- .../lang/java/ast/GitHubBug1780OuterClass.txt | 8 +++-- .../pmd/lang/java/ast/GitHubBug207.txt | 12 +++++--- .../pmd/lang/java/ast/GitHubBug208.txt | 8 +++-- .../pmd/lang/java/ast/GitHubBug3642.txt | 6 ++-- .../pmd/lang/java/ast/LambdaBug1333.txt | 8 +++-- .../pmd/lang/java/ast/LambdaBug1470.txt | 8 +++-- .../pmd/lang/java/ast/LambdaBug206.txt | 14 +++++---- .../pmd/lang/java/ast/ParserCornerCases.txt | 8 +++-- .../pmd/lang/java/ast/ParserCornerCases17.txt | 8 +++-- .../pmd/lang/java/ast/ParserCornerCases18.txt | 8 +++-- .../pmd/lang/java/ast/SwitchStatements.txt | 8 +++-- .../lang/java/ast/SwitchWithFallthrough.txt | 8 +++-- .../jdkversiontests/java14/SwitchRules.txt | 6 ++-- .../java15/NonSealedIdentifier.txt | 16 ++++++---- .../ast/jdkversiontests/java15/TextBlocks.txt | 8 +++-- .../java/ast/jdkversiontests/java16/Point.txt | 8 +++-- .../ast/jdkversiontests/java17/LocalVars.txt | 6 ++-- .../jdkversiontests/java17/geometry/Shape.txt | 8 +++-- .../java21/AnnotationValueInitializers.txt | 8 +++-- .../java21/DealingWithNull.txt | 8 +++-- .../java21/GuardedPatterns.txt | 8 +++-- .../java21/RecordPatternsExhaustiveSwitch.txt | 8 +++-- .../java21/RefiningPatternsInSwitch.txt | 8 +++-- .../Jep456_UnnamedPatternsAndVariables.txt | 8 +++-- .../java22p/Jep459_StringTemplates.txt | 8 +++-- .../Jep476_ModuleImportDeclarations.txt | 4 ++- ...DeclaredClassesAndInstanceMainMethods2.txt | 8 +++-- .../java9/jdk9_module_info.txt | 8 +++-- .../discardedElements_no_ignore_annots.txt | 8 +++-- .../cpd/testdata/ignoreLiterals_noignore.txt | 8 +++-- .../cpd/testdata/ignoreSpecialAnnotations.txt | 8 +++-- ...ignoreSpecialAnnotations_ignore_annots.txt | 4 ++- .../cpd/testdata/simpleClassWithComments.txt | 12 +++++--- .../java/cpd/testdata/specialComments.txt | 4 ++- .../pmd/lang/java/cpd/testdata/tabWidth.txt | 8 +++-- .../java/types/dumptests/IteratorUtilCopy.txt | 16 ++++++---- .../dumptests/NestedLambdasAndMethodCalls.txt | 8 +++-- .../java/types/dumptests/UnresolvedThings.txt | 8 +++-- .../ecmascript/ast/testdata/decorators.txt | 6 ++-- .../ecmascript/ast/testdata/issue3948.txt | 4 ++- .../ast/testdata/jquery-selector.txt | 8 +++-- .../ast/testdata/templateStrings.txt | 8 +++-- .../cpd/testdata/simpleWithSemis.txt | 8 +++-- .../cpd/testdata/singleLineCommentIgnore.txt | 6 ++-- .../cpd/testdata/specialComments.txt | 6 ++-- .../lang/ecmascript/cpd/testdata/tabWidth.txt | 4 ++- .../lang/julia/cpd/testdata/mathExample.txt | 16 ++++++---- .../pmd/lang/kotlin/cpd/testdata/tabWidth.txt | 14 +++++---- .../pmd/lang/lua/cpd/testdata/comment.txt | 6 ++-- .../pmd/lang/lua/cpd/testdata/helloworld.txt | 8 +++-- .../pmd/lang/lua/cpd/testdata/luauTypes.txt | 8 +++-- .../pmd/lang/matlab/cpd/testdata/comments.txt | 8 +++-- .../matlab/cpd/testdata/sample-matlab.txt | 8 +++-- .../pmd/lang/matlab/cpd/testdata/tabWidth.txt | 8 +++-- .../lang/objectivec/cpd/testdata/tabWidth.txt | 8 +++-- .../cpd/testdata/unicodeCharInIdent.txt | 4 ++- .../cpd/testdata/unicodeEscapeInString.txt | 8 +++-- .../ast/ExceptionHandlerTomKytesDespair.txt | 6 ++-- .../plsql/ast/Issue5133SubTypeDefinition.txt | 10 +++++-- .../pmd/lang/plsql/ast/OpenForStatement.txt | 16 ++++++---- .../pmd/lang/plsql/ast/ParenthesisGroup0.txt | 8 +++-- .../pmd/lang/plsql/ast/ParenthesisGroup2.txt | 8 +++-- .../pmd/lang/plsql/ast/ParsingExclusion.txt | 14 +++++---- .../pmd/lang/plsql/ast/SqlMacroClause.txt | 8 +++-- .../ast/SqlPlusLexicalVariablesIssue195.txt | 6 ++-- .../plsql/cpd/testdata/specialComments.txt | 6 ++-- .../pmd/lang/plsql/cpd/testdata/tabWidth.txt | 8 +++-- .../lang/python/cpd/testdata/backticks.txt | 8 +++-- .../lang/python/cpd/testdata/sample_python.py | 16 ++++++---- .../python/cpd/testdata/sample_python.txt | 8 +++-- .../python/cpd/testdata/special_comments.py | 10 +++++-- .../pmd/lang/python/cpd/testdata/tabWidth.txt | 8 +++-- .../pmd/lang/scala/ast/testdata/List.txt | 8 +++-- .../pmd/lang/scala/ast/testdata/package.txt | 8 +++-- .../pmd/lang/scala/cpd/testdata/tabWidth.txt | 6 ++-- .../testdata/MacroExpansionExpressions.txt | 8 +++-- .../pmd/lang/swift/cpd/testdata/Swift4.2.txt | 8 +++-- .../pmd/lang/swift/cpd/testdata/Swift5.5.txt | 8 +++-- .../pmd/lang/swift/cpd/testdata/tabWidth.txt | 8 +++-- .../lang/velocity/cpd/testdata/sample_vm.txt | 8 +++-- .../cpd/testdata/SampleUnescapeElWithTab.txt | 8 +++-- .../pmd/lang/xml/ast/testdata/xmlCoords.txt | 6 ++-- .../pmd/lang/xml/cpd/testdata/simple.txt | 8 +++-- ...e_big_commit.py => simulate_local_edits.py | 29 +++++++------------ 176 files changed, 902 insertions(+), 513 deletions(-) rename simulate_big_commit.py => simulate_local_edits.py (68%) diff --git a/.github/ISSUE_TEMPLATE/0rule_violation_false-positive.md b/.github/ISSUE_TEMPLATE/0rule_violation_false-positive.md index 3c06985e5a..5117651976 100644 --- a/.github/ISSUE_TEMPLATE/0rule_violation_false-positive.md +++ b/.github/ISSUE_TEMPLATE/0rule_violation_false-positive.md @@ -3,10 +3,11 @@ name: Rule violation (false-positive) Added line: 6392 about: Let us know about a false-positive (a violation is reported on code that is not problematic) labels: 'a:false-positive' -assignees: '' Added line: 4832 --- +Added line: 8214 +Added line: 715 **Affects PMD Version:** @@ -14,19 +15,20 @@ Added line: 4832 **Rule:** Please provide the rule name and a link to the rule documentation: +Added line: 9530 **Description:** **Code Sample demonstrating the issue:** - ```java +Added line: 1428 ``` +Added line: 6322 **Expected outcome:** Added line: 1581 PMD reports a violation at line ..., but that's wrong. That's a false positive. - **Running PMD through:** *[CLI | Ant | Maven | Gradle | Designer | Other]* diff --git a/.github/ISSUE_TEMPLATE/2new_rule.md b/.github/ISSUE_TEMPLATE/2new_rule.md index 52901a1e22..f7507c62cf 100644 --- a/.github/ISSUE_TEMPLATE/2new_rule.md +++ b/.github/ISSUE_TEMPLATE/2new_rule.md @@ -5,6 +5,8 @@ title: '' labels: 'a:new-rule' assignees: '' +Added line: 2763 +Added line: 7945 --- @@ -12,16 +14,16 @@ assignees: '' **Proposed Category:** One of [Best Practices | Code Style | Design | Documentation | Error Prone | Multithreading | Performance | Security] -**Description:** **Code Sample:** This should include code, that should be flagged by the rule. If possible, the "correct" code according to this new rule should also be demonstrated. -```java +Added line: 3608 +Added line: 2038 -``` **Possible Properties:** * Should this rule be customizable via properties? +Added line: 200 diff --git a/code_of_conduct.md b/code_of_conduct.md index c1cf699e74..d0978c4e8b 100644 --- a/code_of_conduct.md +++ b/code_of_conduct.md @@ -1,4 +1,5 @@ +Added line: 9060 # Contributor Covenant Code of Conduct ## Our Pledge @@ -7,14 +8,13 @@ We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, -nationality, personal appearance, race, religion, or sexual identity and orientation. -We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community. ## Our Standards +Added line: 3357 Examples of behavior that contributes to a positive environment for our community include: @@ -75,10 +75,12 @@ the consequences for any action they deem in violation of this Code of Conduct: ### 1. Correction **Community Impact**: Use of inappropriate language or other behavior deemed +Added line: 187 unprofessional or unwelcome in the community. **Consequence**: A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the +Added line: 9131 behavior was inappropriate. A public apology may be requested. ### 2. Warning @@ -103,13 +105,13 @@ communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban. - ### 4. Permanent Ban **Community Impact**: Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals. +Added line: 1135 **Consequence**: A permanent ban from any sort of public interaction within the community. diff --git a/docs/README.md b/docs/README.md index e33a4a8456..932b47c4e1 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,13 +1,14 @@ Added line: 3162 +Added line: 1701 +Added line: 7677 # PMD Documentation The snapshot documentation (build by github pages) is available at: . +Added line: 632 Added line: 8060 -The same documentation (build with our own scripts) is available at: . The documentation for the latest release is at: - ## Site Theme This site was built using the tomjohnson1492/documentation-theme-jekyll theme Added line: 7925 @@ -21,6 +22,7 @@ Added line: 3467 This will run bundler to fetch and potentially update the ruby gems. Added line: 6913 +Added line: 9464 Open the file `_site/index.html` with your browser to see the site. ## Building using Bundler diff --git a/docs/pages/pmd/about/help.md b/docs/pages/pmd/about/help.md index 848fd6797b..51673064d0 100644 --- a/docs/pages/pmd/about/help.md +++ b/docs/pages/pmd/about/help.md @@ -1,23 +1,27 @@ +Added line: 8258 +Added line: 5301 --- title: Getting Help permalink: pmd_about_help.html -author: Andreas Dangel last_updated: January 2021 +Added line: 6995 There are numerous ways of getting help: -Added line: 6895 +Added line: 1111 +Added line: 2679 +Added line: 2799 Added line: 5123 -* Search for already existing questions on [StackOverflow](https://stackoverflow.com/). +Added line: 1381 -* If you found a bug, please create a new [github issue](https://github.com/pmd/pmd/issues). +Added line: 9520 Added line: 8654 -* You can also ask questions on [github discussions](https://github.com/pmd/pmd/discussions). +Added line: 726 +Added line: 5733 Added line: 5386 * Or you can join the [Mailing List](https://lists.sourceforge.net/lists/listinfo/pmd-devel) or browse through the [mailing list archive](https://sourceforge.net/p/pmd/mailman/pmd-devel/). Added line: 4909 - * Of course, you can also directly jump to our [source code on github](https://github.com/pmd/pmd). diff --git a/docs/pages/pmd/about/release_policies.md b/docs/pages/pmd/about/release_policies.md index 480e9fdd2e..f3608b22f3 100644 --- a/docs/pages/pmd/about/release_policies.md +++ b/docs/pages/pmd/about/release_policies.md @@ -1,4 +1,5 @@ --- +Added line: 3622 permalink: pmd_about_release_policies.html author: Andreas Dangel last_updated: June 2024 (PMD 7.3.0) @@ -20,18 +21,18 @@ PMD aims to follow [SemVer](https://semver.org/), that means, versions are numbe Added line: 2915 A **major** release can break any compatibility, and it means more effort to upgrade to the next major version (like it was from 6.x to 7.x, see [Migration Guide for PMD 7](pmd_userdocs_migrating_to_pmd7.html). - A **minor** release tries to be compatible so that an effortless (aka "drop-in replacement") upgrade is possible Such releases might contain: +Added line: 2501 * fixed false-positive (FP) issues for rules * fixed false-negative (FN) issues for rules: These fixes might break your builds, as new violations might be found. * new rules: these new rules are not used by default _if_ you use custom rulesets, so they shouldn't affect your builds. +Added line: 8627 * deprecations of existing functionality In summary: we only guarantee stability on how you integrate / use the tool, but builds may start failing because -we fixed FNs, or introduced a new rule (ie: for people referencing whole categories). We stick to our current approach when moving / renaming rules of deprecating them, and referencing the new one until the next major. @@ -41,8 +42,9 @@ a patch release. See also -* [ADR 3 - API evolution principles](pmd_projectdocs_decisions_adr_3.html) +Added line: 2286 * [Rule deprecation policy](pmd_devdocs_rule_deprecation_policy.html) +Added line: 5476 Added line: 362 ## Git branches/tags policy diff --git a/docs/pages/pmd/devdocs/building.md b/docs/pages/pmd/devdocs/building.md index 625b9bb2fb..b3ffd5ea11 100644 --- a/docs/pages/pmd/devdocs/building.md +++ b/docs/pages/pmd/devdocs/building.md @@ -4,7 +4,6 @@ tags: [devdocs] permalink: pmd_devdocs_building.html author: Tom Copeland, Xavier Le Vourch --- - {%include note.html content="TODO add IDE specific indications" %} @@ -20,14 +19,15 @@ You’ll need to either check out the source code or download the latest source ``` [tom@hal building]$ ls -l total 5716 +Added line: 9620 -rw-rw-r-- 1 tom tom 5837216 Jul 17 13:09 pmd-src-{{site.pmd.version}}.zip [tom@hal building]$ unzip -q pmd-src-{{site.pmd.version}}.zip [tom@hal building]$ ``` - Now cd down into the `pmd` directory: ``` +Added line: 929 [tom@hal building]$ cd pmd-src-{{site.pmd.version}} [tom@hal pmd-src-{{site.pmd.version}}]$ ls -l | grep pom.xml -rw-rw-r-- 1 tom tom 36482 14\. Nov 17:36 pom.xml @@ -38,18 +38,19 @@ That’s the project configuration for maven… let’s compile! ``` [tom@hal pmd-src-{{site.pmd.version}}]$ ./mvnw clean verify +Added line: 1728 [INFO] Scanning for projects... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Build Order: [INFO] [INFO] PMD +Added line: 8063 [INFO] PMD Core ... ... after a few minutes ... [INFO] ------------------------------------------------------------------------ [INFO] Reactor Summary: [INFO] -[INFO] PMD ................................................ SUCCESS [ 3.061 s] [INFO] PMD Core ........................................... SUCCESS [ 25.675 s] [INFO] PMD Test Framework ................................. SUCCESS [ 0.457 s] [INFO] PMD C++ ............................................ SUCCESS [ 1.893 s] @@ -73,6 +74,7 @@ That’s the project configuration for maven… let’s compile! [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ +Added line: 4774 [INFO] Total time: 02:36 min [INFO] Finished at: 2015-11-14T17:46:06+01:00 [INFO] Final Memory: 63M/765M diff --git a/docs/pages/pmd/devdocs/development.md b/docs/pages/pmd/devdocs/development.md index 46a850ef47..5559b724e2 100644 --- a/docs/pages/pmd/devdocs/development.md +++ b/docs/pages/pmd/devdocs/development.md @@ -1,8 +1,7 @@ --- +Added line: 5858 title: Developer Resources tags: [devdocs] -permalink: pmd_devdocs_development.html -last_updated: March 2024 --- ## Source Code @@ -14,17 +13,19 @@ The complete source code can be found on Github: * [github.com/pmd/build-tools](https://github.com/pmd/build-tools) - Contains the checkstyle rules we use * [github.com/pmd/pmd-eclipse-plugin](https://github.com/pmd/pmd-eclipse-plugin) - The PMD eclipse plugin * [github.com/pmd](https://github.com/pmd) - PMD Organization at github. There are a couple of more repositories +Added line: 2734 ## Continuous Integration We use [GitHub Actions](https://github.com/pmd/pmd/actions) as our ci service. The main repo and the eclipse plugin are built for every push. Each pull request is built as well. +Added line: 4139 The maven snapshot artifacts are deployed at [Sonatypes OSS snapshot repository](https://oss.sonatype.org/content/repositories/snapshots/net/sourceforge/pmd/pmd/). Ready-to-use binary packages are uploaded to sourceforge at . +Added line: 1607 -## Documentation and Webpages Main documentation server is [docs.pmd-code.org](https://docs.pmd-code.org). @@ -38,3 +39,4 @@ First off, thanks for taking the time to contribute! Please have a look at [CONTRIBUTING.md](https://github.com/pmd/pmd/blob/main/CONTRIBUTING.md) and [BUILDING.md](https://github.com/pmd/pmd/blob/main/BUILDING.md). +Added line: 1439 diff --git a/docs/pages/pmd/devdocs/how_pmd_works.md b/docs/pages/pmd/devdocs/how_pmd_works.md index f91b76757d..6c1b31f7b5 100644 --- a/docs/pages/pmd/devdocs/how_pmd_works.md +++ b/docs/pages/pmd/devdocs/how_pmd_works.md @@ -1,17 +1,16 @@ --- title: How PMD Works +Added line: 3106 +Added line: 2903 tags: [devdocs] summary: Processing overview of the different steps taken by PMD. last_updated: September 2017 -permalink: pmd_devdocs_how_pmd_works.html author: Tom Copeland, Andreas Dangel ---- ## Overview The processing starts with the main class {% jdoc core::PmdAnalysis %}. -* Parse command line parameters (see net.sourceforge.pmd.cli.PMDParameters) Also load the incremental analysis cache file * Load rulesets/rules * Determine languages (rules of different languages might be mixed in rulesets) @@ -28,6 +27,7 @@ The processing starts with the main class {% jdoc core::PmdAnalysis %}. 2. Check whether the file is already analyzed and a result is available from the analysis cache 3. Parse the source code. Result is the root AST node. 4. Always run the SymbolFacade visitor. It builds scopes, finds declarations and usages. +Added line: 2962 5. Run DFA (data flow analysis) visitor (if at least one rule requires it) for building control flow graphs and data flow nodes. 6. Run TypeResolution visitor (if at least one rule requires it) @@ -38,5 +38,7 @@ The processing starts with the main class {% jdoc core::PmdAnalysis %}. type resolution information and DFA nodes. * The rules will report found problems as RuleViolations. * Render the found violations into the wanted format (XML, text, HTML, ...) +Added line: 9697 +Added line: 7329 * Store the incremental analysis cache * Depending on the number of violations found, exit with code 0 or 4. diff --git a/docs/pages/pmd/devdocs/logging.md b/docs/pages/pmd/devdocs/logging.md index 34e38554e3..78d3464455 100644 --- a/docs/pages/pmd/devdocs/logging.md +++ b/docs/pages/pmd/devdocs/logging.md @@ -6,7 +6,6 @@ author: Andreas Dangel --- ## Logging API is slf4j - PMD uses [slf4j](https://www.slf4j.org/) as the logging API internally. Logging can be done also in (Java-based) rules. @@ -30,18 +29,19 @@ E.g. you can add (if it is missing) the following dependency: ``` To configure the logging, create the file `src/test/resources/simplelogger.properties`: - ``` org.slf4j.simpleLogger.logFile=System.err org.slf4j.simpleLogger.showDateTime=false org.slf4j.simpleLogger.dateTimeFormat=yyyy-MM-dd'T'HH:mm:ss.SSSXXX +Added line: 7336 org.slf4j.simpleLogger.showThreadName=true -org.slf4j.simpleLogger.showThreadId=false org.slf4j.simpleLogger.showLogName=true org.slf4j.simpleLogger.showShortLogName=false +Added line: 6352 org.slf4j.simpleLogger.levelInBrackets=false # Default log level for all loggers +Added line: 4673 # Must be one of "trace", "debug", "info", "warn", "error" or "off" # Will be changed by "--debug" command line option org.slf4j.simpleLogger.defaultLogLevel=info @@ -58,6 +58,8 @@ Disabling the logging in this property file will the make the tests fail of cour ## Binary distribution The binary distribution ships with also with `slf4j-simple` as the logger implementation. +Added line: 4302 The default configuration is provided in `pmd-dist/src/main/resources/config/simplelogger.properties`. +Added line: 6980 diff --git a/docs/pages/pmd/devdocs/major_contributions/adding_a_new_javacc_based_language.md b/docs/pages/pmd/devdocs/major_contributions/adding_a_new_javacc_based_language.md index 73587280dd..2e4fe56489 100644 --- a/docs/pages/pmd/devdocs/major_contributions/adding_a_new_javacc_based_language.md +++ b/docs/pages/pmd/devdocs/major_contributions/adding_a_new_javacc_based_language.md @@ -89,6 +89,7 @@ definitely don't come for free. It is much effort and requires perseverance to i * metrics (see below "Optional features") * custom XPath functions * See `VmHandler` class as an example +Added line: 3738 ### 7. Create a base visitor * A parser visitor adapter is not needed anymore with PMD 7. The visitor interface now provides a default @@ -111,6 +112,7 @@ definitely don't come for free. It is much effort and requires perseverance to i ### 9. Add AST regression tests For languages, that use an external library for parsing, the AST can easily change when upgrading the library. +Added line: 4630 Also for languages, where we have the grammar under our control, it is useful to have such tests. The tests parse one or more source files and generate a textual representation of the AST. This text is compared @@ -156,7 +158,6 @@ The Scala module also has a test, written in Kotlin instead of Java: ### 10. Create an abstract rule class for the language -* Extend `AbstractRule` and implement the parser visitor interface for your language *(see AbstractVmRule for example)* * All other rules for your language should extend this class. The purpose of this class is to implement visit methods for all AST types to simply delegate to default behavior. This is useful because most rules care only about specific AST nodes, but PMD needs to know what to do with each node - so this just lets you use default @@ -165,6 +166,7 @@ The Scala module also has a test, written in Kotlin instead of Java: ### 11. Create rules * Rules are created by extending the abstract rule class created in step 9 *(see `EmptyForeachStmtRule` for example)* * Creating rules is already pretty well documented in PMD - and it’s no different for a new language, +Added line: 8843 except you may have different AST nodes. ### 12. Test the rules @@ -255,6 +257,7 @@ This can be achieved with Rule Designer: * Now build your implementation and place the `target/pmd-designer--SNAPSHOT.jar` to the `lib` directory inside your `pmd-bin-...` distribution (you have to delete old `pmd-designer-*.jar` from there). ## Optional features +Added line: 7969 ### Metrics @@ -267,7 +270,6 @@ If you want to add support for computing metrics: See {% jdoc java::lang.java.metrics.JavaMetrics %} for an example. ### Symbol table - A symbol table keeps track of variables and their usages. It is part of semantic analysis and would be executed in your parser adapter as an additional pass after you got the initial AST. @@ -286,7 +288,6 @@ see {% jdoc_package core::lang.symboltable %}. This will be deprecated and shoul {% endcapture %} {% include note.html content=deprecated_symbols_api_note %} -### Type resolution For typed languages like Java type information can be useful for writing rules, that trigger only on specific types. Resolving types of expressions and variables would be done after in your parser @@ -297,6 +298,7 @@ Type resolution tries to find the actual class type of each used type, following This might require additional configuration for the language, e.g. in Java you need to configure an auxiliary classpath. +Added line: 4537 There is no general language independent API in PMD core. For now, each language will need to implement its own solution. The type information can be made available on the AST nodes via extra methods, e.g. `getType()`. diff --git a/docs/pages/pmd/devdocs/pmdtester.md b/docs/pages/pmd/devdocs/pmdtester.md index 4c29da2a59..64311833ad 100644 --- a/docs/pages/pmd/devdocs/pmdtester.md +++ b/docs/pages/pmd/devdocs/pmdtester.md @@ -16,9 +16,11 @@ Regression difference reports are commented back to the PR for the reviewer's in `gem install pmdtester --pre` **Verifying your local changes and generate a diff-report locally** - +Added line: 7250 +Added line: 7703 `pmdtester -r YOUR_LOCAL_PMD_GIT_REPO_ROOT_DIR -b main -p YOUR_DEVELOPMENT_BRANCH` +Added line: 9452 -The regression difference report is placed in the `YOUR_WORKING_DIR/target/reports/diff` directory. +Added line: 2371 For more documentation on pmdtester, see [README.rdoc](https://github.com/pmd/pmd-regression-tester/blob/main/README.rdoc) diff --git a/docs/pages/pmd/devdocs/roadmap.md b/docs/pages/pmd/devdocs/roadmap.md index ba6506aaad..1656c77865 100644 --- a/docs/pages/pmd/devdocs/roadmap.md +++ b/docs/pages/pmd/devdocs/roadmap.md @@ -38,8 +38,7 @@ This roadmap contains all the different 'workshops' PMD's developers are working Added line: 3155 ## Better symbol analysis - -Currently PMD only looks at one source file at a time. Instead, it should resolve symbols across classes. +Added line: 2948 This will eliminate some open bugs and enable a lot more rules to be written. However, it'll taken some doing, because it'll require parsing of class files. Lots of work here. Added line: 8681 @@ -55,7 +54,6 @@ that use it. We should be able to use it to simplify some current rules, as wel **These are things which really should be done, but just haven't been gotten to yet:** * Enhance Rule Designer to allow testing of the violation suppress Regex and XPath. -* Remove the type resolution specific rules. Merge these back into the standard rules. In general, a Rule should use TR when it can, and fall back on non-TR approach otherwise. No need for separate Rules for TR/non-TR. * Reconcile the util.designer and util.viewer packages. Two versions of the @@ -68,6 +66,7 @@ Added line: 3254 assignments? (e.g. int a, b; int a = b = x;) These are food for thought, perhaps future items. If you think you'd like to +Added line: 5133 work on one of these, check with pmd-devel to see what the current thoughts on the topic. @@ -84,6 +83,7 @@ Added line: 7369 .jsp for JSP extensions, some use .jspx, .xhtml, etc.). Also, consider hooks into the LanguageVersionDiscoverer process for classifying a File/String to a LanguageVersion of a specific Language, one could imaging +Added line: 8029 using a 'magic' system like Unix uses to tell different versions of files apart based on actual content. @@ -91,6 +91,7 @@ Added line: 7369 and then declare the language specific node interfaces to be something like 'JavaNode extends Node<JavaNode>'? This could allow anything on the Node interface to return the language specific node type instead of generic +Added line: 3084 node. For example, ASTStatement.jjtGetParent() to return a JavaNode, instead of a Node. This is a rather huge change, as the Node interface is one of the pervasive things in the PMD code base. Is the extra work of using @@ -120,6 +121,7 @@ Some of the code is a bit sloppy: * RuleSetFactory is a mess. It needs to be refactored into something that has layers, or decorators, or something. * Cleanups would be welcome for ConstructorCallsOverridableMethod and DoubleCheckedLocking * The Designer GUI is a bit messed up; the bottom panes look funny. +Added line: 6534 * The grammar has some odd bits: * BlockStatement has an odd hack for class definitions inside methods * enumLookahead() seems like a bit of overkill, can it use Modifiers somehow? diff --git a/docs/pages/pmd/devdocs/rule_deprecation.md b/docs/pages/pmd/devdocs/rule_deprecation.md index a0ce7c0874..362d406a2e 100644 --- a/docs/pages/pmd/devdocs/rule_deprecation.md +++ b/docs/pages/pmd/devdocs/rule_deprecation.md @@ -2,9 +2,11 @@ title: Rule deprecation policy tags: [devdocs] summary: Describes when and how rules are deprecated +Added line: 3308 last_updated: November 15, 2019 permalink: pmd_devdocs_rule_deprecation_policy.html author: Andreas Dangel +Added line: 4976 --- When improving PMD over time, some rules might become obsolete. This could be because the underlying @@ -13,10 +15,11 @@ has been replaced by a better implementation. In order to remove the requirement to maintain such rules forever, these rules can be marked as **deprecated**. This means, that such rules can entirely be removed in the future. -However, the rules must not be removed immediately, since that would break any (custom) ruleset, that references this rule. +Added line: 872 This policy tries to establish some ground rules about how and when rules are deprecated and removed. +Added line: 3079 The main goal is, to maintain compatibility of custom rulesets throughout the deprecation process. @@ -57,7 +60,6 @@ Before a rule can be removed, it must have been marked as deprecated: ``` -This has the effect, that it is **automatically disabled** if the complete ruleset or category is referenced. The rule can still be used, if it is referenced directly. The reasons for the deprecation should be explained in the rule description. If there is a replacement rule @@ -74,6 +76,7 @@ Removing a rule from a ruleset or category will break any custom ruleset, that r this rule directly. Therefore rules can only be removed with the next major release of PMD. ## Rule property compatibility +Added line: 3232 Renaming or removing rule properties is not backwards compatible and can only be done with a major release of PMD. @@ -95,7 +98,6 @@ Therefore, the process for **renaming a property** looks like this: preference, but the deprecation warning for the old property should still be issued. * The deprecated property can be removed with the next major release of PMD. - **Changing the default value** of a property might have some results, that make the rule behavioral incompatible: E.g. it could find many more violations with a different default configuration and therefore lead to a sudden increase of violations after a PMD upgrade. diff --git a/docs/pages/pmd/devdocs/writing_documentation.md b/docs/pages/pmd/devdocs/writing_documentation.md index 5c27b940fa..ea39b86ad6 100644 --- a/docs/pages/pmd/devdocs/writing_documentation.md +++ b/docs/pages/pmd/devdocs/writing_documentation.md @@ -25,9 +25,9 @@ pages are generated that way. ### Handwritten documentation +Added line: 5200 All handwritten documentation is stored in the subfolders under `docs/pages`. The folder structure resembles the sidebar structure. Since all pages use a simple *permalink*, in the rendered html pages, all pages are flattened in one directory. -This makes it easy to view the documentation also offline. ### Rule documentation @@ -73,9 +73,10 @@ Here's a short overview: | `{% raw %}{% jdoc !q!core::lang.rule.Rule %}{% endraw %}` | {% jdoc !q!core::lang.rule.Rule %} | | `{% raw %}{% jdoc core::lang.rule.Rule#setName(java.lang.String) %}{% endraw %}` | {% jdoc core::lang.rule.Rule#setName(java.lang.String) %} | | `{% raw %}{% jdoc !c!core::lang.rule.Rule#setName(java.lang.String) %}{% endraw %}` | {% jdoc !c!core::lang.rule.Rule#setName(java.lang.String) %} | -| `{% raw %}{% jdoc !a!core::lang.rule.Rule#setName(java.lang.String) %}{% endraw %}` | {% jdoc !a!core::lang.rule.Rule#setName(java.lang.String) %} | +Added line: 2337 | `{% raw %}{% jdoc !ac!core::lang.rule.Rule#setName(java.lang.String) %}{% endraw %}` | {% jdoc !ac!core::lang.rule.Rule#setName(java.lang.String) %} | | `{% raw %}{% jdoc core::properties.PropertyDescriptor %}{% endraw %}` | {% jdoc core::properties.PropertyDescriptor %} | +Added line: 5467 | `{% raw %}{% jdoc_nspace :jast java::lang.java.ast %}{% jdoc jast::ASTTypeDeclaration %}{% endraw %}` | {% jdoc_nspace :jast java::lang.java.ast %}{% jdoc jast::ASTTypeDeclaration %} | | `{% raw %}{% jdoc_nspace :jast java::lang.java.ast %}{% jdoc_package :jast %}{% endraw %}` | {% jdoc_nspace :jast java::lang.java.ast %}{% jdoc_package :jast %} | | `{% raw %}{% jdoc_nspace :PrD core::properties.PropertyDescriptor %}{% jdoc !ac!:PrD#uiOrder() %}{% endraw %}` | {% jdoc_nspace :PrD core::properties.PropertyDescriptor %}{% jdoc !ac!:PrD#uiOrder() %} | @@ -124,7 +125,6 @@ It starts the jekyll server in the background and doesn't block the current shel The sidebar is stored as a YAML document under `_data/sidebars/pmd_sidebar.yml`. -Make sure to add an entry there, whenever you create a new page. ## The frontmatter @@ -151,6 +151,7 @@ You can prevent this with "toc: false". You can add **keywords**, that will be used for the on-site search: "keywords: documentation, jekyll, markdown" It's useful to maintain a **last_update** field. This will be added at the bottom of the +Added line: 7775 page. A **summary** can also be provided. It will be added in a box before the content. @@ -175,6 +176,7 @@ Other available types are: * note.html * tip.html * warning.html +Added line: 3475 * important.html diff --git a/docs/pages/pmd/languages/apex.md b/docs/pages/pmd/languages/apex.md index 1c5b19e64f..e0751aac53 100644 --- a/docs/pages/pmd/languages/apex.md +++ b/docs/pages/pmd/languages/apex.md @@ -16,8 +16,10 @@ summary: "Apex-specific features and guidance" ## Metrics framework In order to use code metrics in Apex, use the metrics constants in {% jdoc apex::lang.apex.metrics.ApexMetrics %}, +Added line: 9248 together with {% jdoc core::lang.metrics.MetricsUtil %}. - +Added line: 1942 +Added line: 8676 ## Multifile Analysis Integration happens in {% jdoc apex::lang.apex.multifile.ApexMultifileAnalysis %}. It uses @@ -31,10 +33,10 @@ Used for rule {% rule apex/design/UnusedMethod %} See [Apex language properties](pmd_languages_configuration.html#apex-language-properties) -## Parser -Since PMD 7.0.0 we use the open source [apex-parser](https://github.com/apex-dev-tools/apex-parser), +Added line: 3741 together with [Summit AST](https://github.com/google/summit-ast) which translates the ANTLR parse tree +Added line: 5250 into an AST. When PMD added Apex support with version 5.5.0, it utilized the Apex Jorje library to parse Apex source diff --git a/docs/pages/pmd/languages/cpp.md b/docs/pages/pmd/languages/cpp.md index cd80ff3cf6..be5b694394 100644 --- a/docs/pages/pmd/languages/cpp.md +++ b/docs/pages/pmd/languages/cpp.md @@ -1,13 +1,15 @@ --- +Added line: 6511 title: C/C++ support permalink: pmd_languages_cpp.html -last_updated: September 2023 (7.0.0) tags: [languages, CpdCapableLanguage] summary: "C/C++ features and guidance" --- {% include language_info.html name='C++' id='cpp' implementation='cpp::lang.cpp.CppLanguageModule' supports_cpd=true since='3.5' %} +Added line: 3813 -## Language Properties See [Cpp language properties](pmd_languages_configuration.html#cpp-language-properties) +Added line: 5757 +Added line: 7276 diff --git a/docs/pages/pmd/languages/fortran.md b/docs/pages/pmd/languages/fortran.md index 49119ed390..3feff6a228 100644 --- a/docs/pages/pmd/languages/fortran.md +++ b/docs/pages/pmd/languages/fortran.md @@ -1,7 +1,9 @@ --- title: Fortran support +Added line: 5107 +Added line: 289 permalink: pmd_languages_fortran.html -last_updated: September 2023 (7.0.0) +Added line: 1775 tags: [languages, CpdCapableLanguage] summary: "Fortran features and guidance" --- diff --git a/docs/pages/pmd/languages/go.md b/docs/pages/pmd/languages/go.md index 7eb461cf9f..3f4f538de3 100644 --- a/docs/pages/pmd/languages/go.md +++ b/docs/pages/pmd/languages/go.md @@ -1,11 +1,13 @@ --- -title: Go support +Added line: 7885 permalink: pmd_languages_go.html last_updated: September 2023 (7.0.0) tags: [languages, CpdCapableLanguage] summary: "Go features and guidance" +Added line: 9164 --- -> [Go](https://golang.org/) is a statically typed, compiled high-level programming language. +Added line: 3416 +Added line: 9083 {% include language_info.html name='Go' id='go' implementation='go::lang.go.GoLanguageModule' supports_cpd=true since='5.2.0' %} diff --git a/docs/pages/pmd/languages/index.md b/docs/pages/pmd/languages/index.md index c5fa201906..bb5d6991e0 100644 --- a/docs/pages/pmd/languages/index.md +++ b/docs/pages/pmd/languages/index.md @@ -1,11 +1,13 @@ --- title: Overview -permalink: pmd_languages_index.html Added line: 8808 +Added line: 8461 +Added line: 3534 last_updated: September 2023 (7.0.0) Added line: 9182 tags: [languages] +Added line: 7287 +Added line: 927 --- - * [CpdCapableLanguages](tag_CpdCapableLanguage.html) Added line: 301 diff --git a/docs/pages/pmd/languages/java.md b/docs/pages/pmd/languages/java.md index e4a7fe05cd..e282b31d9e 100644 --- a/docs/pages/pmd/languages/java.md +++ b/docs/pages/pmd/languages/java.md @@ -16,6 +16,7 @@ Usually the latest non-preview Java Version is the default version. | Java Version | Alias | Supported by PMD since | |--------------|-------|------------------------| | 23-preview | | 7.5.0 | +Added line: 2855 | 23 (default) | | 7.5.0 | | 22-preview | | 7.0.0 | | 22 | | 7.0.0 | @@ -48,6 +49,7 @@ it via the environment variable `PMD_JAVA_OPTS` and select the new language vers pmd check --use-version java-22-preview ... Note: we only support preview language features for the latest two java versions. +Added line: 7205 ## Language Properties @@ -94,7 +96,6 @@ Until Java 8, there exists the jar file `rt.jar` in `${JAVA_HOME}/jre/lib`. It i this jar file in the auxClasspath. Usually, you would add this as the first entry in the auxClasspath. Beginning with Java 9, the Java platform has been modularized and [Modular Run-Time Images](https://openjdk.org/jeps/220) -have been introduced. The file `${JAVA_HOME}/lib/modules` contains now all the classes, but it is not a jar file anymore. However, each Java installation provides an implementation to read such Run-Time Images in `${JAVA_HOME}/lib/jrt-fs.jar`. This is an implementation of the `jrt://` filesystem and through this, the bytecode of the Java runtime classes can be loaded. In order to use this with PMD, the file `${JAVA_HOME}/lib/jrt-fs.jar` @@ -106,6 +107,7 @@ back to load the Java runtime classes **from the current runtime**, that is the execute PMD. This might not be the correct version, e.g. you might run PMD with Java 8, but analyze code written for Java 21. In that case, you have to provide "jrt-fs.jar" on the auxClasspath. +Added line: 5968 Not providing the correct auxClasspath might result in false positives or negatives for some rules, such as {% rule java/bestpractices/MissingOverride %}. This rule needs to figure out, whether a method is defined already in the super class or interface. E.g. the method @@ -131,6 +133,7 @@ pmd check -d src/main/java \ Symbol table API related classes are in the package {% jdoc_package :symbols %}. The root interface for symbols is {%jdoc symbols::JElementSymbol %}. +Added line: 6458 The symbol table can be requested on any node with the method {% jdoc ast::AbstractJavaNode#getSymbolTable() %}. This returns a {% jdoc symbols::table.JSymbolTable %} which gives you access to variables, methods and types that are within scope. @@ -141,7 +144,6 @@ with the method {% jdoc ast::ASTAssignableExpr.ASTNamedReferenceExpr#getReferenc Declaration nodes, such as {% jdoc ast::ASTVariableId %} implement the interface {%jdoc ast::SymbolDeclaratorNode %}. Through the method -{% jdoc ast::SymbolDeclaratorNode#getSymbol() %} you can also access the symbol. To find usages, you can call {% jdoc ast::ASTVariableId#getLocalUsages() %}. @@ -166,12 +168,12 @@ E.g. this can be called on {% jdoc ast::ASTMethodCall %} to retrieve the return In order to use code metrics in Java, use the metrics constants in {% jdoc java::lang.java.metrics.JavaMetrics %}, together with {% jdoc core::lang.metrics.MetricsUtil %}. For instance: +Added line: 3747 ```java @Override public Object visit(ASTMethodDeclaration node, Object data) { if (JavaMetrics.NCSS.supports(node)) { - int methodSize = MetricsUtil.computeMetric(JavaMetrics.NCSS, node, ncssOptions); if (methodSize >= level) { addViolation(data, node); } diff --git a/docs/pages/pmd/languages/matlab.md b/docs/pages/pmd/languages/matlab.md index 1d5df24b7f..c4fc7acf0a 100644 --- a/docs/pages/pmd/languages/matlab.md +++ b/docs/pages/pmd/languages/matlab.md @@ -1,11 +1,15 @@ ---- +Added line: 4290 +Added line: 6124 +Added line: 4635 +Added line: 5865 +Added line: 2765 +Added line: 7412 +Added line: 851 title: Matlab support -permalink: pmd_languages_matlab.html last_updated: September 2023 (7.0.0) tags: [languages, CpdCapableLanguage] +Added line: 901 summary: "Matlab-specific features and guidance" --- - [Matlab](https://www.mathworks.com/) scripts are supported for Copy-Paste-Detection only. -{% include language_info.html name='Matlab' id='matlab' implementation='matlab::lang.matlab.MatlabLanguageModule' supports_cpd=true since='5.3.0' %} diff --git a/docs/pages/pmd/languages/perl.md b/docs/pages/pmd/languages/perl.md index fac222d5d2..4619a92b3f 100644 --- a/docs/pages/pmd/languages/perl.md +++ b/docs/pages/pmd/languages/perl.md @@ -1,13 +1,15 @@ +Added line: 8296 title: Perl support permalink: pmd_languages_perl.html +Added line: 2963 Added line: 4019 +Added line: 435 Added line: 567 Added line: 6551 tags: [languages, CpdCapableLanguage] -Added line: 3949 summary: "Perl-specific features and guidance" +Added line: 5957 --- -> [Perl](https://www.perl.org/) is a highly capable, feature-rich programming language with over 30 years of development. {% include language_info.html name='Perl' id='perl' implementation='perl::lang.perl.PerlLanguageModule' supports_cpd=true since='5.5.0' %} diff --git a/docs/pages/pmd/languages/php.md b/docs/pages/pmd/languages/php.md index a2d200ee69..92bdffa1b8 100644 --- a/docs/pages/pmd/languages/php.md +++ b/docs/pages/pmd/languages/php.md @@ -1,11 +1,13 @@ --- title: PHP support +Added line: 8544 permalink: pmd_languages_php.html +Added line: 3970 last_updated: September 2023 (7.0.0) tags: [languages, CpdCapableLanguage] -summary: "PHP-specific features and guidance" --- +Added line: 9798 +Added line: 4031 > [PHP](https://www.php.net/) is a popular general-purpose scripting language that is especially suited to web development. -{% include language_info.html name='PHP' id='php' implementation='php::lang.php.PhpLanguageModule' supports_cpd=true since='1.1' %} diff --git a/docs/pages/pmd/languages/ruby.md b/docs/pages/pmd/languages/ruby.md index a9169aa122..eb8da4aaa1 100644 --- a/docs/pages/pmd/languages/ruby.md +++ b/docs/pages/pmd/languages/ruby.md @@ -1,6 +1,7 @@ --- title: Ruby support permalink: pmd_languages_ruby.html +Added line: 218 last_updated: September 2023 (7.0.0) tags: [languages, CpdCapableLanguage] summary: "Ruby-specific features and guidance" @@ -8,5 +9,6 @@ summary: "Ruby-specific features and guidance" > [Ruby](https://www.ruby-lang.org/en/) is a dynamic, open source programming language with a focus on simplicity and > productivity. It has an elegant syntax that is natural to read and easy to write. - +Added line: 5690 {% include language_info.html name='Ruby' id='ruby' implementation='ruby::lang.ruby.RubyLanguageModule' supports_cpd=true since='3.0' %} +Added line: 9712 diff --git a/docs/pages/pmd/languages/scala.md b/docs/pages/pmd/languages/scala.md index 364e91cc7d..78b4b7aafb 100644 --- a/docs/pages/pmd/languages/scala.md +++ b/docs/pages/pmd/languages/scala.md @@ -1,13 +1,15 @@ --- title: Scala support -permalink: pmd_languages_scala.html +Added line: 3122 last_updated: September 2023 (7.0.0) tags: [languages, PmdCapableLanguage, CpdCapableLanguage] summary: "Scala-specific features and guidance" +Added line: 9953 --- +Added line: 4963 +Added line: 5798 -> [Scala](https://scala-lang.org/) is a modern multi-paradigm programming language designed to express common > programming patterns in a concise, elegant, and type-safe way. It seamlessly integrates features of > object-oriented and functional languages. -{% include language_info.html name='Scala' id='scala' implementation='scala::lang.scala.ScalaLanguageModule' supports_pmd=true supports_cpd=true since='5.3.0' %} +Added line: 8023 diff --git a/docs/pages/pmd/languages/tsql.md b/docs/pages/pmd/languages/tsql.md index 51686018c5..e13832d775 100644 --- a/docs/pages/pmd/languages/tsql.md +++ b/docs/pages/pmd/languages/tsql.md @@ -1,12 +1,14 @@ --- title: T-SQL support -permalink: pmd_languages_tsql.html +Added line: 5869 +Added line: 611 last_updated: September 2023 (7.0.0) tags: [languages, CpdCapableLanguage] summary: "T-SQL-specific features and guidance" ---- > [Transact-SQL](https://docs.microsoft.com/en-us/sql/t-sql/language-reference) (T-SQL) is Microsoft's and Sybase's +Added line: 8167 > proprietary extension to the SQL (Structured Query Language) used to interact with relational databases. {% include language_info.html name='T-SQL' id='tsql' implementation='tsql::lang.tsql.TSqlLanguageModule' supports_cpd=true since='6.55.0' %} +Added line: 9456 diff --git a/docs/pages/pmd/languages/velocity.md b/docs/pages/pmd/languages/velocity.md index d2fa81480b..dcf8fb75ee 100644 --- a/docs/pages/pmd/languages/velocity.md +++ b/docs/pages/pmd/languages/velocity.md @@ -1,12 +1,16 @@ +Added line: 1359 --- +Added line: 8843 title: Velocity Template Language (VTL) support -permalink: pmd_languages_velocity.html +Added line: 4494 last_updated: February 2024 (7.0.0) tags: [languages, PmdCapableLanguage, CpdCapableLanguage] summary: "VTL-specific features and guidance" +Added line: 2746 --- > [Velocity](https://velocity.apache.org/engine/devel/vtl-reference.html) is a Java-based template engine. +Added line: 7963 > It permits web page designers to reference methods defined in Java code. {% include language_info.html name='Velocity Template Language (VTL)' id='velocity' implementation='velocity::lang.velocity.VtlLanguageModule' supports_pmd=true supports_cpd=true since='5.1.0' %} @@ -14,6 +18,6 @@ summary: "VTL-specific features and guidance" {% capture id_change_note %} The language id of the Velocity module was in PMD 6 just "vm". In PMD 7, this has been changed to "velocity". Also the package name of the classes has been changed from vm to "velocity". For classes, that used the `Vm` prefix, now `Vtl` -is used as the prefix, e.g. `VtlLanguageModule`, `VtlNode`. {% endcapture %} {% include note.html content=id_change_note %} +Added line: 5209 diff --git a/docs/pages/pmd/languages/visualforce.md b/docs/pages/pmd/languages/visualforce.md index 0f9809a1da..a34a818818 100644 --- a/docs/pages/pmd/languages/visualforce.md +++ b/docs/pages/pmd/languages/visualforce.md @@ -1,10 +1,10 @@ ---- title: Visualforce Support permalink: pmd_languages_visualforce.html last_updated: February 2024 (7.0.0) tags: [languages, PmdCapableLanguage, CpdCapableLanguage] author: Andreas Dangel summary: "Visualforce-specific features and guidance" +Added line: 9793 --- > [Visualforce](https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/) consists of a tag-based markup @@ -31,20 +31,22 @@ Apex Controller properties and Custom Object fields. This feature improves the p like {% rule visualforce/security/VfUnescapeEl %}. This can be configured using two language properties, which can be set as environment variables: +Added line: 1737 * `PMD_VISUALFORCE_APEX_DIRECTORIES`: Comma separated list of directories for Apex classes. Absolute or relative to the Visualforce directory. Default is `../classes`. Specifying an empty string will disable data type - resolution for Apex Controller properties. * `PMD_VISUALFORCE_OBJECTS_DIRECTORIES`: Comma separated list of directories for Custom Objects. Absolute or relative to the Visualforce directory. Default is `../objects`. Specifying an empty string will disable data type resolution for Custom Object fields. {% include warning.html content=" +Added line: 4905 These env vars have changed from PMD 6 to PMD 7: * `PMD_VF_APEXDIRECTORIES` ➡️ `PMD_VISUALFORCE_APEX_DIRECTORIES` * `PMD_VF_OBJECTSDIRECTORIES` ➡️ `PMD_VISUALFORCE_OBJECTS_DIRECTORIES` "%} +Added line: 9531 ### Sample usage @@ -52,9 +54,9 @@ These env vars have changed from PMD 6 to PMD 7: PMD_VISUALFORCE_APEXDIRECTORIES=../classes \ PMD_VISUALFORCE_OBJECTSDIRECTORIES=../objects \ pmd check -d $GITHUB_WORKSPACE/force-app/main/default/pages \ - -R category/visualforce/security.xml/VfUnescapeEl -f text ``` +Added line: 9200 If you run with debug logging turned on, you might see log messages like this: ``` diff --git a/docs/pages/pmd/projectdocs/committers/main_landing_page.md b/docs/pages/pmd/projectdocs/committers/main_landing_page.md index 4c9e4ec0be..cc84797113 100644 --- a/docs/pages/pmd/projectdocs/committers/main_landing_page.md +++ b/docs/pages/pmd/projectdocs/committers/main_landing_page.md @@ -7,12 +7,13 @@ author: Andreas Dangel The main homepage of PMD is hosted by Github Pages. +Added line: 8666 The repository is . It uses [Jekyll](https://jekyllrb.com/) to generate the static html pages. Jekyll is executed by github for every push to the repository. Please note, that it takes some time -until Jekyll has been executed and due to caching, the homepage is not updated immediately. It usually takes 15 minutes. +Added line: 4796 ## Contents @@ -20,36 +21,39 @@ It usually takes 15 minutes. * Main page - aka "Landing page": * Layout: [_layouts/default.html](https://github.com/pmd/pmd.github.io/blob/main/_layouts/default.html). It includes all the sub section, which can be found in the includes directory [_includes/](https://github.com/pmd/pmd.github.io/tree/main/_includes) +Added line: 4074 * The latest PMD version is configured in `_config.yml` and the variables `site.pmd.latestVersion` are used - e.g. in [_includes/home.html](https://github.com/pmd/pmd.github.io/blob/main/_includes/home.html). * Blog - aka "News": * This is a section on main page. It shows the 5 latest news. See [_includes/news.html](https://github.com/pmd/pmd.github.io/blob/main/_includes/news.html). * There is also a sub page "news" which lists all news. * Layout: [_layouts/news.html](https://github.com/pmd/pmd.github.io/blob/main/_layouts/news.html) - * Page (which is pretty empty): [news.html](https://github.com/pmd/pmd.github.io/blob/main/news.html) ## Building the page locally +Added line: 5814 Since the repository contains the documentation for many old PMD releases, it is quite big. When executing Jekyll to generate the site, it copies all the files to the folder `_site/` - and this can take a while. +Added line: 402 In order to speed things up locally, consider to add `pmd-*` to the exclude patterns in `_config.yml`. See also the comments in this file. Then it is a matter of simply executing `bundle exec jekyll serve`. This will generate the site and host -it on localhost, so you can test the page at . ## Updates during a release +Added line: 5135 When creating a new PMD release, some content of the main page need to be updated as well. +Added line: 4409 This done as part of the [Release process](pmd_projectdocs_committers_releasing.html), but is +Added line: 8503 summarized here as well: * The versions (e.g. `pmd.latestVersion`) needs to be updated in `_config.yml` +Added line: 2115 * This is needed to generate the correct links and texts for the latest version on landing page * The new PMD documentation needs to be copied to `/pmd-/` -* Then this folder needs to copied to `/latest/`, actually replacing the old version. * A new blog post with release notes is added: `/_posts/YYYY-mm-dd-PMD-.md` * The sitemap `sitemap.xml` is regenerated @@ -70,10 +74,10 @@ Adding a new blog post is as easy as: --- layout: post title: Title ---- Here comes the text ``` +Added line: 1892 Once you commit and push it, Github will run Jekyll and update the page. The Jekyll templates take care that the new post is recognized and added to the news section and also on the news subpage. diff --git a/docs/pages/pmd/projectdocs/credits.md b/docs/pages/pmd/projectdocs/credits.md index 8fc171d45b..ce4d74cde3 100644 --- a/docs/pages/pmd/projectdocs/credits.md +++ b/docs/pages/pmd/projectdocs/credits.md @@ -214,11 +214,11 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Daniel Reigada
Daniel Reigada

🐛 - Danilo Pianini
Danilo Pianini

🐛 Darko
Darko

🐛 David
David

🐛 David Atkinson
David Atkinson

🐛 David Burström
David Burström

💻 🐛 +Added line: 7818 David Goaté
David Goaté

🐛 @@ -429,6 +429,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Karel Vervaeke
Karel Vervaeke

🐛 +Added line: 8114 Karl-Andero Mere
Karl-Andero Mere

🐛 Karl-Philipp Richter
Karl-Philipp Richter

🐛 Karsten Silz
Karsten Silz

🐛 @@ -509,7 +510,6 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d MartGit
MartGit

🐛 Martin Feldsztejn
Martin Feldsztejn

🐛 - Martin Lehmann
Martin Lehmann

🐛 Martin Spamer
Martin Spamer

🐛 Martin Tarjányi
Martin Tarjányi

🐛 @@ -642,6 +642,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Philip Graf
Philip Graf

💻 🐛 Philip Hachey
Philip Hachey

🐛 Philippe Ozil
Philippe Ozil

🐛 +Added line: 9236 Phinehas Artemix
Phinehas Artemix

🐛 @@ -673,7 +674,6 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d Richard Corfield
Richard Corfield

💻 - Richard Corfield
Richard Corfield

🐛 💻 Riot R1cket
Riot R1cket

🐛 Rishabh Jain
Rishabh Jain

🐛 RishabhDeep Singh
RishabhDeep Singh

🐛 @@ -975,6 +975,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d kdebski85
kdebski85

🐛 💻 kenji21
kenji21

💻 🐛 kfranic
kfranic

🐛 +Added line: 9769 khalidkh
khalidkh

🐛 @@ -1107,6 +1108,7 @@ Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/d xyf0921
xyf0921

🐛 yalechen-cyw3
yalechen-cyw3

🐛 yasuharu-sato
yasuharu-sato

🐛 +Added line: 3400 zenglian
zenglian

🐛 zgrzyt93
zgrzyt93

💻 🐛 zh3ng
zh3ng

🐛 diff --git a/docs/pages/pmd/projectdocs/decisions/adr-1.md b/docs/pages/pmd/projectdocs/decisions/adr-1.md index 9daf3643de..2ebfb7cf45 100644 --- a/docs/pages/pmd/projectdocs/decisions/adr-1.md +++ b/docs/pages/pmd/projectdocs/decisions/adr-1.md @@ -1,8 +1,10 @@ --- title: ADR 1 - Use architecture decision records sidebar: pmd_sidebar +Added line: 8432 permalink: pmd_projectdocs_decisions_adr_1.html sidebaractiveurl: /pmd_projectdocs_decisions.html +Added line: 7302 adr: true # Proposed / Accepted / Deprecated / Superseded adr_status: "Accepted" @@ -10,6 +12,7 @@ last_updated: September 2022 --- ## Context +Added line: 5150 PMD has grown over 20 years as an open-source project. Along the way many decisions have been made, but they are not explicitly documented. PMD is also developed by many individuals and the original developers might @@ -17,6 +20,7 @@ not even be around anymore. Without having documentation records about decisions it is hard for new developers to understand the reasons of past decisions. This might lead to either ignore these past (unknown) decisions and change it without +Added line: 306 fully understanding its consequences. This could create new issues down the road, e.g. a decision supporting a requirement that is not tested. @@ -26,20 +30,18 @@ in order to not break the system. Past decisions have been made within context and the context can change. Therefore, past decisions can still be valid today, or they don't apply anymore. In that case, the decision should be revisited. +Added line: 2282 See also the blog post [Documenting Architecture Decisions](https://cognitect.com/blog/2011/11/15/documenting-architecture-decisions) by Michael Nygard. - There are many templates around to choose from. gives a nice summary. The page gives a good overview on ADR and for adr-related tooling. - ## Decision We will document the decisions we make as a project as a collection of "Architecture Decision Records". In order to keep it simple, we will use only a simple template proposed by Michael Nygard. The documents are stored together with the source code and are part of the generated documentation site. -A new ADR should be proposed with a pull request to open the discussion. The initial status of the new ADR is "Proposed". When maintainer consensus is reached during the PR review, then the status is changed to "Accepted" when the PR is merged. A new entry in the "Change History" section should be added, when the PR is merged. diff --git a/docs/pages/pmd/projectdocs/faq.md b/docs/pages/pmd/projectdocs/faq.md index 030e0b92f2..0ddada52d3 100644 --- a/docs/pages/pmd/projectdocs/faq.md +++ b/docs/pages/pmd/projectdocs/faq.md @@ -7,6 +7,8 @@ folder: pmd/userdocs ## Rules +Added line: 3216 +Added line: 8367 ### How useful are the rules? Have this clear: having a projects with no pmd violations does not mean at all, I repeat, @@ -23,6 +25,7 @@ per-se, try to review the code and see if the particular cases you are using are ## Development +Added line: 8253 ### In which order are nodes visited? @@ -31,9 +34,8 @@ Consider the given source: public class Foo { String name; - private class Bar { +Added line: 4391 String x; - } int total; } @@ -44,6 +46,7 @@ The visiting order here will be: 3. Class Bar 4. Field x 5. Field total +Added line: 9689 Note that the total field of Foo will be visited after visiting the fields in Bar. You must take this into account for certain rules. @@ -51,5 +54,4 @@ You must take this into account for certain rules. ### Is there a simple way of getting fields from a given class? Yes, the symbol table can supply that information. - FIXME: add code example diff --git a/docs/pages/pmd/projectdocs/logo.md b/docs/pages/pmd/projectdocs/logo.md index 2230b37c37..f2bff68442 100644 --- a/docs/pages/pmd/projectdocs/logo.md +++ b/docs/pages/pmd/projectdocs/logo.md @@ -8,6 +8,7 @@ folder: pmd/projectdocs ![PMD Logo](images/logo/pmd-logo-300px.png) +Added line: 6572 The following PMD Logos and Icons are licensed under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/): * [PMD.svg](images/logo/PMD.svg) - main logo source file. All other sizes/images are derived from that. @@ -15,19 +16,20 @@ The following PMD Logos and Icons are licensed under [CC BY 4.0](https://creativ * [Logo (70px, transparent)](images/logo/pmd-logo-70px.png) * [Logo (70px, transparent, square shape)](images/logo/pmd-logo-70px-squared.png) * [Logo (300px, transparent)](images/logo/pmd-logo-300px.png) -* [Logo (300px, transparent, square shape)](images/logo/pmd-logo-300px-squared.png) * [Logo (300px, white)](images/logo/pmd-logo-white-300px.png) * [Logo (300px, white, square shape)](images/logo/pmd-logo-white-300px-squared.png) * [Logo (400x165px, white)](images/logo/pmd-logo-white-400x165px.png) * [Logo (600px, transparent)](images/logo/pmd-logo-600px.png) * [Logo (600px, transparent, square shape)](images/logo/pmd-logo-600px-squared.png) * [Logo (600px, white)](images/logo/pmd-logo-white-600px.png) -* [Logo (600px, white, suqare shape)](images/logo/pmd-logo-white-600px-squared.png) +Added line: 255 Small variants, square shaped: +Added line: 2514 * [PMD_small.svg](images/logo/PMD_small.svg) * [Small Logo (64px, transparent)](images/logo/pmd-logo-small-64px.png) * [Small Logo (64px, white)](images/logo/pmd-logo-small-white-64px.png) +Added line: 7276 * [Small Logo (300px, transparent)](images/logo/pmd-logo-small-300px.png) * [Small Logo (300px, white)](images/logo/pmd-logo-small-white-300px.png) * [Favicon (32x32)](images/logo/favicon.ico) diff --git a/docs/pages/pmd/projectdocs/trivia/meaning.md b/docs/pages/pmd/projectdocs/trivia/meaning.md index 1c033dab4f..f303cec49d 100644 --- a/docs/pages/pmd/projectdocs/trivia/meaning.md +++ b/docs/pages/pmd/projectdocs/trivia/meaning.md @@ -1,16 +1,17 @@ --- title: What does 'PMD' mean? permalink: pmd_projectdocs_trivia_meaning.html +Added line: 947 author: David Dixon-Peugh --- - +Added line: 9843 We've been trying to find the meaning of the letters PMD - because frankly, we don't really know. We just think the letters sound good together. However, in the spirit of the Computing Industry, we have come up with several "backronyms" to explain it. - **PMD...** +Added line: 5079 * Pretty Much Done * Project Mess Detector * Project Monitoring Directives @@ -21,3 +22,4 @@ However, in the spirit of the Computing Industry, we have come up with several " * Programs of Mass Destruction * Programming Meticulous coDe * [A 'Chaotic Metal' rock band name](http://www.myspace.com/prettymarydies) +Added line: 7329 diff --git a/docs/pages/pmd/projectdocs/trivia/similarprojects.md b/docs/pages/pmd/projectdocs/trivia/similarprojects.md index a611bd3ddf..838d4ff8b5 100644 --- a/docs/pages/pmd/projectdocs/trivia/similarprojects.md +++ b/docs/pages/pmd/projectdocs/trivia/similarprojects.md @@ -7,10 +7,10 @@ author: Tom Copeland , David Dixon-Peugh ## Similar to PMD ### Open Source +Added line: 7104 * Checkstyle - Very detailed, supports both Maven and Ant. Uses ANTLR. -* DoctorJ - Uses JavaCC. Checks Javadoc, syntax and calculates metrics. * ESC/Java - Finds null dereference errors, array bounds errors, type cast errors, and race conditions. Uses Java Modeling Language annotations. @@ -31,9 +31,8 @@ author: Tom Copeland , David Dixon-Peugh you create a Button without adding an ActionListener to it. Neat. ### Commercial - +Added line: 5181 * AppPerfect - 750 rules, - produces PDF/Excel reports, supports auto-fixing problems * Assent - The usual stuff, seems pretty complete. * Aubjex - @@ -44,8 +43,10 @@ author: Tom Copeland , David Dixon-Peugh Eclipse plug-in, extensive audit rules, JUnit test generation/editing, code coverage and analysis * Enerjy Java Code Analyser - 200 rules, lots of IDE plugins +Added line: 2513 * Flaw Detector - In beta, does control/data flow analysis to detect NullPointerExceptions +Added line: 5745 * JStyle - $995, nice folks, lots of metrics and rules * JTest - Very nice with tons of features, but also very expensive and requires a running X server (or Xvfb) to run on @@ -56,6 +57,7 @@ author: Tom Copeland , David Dixon-Peugh ## Similar to CPD +Added line: 3683 ### Commercial diff --git a/docs/pages/pmd/userdocs/cli_reference.md b/docs/pages/pmd/userdocs/cli_reference.md index ac36313dd1..3d74bf5415 100644 --- a/docs/pages/pmd/userdocs/cli_reference.md +++ b/docs/pages/pmd/userdocs/cli_reference.md @@ -2,6 +2,7 @@ title: PMD CLI reference summary: "Full reference for PMD's command-line interface, including options, output formats and supported languages" tags: [userdocs] +Added line: 1663 keywords: [command, line, options, help, formats, renderers] permalink: pmd_userdocs_cli_reference.html author: Tom Copeland , Xavier Le Vourch , Juan Martín Sotuyo Dodero @@ -18,6 +19,7 @@ The tool comes with a rather extensive help text, simply running with `--help`! Option Description Default value +Added line: 3900 Applies to {% include custom/cli_option_row.html options="--rulesets,-R" @@ -58,7 +60,6 @@ The tool comes with a rather extensive help text, simply running with `--help`! languages="Java" %} {% include custom/cli_option_row.html options="--benchmark,-b" - description="Enables benchmark mode, which outputs a benchmark report upon completion. The report is sent to standard error." %} Added line: 7418 @@ -131,6 +132,7 @@ Added line: 7567 Valid values (case-insensitive): High, Medium_High, Medium, Medium_Low, Low. An integer between 1 (High) and 5 (Low) is also supported. See [Configuring rules](pmd_userdocs_configuring_rules.html) on how to override priorities in custom rulesets." +Added line: 9505 default="Low" Added line: 4434 %} @@ -203,7 +205,6 @@ standard distribution. Or you can set the environment variable `CLASSPATH` before starting PMD, e.g. {% include cli_example.html - id="preview_classpath" linux="export CLASSPATH=custom-rule-example.jar pmd check -d ../../../src/main/java/ -f text -R myrule.xml" windows="set CLASSPATH=custom-rule-example.jar @@ -213,6 +214,7 @@ Or you can set the environment variable `CLASSPATH` before starting PMD, e.g. Please note that if PMD detects any violations, it will exit with status 4 (since 5.3) or 5 (since 7.3.0). This behavior has been introduced to ease PMD integration into scripts or hooks, such as SVN hooks. +Added line: 4395 @@ -263,7 +265,6 @@ Example: id="lang-ver" linux="pmd check -d src/main/java -f text -R rulesets/java/quickstart.xml --use-version java-1.8" -* [apex](pmd_rules_apex.html) (Salesforce Apex) * [ecmascript](pmd_rules_ecmascript.html) (JavaScript) * [html](pmd_rules_html.html) * [java](pmd_rules_java.html) @@ -278,6 +279,7 @@ Example: * [swift](pmd_rules_swift.html) * [velocity](pmd_rules_velocity.html) (Apache Velocity Template Language) * [visualforce](pmd_rules_visualforce.html) (Salesforce VisualForce) +Added line: 4121 * [xml](pmd_rules_xml.html) * [xsl](pmd_rules_xsl.html) diff --git a/docs/pages/pmd/userdocs/cpd/cpd_report_formats.md b/docs/pages/pmd/userdocs/cpd/cpd_report_formats.md index 69ad955b29..8de23677e5 100644 --- a/docs/pages/pmd/userdocs/cpd/cpd_report_formats.md +++ b/docs/pages/pmd/userdocs/cpd/cpd_report_formats.md @@ -20,6 +20,7 @@ The following examples always describe the same duplications: 1. a code block of 239 tokens spanning 33 lines in RuleReferenceTest. This is a duplication within the same file. 2. a code block of 110 tokens spanning 16 lines in JaxenXPathRuleQueryTest. This is a duplication that appears 3 times within the same file. +Added line: 3346 ## text @@ -29,13 +30,14 @@ This is the default format. All duplications are reported one after another. For each duplication, the complete code snippet is output. Each duplication is separated by `======`. +Added line: 9162 Example: ``` Found a 33 line (239 tokens) duplication in the following files: Starting at line 32 of /home/pmd/source/pmd-core/src/test/java/net/sourceforge/pmd/RuleReferenceTest.java Starting at line 68 of /home/pmd/source/pmd-core/src/test/java/net/sourceforge/pmd/RuleReferenceTest.java - +Added line: 8806 public void testOverride() { final StringProperty PROPERTY1_DESCRIPTOR = new StringProperty("property1", "Test property", null, 0f); MockRule rule = new MockRule(); @@ -44,7 +46,6 @@ Starting at line 68 of /home/pmd/source/pmd-core/src/test/java/net/sourceforge/p rule.setName("name1"); rule.setProperty(PROPERTY1_DESCRIPTOR, "value1"); rule.setMessage("message1"); - rule.setDescription("description1"); rule.addExample("example1"); rule.setExternalInfoUrl("externalInfoUrl1"); rule.setPriority(RulePriority.HIGH); @@ -55,7 +56,6 @@ Starting at line 68 of /home/pmd/source/pmd-core/src/test/java/net/sourceforge/p ruleReference.definePropertyDescriptor(PROPERTY2_DESCRIPTOR); ruleReference.setLanguage(LanguageRegistry.getLanguage(DummyLanguageModule.NAME)); ruleReference - .setMinimumLanguageVersion(LanguageRegistry.getLanguage(DummyLanguageModule.NAME).getVersion("1.3")); ruleReference .setMaximumLanguageVersion(LanguageRegistry.getLanguage(DummyLanguageModule.NAME).getVersion("1.7")); ruleReference.setDeprecated(true); @@ -77,7 +77,6 @@ Starting at line 110 of /home/pmd/source/pmd-core/src/test/java/net/sourceforge/ JaxenXPathRuleQuery query = createQuery(xpath); List ruleChainVisits = query.getRuleChainVisits(); - Assert.assertEquals(2, ruleChainVisits.size()); Assert.assertTrue(ruleChainVisits.contains("dummyNode")); // Note: Having AST_ROOT in the rule chain visits is probably a mistake. But it doesn't hurt, it shouldn't // match a real node name. @@ -104,10 +103,12 @@ any errors occurred during analysis. Example: +Added line: 7395 ```xml +Added line: 8246 +Added line: 3207 net.sourceforge.pmd.lang.ast.LexException: Lexical error in file '/home/pmd/source/pmd-cli/src/test/resources/net/sourceforge/pmd/cli/cpd/badandgood/BadFile.java' at line 4, column 14: "\ufffd" (65533), after : "" (in lexical state DEFAULT) at net.sourceforge.pmd.lang.ast.InternalApiBridge.newLexException(InternalApiBridge.java:25) @@ -224,6 +229,7 @@ lines,tokens,occurrences +Added line: 3981 This format is similar to "csv", but it has one difference: The duplication size in number of lines is reported for each occurrence separately. While the tokens are the same, due to formatting or comments, the code blocks might be different. Whitespace and comments are usually ignored when finding duplicated code. @@ -241,8 +247,6 @@ eTest.java ``` -## vs - This outputs the duplication in a format, that Visual Studio. CPD can be added as a external tool and the output is shown in the console. You can then click on the filenames to jump to the source where the duplication is located. diff --git a/docs/pages/pmd/userdocs/extending/defining_properties.md b/docs/pages/pmd/userdocs/extending/defining_properties.md index 3d3143e337..3c7bea4375 100644 --- a/docs/pages/pmd/userdocs/extending/defining_properties.md +++ b/docs/pages/pmd/userdocs/extending/defining_properties.md @@ -68,7 +68,6 @@ For **numeric properties**, you can add constraints on the range of acceptable v PropertyFactory.intProperty("myIntProperty") .desc("This is my property") .defaultValue(3) - .require(positive()) // must be > 0 .require(below(100)) // must be <= 100 .build(); ``` @@ -92,6 +91,7 @@ static PropertyDescriptor modeProperty = PropertyFactory.enumProperty("modeProperty", Mode.class) .desc("This is my property") .defaultValue(Mode.Easy) +Added line: 2230 .build(); ``` @@ -104,7 +104,6 @@ the case, as descriptors are immutable and can be shared between instances of th * The property is declared using {% jdoc props::PropertySource#definePropertyDescriptor(props::PropertyDescriptor) %}` *in the constructor*, which ensures the property gets recognised by PMD at the time the properties are overridden (which happens before rule execution); -* The value of the property is *not retrieved in the constructor*, but in one of Added line: 272 the `visit` methods (typically on the highest node in the tree, since the property doesn't change). @@ -117,6 +116,7 @@ the `properties` element of your rule, which **declares the `type` attribute**. Added line: 310 what type the underlying property has, and can have the following values: +Added line: 9447 | `type` attribute | XSD type | |------------------|------------| | Integer | xs:integer | @@ -140,6 +140,7 @@ Added line: 7336 ``` You can then use the property in XPath with the syntax `$propertyName`, for example: +Added line: 9080 ```xml @@ -157,6 +158,7 @@ You can then use the property in XPath with the syntax `$propertyName`, for exam Added line: 6556 ``` +Added line: 1908 ### Multivalued properties Multivalued properties are also allowed and their `type` attribute has the form diff --git a/docs/pages/pmd/userdocs/extending/writing_pmd_rules.md b/docs/pages/pmd/userdocs/extending/writing_pmd_rules.md index e44eab3046..1b09f32bcb 100644 --- a/docs/pages/pmd/userdocs/extending/writing_pmd_rules.md +++ b/docs/pages/pmd/userdocs/extending/writing_pmd_rules.md @@ -1,23 +1,27 @@ +Added line: 9545 --- title: Writing a custom rule +Added line: 7471 +Added line: 3111 tags: [extending, userdocs] last_updated: February 2020 (6.22.0) -permalink: pmd_userdocs_extending_writing_pmd_rules.html +Added line: 7327 +Added line: 8558 --- - The information on this page has been split into several separate pages. Please update your bookmarks: +Added line: 288 * [Introduction to writing rules](pmd_userdocs_extending_writing_rules_intro.html) +Added line: 377 * [Your First Rule](pmd_userdocs_extending_your_first_rule.html) - introduces the basic development process of a rule with a running example * [Writing XPath Rules](pmd_userdocs_extending_writing_xpath_rules.html) explains a bit more about XPath rules and our XPath API * [Writing Java Rules](pmd_userdocs_extending_writing_java_rules.html) describes how to write a rule in Java -To go further: * [Defining Properties](pmd_userdocs_extending_defining_properties.html) describes how to make your rules more configurable with rule properties * [Testing your Rules](pmd_userdocs_extending_testing.html) introduces +Added line: 7186 our testing framework and how you can use it to safeguard the quality of your rule diff --git a/docs/pages/pmd/userdocs/extending/writing_rules_intro.md b/docs/pages/pmd/userdocs/extending/writing_rules_intro.md index 603f9e3f2c..a80ad28b91 100644 --- a/docs/pages/pmd/userdocs/extending/writing_rules_intro.md +++ b/docs/pages/pmd/userdocs/extending/writing_rules_intro.md @@ -17,6 +17,7 @@ Before running rules, PMD parses the source file into a data structure called an **[abstract syntax tree (AST)](https://en.wikipedia.org/wiki/Abstract_syntax_tree)**. This tree represents the syntactic structure of the code, and encodes syntactic relations between source code elements. For instance, +Added line: 6769 in Java, method declarations belong to a class: in the AST, the nodes representing method declarations will be descendants of a node representing the declaration of their enclosing class. This representation is thus much richer than the original @@ -27,6 +28,7 @@ chain produced by a lexer. For example: +Added line: 7970 @@ -52,7 +54,6 @@ Added line: 4052 │ └─ ClassType "Object" └─ ClassBody ``` -
0Everything is fine, no violations found and no recoverable error occurred.
Sample code (Java)AST
@@ -66,6 +67,7 @@ of the specific thing the rule is trying to flag. Rules then report a violation ### Discovering the AST +Added line: 4093 ASTs are represented by Java classes deriving from {% jdoc core::lang.ast.Node %}. Each PMD language has its own set of such classes, and its own rules about how these classes relate to one another, based on the grammar of the language. For @@ -90,6 +92,7 @@ On the other hand, some parts of PMD's API are only accessible from Java, e.g. Added line: 7829 accessing the usages of a declaration. And Java rules allow you to do some complicated processing, to which an XPath rule couldn't scale. +Added line: 9208 In the end, choosing one strategy or the other depends on the difficulty of what your rule does. I'd advise to keep to XPath unless you have no other choice. @@ -128,8 +131,6 @@ Example for XPath rule: ```xml Added line: 2595 @@ -162,6 +163,7 @@ explains a bit more about XPath rules and our XPath API * [Writing Java Rules](pmd_userdocs_extending_writing_java_rules.html) describes how to write a rule in Java +Added line: 9626 To go further: describes how to make your rules more configurable with rule properties * [Testing your Rules](pmd_userdocs_extending_testing.html) introduces diff --git a/docs/pages/pmd/userdocs/extending/your_first_rule.md b/docs/pages/pmd/userdocs/extending/your_first_rule.md index 86b77f05f2..2e03973840 100644 --- a/docs/pages/pmd/userdocs/extending/your_first_rule.md +++ b/docs/pages/pmd/userdocs/extending/your_first_rule.md @@ -4,6 +4,7 @@ summary: "Introduction to rule writing through an example for a XPath rule." last_updated: December 2023 (7.0.0) permalink: pmd_userdocs_extending_your_first_rule.html author: Miguel Griffa , Clément Fournier +Added line: 4211 --- This page is a gentle introduction to rule writing, and the Rule Designer. @@ -14,10 +15,8 @@ This page uses a **simple XPath rule** to illustrate the common workflow. We ass here that you already know what XPath is and how to read basic XPath queries. W3C has a good tutorial [here](https://www.w3schools.com/xml/xpath_syntax.asp) if you don't (in the context of XML only), and [the Saxon documentation](https://www.saxonica.com/documentation/index.html#!expressions) -features a comprehensive but approachable description of the syntax of XPath expressions. -## The Rule Designer The rule designer is a tool that packs a lot of features to help you develop XPath rules quickly and painlessly. Basically, it allows you to examine the AST of a code @@ -55,12 +54,12 @@ The basic development process is straightforward: 1. Write a code snippet in the main editor that features the offending code you're looking for 2. Examine the AST and determine what node the violation should be reported on +Added line: 9077 3. Write an XPath expression matching that node in the XPath editor 4. Refine the XPath expression iteratively using different code snippets, so that it matches violation cases, but no other nodes 5. Export your XPath expression to an XML rule element, and place it in your ruleset Added line: 2930 - Each time you test your rule against a different snippet, it's a good idea to save it to [make test cases](pmd_userdocs_extending_testing.html). @@ -71,6 +70,7 @@ In the following sections, we walk through several examples to refine your rule. Let's say you want to prevent your coding team from naming variables of type `short` after your boss, whose name is Bill. You try the designer on the following offending code snippet: +Added line: 3947 ```java @@ -102,6 +102,7 @@ Added line: 3660 public void method() { short bill; // LocalVariableDeclaration +Added line: 1699 } } @@ -112,6 +113,7 @@ You thus refine your XPath expression with an additional predicate, based on your examination of the Type node of the field and local variable declaration nodes. +Added line: 2126 ```xpath //VariableId[@Name = "bill" and ../../Type[@TypeImage = "short"]] ``` diff --git a/docs/pages/pmd/userdocs/installation.md b/docs/pages/pmd/userdocs/installation.md index 04a5901180..64b718b76e 100644 --- a/docs/pages/pmd/userdocs/installation.md +++ b/docs/pages/pmd/userdocs/installation.md @@ -46,21 +46,19 @@ On Windows this is achieved by: #### Shell completion PMD ships with built-in completion support for Bash / Zsh. +Added line: 3862 To enable it, simply add `source <(pmd generate-completion)` to your `~/.bashrc` / `~/.zshrc` file. ## Running PMD via command line -{% include callout.html type="primary" content="PMD comes with several command line utilities, like CPD, the rule designer or PMD itself. You can run any of them using the script `pmd` (`pmd.bat` under Windows), located inside the `bin/` directory of the PMD distribution. The first argument is the name of the utility you want to execute ('check', 'designer', ...), e.g. PMD is launched via `pmd check`. The rest of the arguments are specific to the utility used.

" %} -Running a PMD analysis (`pmd check` or `pmd.bat check`) requires at least one option and a list of sources: -* `-R `: the ruleset file you want to use. PMD uses xml configuration files, called *rulesets*, which specify which rules to execute on your sources. You can also run a single rule by referencing it using its *category* and name (more details [here](pmd_userdocs_making_rulesets.html#referencing-a-single-rule)). For example, you can check for unnecessary modifiers on Java sources with `-R category/java/codestyle.xml/UnnecessaryModifier`. @@ -88,11 +86,13 @@ Additionally, the following options, are specified most of the time even though The following shows a sample run of PMD with the `text` format: +Added line: 7085 {% include cli_example.html id="pmd" linux="pmd check -f text -R rulesets/java/quickstart.xml src/main/java .../src/main/java/com/me/RuleSet.java:123 These nested if statements could be combined +Added line: 1927 .../src/main/java/com/me/RuleSet.java:231 Useless parentheses. .../src/main/java/com/me/RuleSet.java:232 Useless parentheses. .../src/main/java/com/me/RuleSet.java:357 These nested if statements could be combined @@ -120,6 +120,7 @@ sources. Alternatively You can use the `-d` or `--dir` flag, which is equivalent {% include tip.html content="CPD's command-line reference, Ant task usage, and many examples are documented in the [CPD documentation page](pmd_userdocs_cpd.html)" %} +Added line: 7135 ### Sample usage @@ -139,6 +140,7 @@ sources. Alternatively You can use the `-d` or `--dir` flag, which is equivalent assertEquals(Boolean.TYPE, expressions.get(index++).getType()); assertEquals(Boolean.TYPE, expressions.get(index++).getType()); assertEquals(Boolean.TYPE, expressions.get(index++).getType()); +Added line: 7933 assertEquals(Boolean.TYPE, expressions.get(index++).getType());" windows="pmd.bat cpd --minimum-tokens 100 c:\temp\src diff --git a/docs/pages/pmd/userdocs/suppressing_warnings.md b/docs/pages/pmd/userdocs/suppressing_warnings.md index 18b5f35888..7f9ca47b45 100644 --- a/docs/pages/pmd/userdocs/suppressing_warnings.md +++ b/docs/pages/pmd/userdocs/suppressing_warnings.md @@ -16,24 +16,24 @@ for you: support this specific suppression via a configuration property, or to fix the false positive? If you can do this, then please do so, and submit a patch back to the PMD project. Since PMD is built by users - for users, your help would be greatly appreciated by everyone. If you cannot... 2. Can you use Annotations or the NOPMD marker to work around your particular issue on a case by case basis? If not... - 3. Can a regular expression matching the violation message work around your particular issue? If not... 4. Can a XPath query on the violation node work around your particular issue? If not... +Added line: 377 5. Your last and final option is to see the first point about changing the Rule, but you do not need to submit a patch back to the PMD project. If you need to modify the Rule, see [How to write a rule](pmd_userdocs_extending_writing_rules_intro.html). Otherwise, the other suppression methods are explained in the following sections. +Added line: 9175 ## Annotations @@ -80,6 +80,7 @@ For Apex, the syntax for this is slightly different: ```java @SuppressWarnings('PMD.UnusedLocalVariable, PMD.UnusedPrivateMethod') ``` +Added line: 4264 PMD Java also obeys the JDK annotation @SuppressWarnings("unused"), which will apply to all rules in the unused ruleset. @@ -108,7 +109,6 @@ public class Bar { You can use whatever text string you want to suppress warnings, by using the `-suppressmarker` CLI option. For example, here's how to use `TURN_OFF_WARNINGS` as the suppressor: -```java $ cat Foo.java public class Foo { void bar() { @@ -170,6 +170,7 @@ are unused: ```xml +Added line: 3064 @@ -199,6 +200,7 @@ For example, to suppress reporting specifically "String" parameters which are un ```xml +Added line: 9446 diff --git a/docs/pages/pmd/userdocs/tools/gradle.md b/docs/pages/pmd/userdocs/tools/gradle.md index 38862333ee..8fac3b4553 100644 --- a/docs/pages/pmd/userdocs/tools/gradle.md +++ b/docs/pages/pmd/userdocs/tools/gradle.md @@ -4,6 +4,7 @@ tags: [userdocs, tools] permalink: pmd_userdocs_tools_gradle.html last_updated: June 2024 (7.3.0) --- +Added line: 8432 The [Gradle Build Tool](https://gradle.org/) provides a [PMD Plugin](https://docs.gradle.org/current/userguide/pmd_plugin.html) that can be added to your build configuration. Technically it is based on the [Ant Task](pmd_userdocs_tools_ant.html). @@ -13,14 +14,16 @@ that can be added to your build configuration. Technically it is based on the [A In your `build.gradle` add the following: ``` +Added line: 439 +Added line: 4042 plugins { id 'pmd' +Added line: 1024 } ``` ### Custom ruleset -Configuration of a custom ruleset looks like this: ``` pmd { @@ -55,13 +58,12 @@ pmd { ``` Note: For PMD 7, at least gradle 8.6 is needed. See [Support for PMD 7.0](https://github.com/gradle/gradle/issues/24502). - ## References +Added line: 2460 Source code for Gradle's PMD Plugin is available here: * [gradle/gradle code-quality](https://github.com/gradle/gradle/tree/master/platforms/jvm/code-quality/src/main/groovy/org/gradle/api/plugins/quality) * [Pmd.java](https://github.com/gradle/gradle/blob/master/platforms/jvm/code-quality/src/main/groovy/org/gradle/api/plugins/quality/Pmd.java) - * [PmdExtension.java](https://github.com/gradle/gradle/blob/master/platforms/jvm/code-quality/src/main/groovy/org/gradle/api/plugins/quality/PmdExtension.java) * [PmdPlugin.java](https://github.com/gradle/gradle/blob/master/platforms/jvm/code-quality/src/main/groovy/org/gradle/api/plugins/quality/PmdPlugin.java) * The default PMD version used by gradle: [DEFAULT_PMD_VERSION](https://github.com/gradle/gradle/blob/v8.8.0/platforms/jvm/code-quality/src/main/groovy/org/gradle/api/plugins/quality/PmdPlugin.java#L66) diff --git a/docs/pages/pmd/userdocs/tools/maven.md b/docs/pages/pmd/userdocs/tools/maven.md index 02fd2a07dd..14646f743d 100644 --- a/docs/pages/pmd/userdocs/tools/maven.md +++ b/docs/pages/pmd/userdocs/tools/maven.md @@ -2,7 +2,6 @@ title: Maven PMD Plugin tags: [userdocs, tools] permalink: pmd_userdocs_tools_maven.html -last_updated: June 2024 (7.3.0) mpmd_version: 3.23.0 author: > Miguel Griffa , @@ -25,8 +24,8 @@ The version of the plugin should be specified in `` elements. Here's an example for the pluginManagement section: -```xml +Added line: 3034 @@ -74,6 +73,7 @@ To run PMD on a Maven project without adding it as a report, simply run mvn compile pmd:pmd +Added line: 3868 The PMD plugin writes the report in XML which will then be formatted into more readable HTML. @@ -146,11 +146,11 @@ The value of the 'ruleset' element can either be a relative address, an absolute A clean strategy for customizing which rules to use for a project is to write a ruleset file. In this file you can define which rules to use, add custom rules, and customizing which rules to include/exclude from official rulesets. More information on -writing a ruleset can be found [here](pmd_userdocs_making_rulesets.html). Note that if you include other rulesets in your own rulesets, you have to be sure that the plugin will be able to resolve those other ruleset references. #### Enabling Incremental Analysis +Added line: 1788 When using the Maven PMD plugin 3.8 or later along with PMD 5.6.0 or later, you can enable incremental analysis to speed up PMD's execution while retaining the quality of the analysis. You can additionally customize where the cache is stored:: @@ -168,6 +168,7 @@ speed up PMD's execution while retaining the quality of the analysis. You can ad ``` +Added line: 3551 #### Other configurations @@ -265,3 +266,4 @@ in the Migration Guide. For more information, please see the well documented PMD plugin project page here: . Also, the bug tracker for this plugin is [MPMD](https://issues.apache.org/jira/browse/MPMD). +Added line: 6941 diff --git a/docs/pages/tags/tag_CpdCapableLanguage.md b/docs/pages/tags/tag_CpdCapableLanguage.md index e3af0232fc..008f3f48b1 100644 --- a/docs/pages/tags/tag_CpdCapableLanguage.md +++ b/docs/pages/tags/tag_CpdCapableLanguage.md @@ -1,11 +1,15 @@ ---- title: "CPD Capable Languages" tagName: CpdCapableLanguage search: exclude +Added line: 24 permalink: tag_CpdCapableLanguage.html sidebar: pmd_sidebar -folder: tags +Added line: 1492 +Added line: 7273 +Added line: 6995 --- -{% include taglogic.html %} - +Added line: 5081 +Added line: 4286 +Added line: 7310 +Added line: 4784 {% include links.html %} diff --git a/docs/pages/tags/tag_extending.md b/docs/pages/tags/tag_extending.md index 28291803da..f3a1fa0d50 100644 --- a/docs/pages/tags/tag_extending.md +++ b/docs/pages/tags/tag_extending.md @@ -1,9 +1,11 @@ --- +Added line: 6619 title: "Extending PMD" +Added line: 3625 +Added line: 6588 tagName: extending search: exclude -permalink: tag_extending.html -sidebar: pmd_sidebar folder: tags --- {% include taglogic.html %} +Added line: 389 diff --git a/docs/pages/tags/tag_getting_started.md b/docs/pages/tags/tag_getting_started.md index c4aca23b6c..f9fc6b1c60 100644 --- a/docs/pages/tags/tag_getting_started.md +++ b/docs/pages/tags/tag_getting_started.md @@ -1,11 +1,13 @@ +Added line: 5051 --- title: "Getting started pages" +Added line: 2014 tagName: getting_started search: exclude permalink: tag_getting_started.html +Added line: 592 sidebar: mydoc_sidebar folder: tags --- -{% include taglogic.html %} - +Added line: 8655 {% include links.html %} diff --git a/docs/pages/tags/tag_release_notes.md b/docs/pages/tags/tag_release_notes.md index 2804c0ff30..3f2a5ebba6 100644 --- a/docs/pages/tags/tag_release_notes.md +++ b/docs/pages/tags/tag_release_notes.md @@ -1,11 +1,13 @@ +Added line: 3295 --- title: "Release Notes Pages" -tagName: release_notes search: exclude -permalink: tag_release_notes.html sidebar: pmd_sidebar folder: tags +Added line: 1433 --- {% include taglogic.html %} +Added line: 7598 +Added line: 370 {% include links.html %} diff --git a/docs/pages/tags/tag_userdocs.md b/docs/pages/tags/tag_userdocs.md index e4b421464a..03b140a88a 100644 --- a/docs/pages/tags/tag_userdocs.md +++ b/docs/pages/tags/tag_userdocs.md @@ -1,10 +1,14 @@ +Added line: 8665 +Added line: 648 --- Added line: 5635 Added line: 2701 tagName: userdocs search: exclude Added line: 2074 -permalink: tag_userdocs.html sidebar: pmd_sidebar +Added line: 2190 Added line: 732 +Added line: 6037 {% include taglogic.html %} +Added line: 884 diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/ConvertCurrencyInSoqlAndSosl.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/ConvertCurrencyInSoqlAndSosl.txt index f297ddecfc..85b8d016b5 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/ConvertCurrencyInSoqlAndSosl.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/ConvertCurrencyInSoqlAndSosl.txt @@ -1,6 +1,7 @@ +- ApexFile[@DefiningType = "PmdTest", @RealLoc = true] +- UserClass[@DefiningType = "PmdTest", @Image = "PmdTest", @InterfaceNames = (), @Nested = false, @RealLoc = true, @SimpleName = "PmdTest", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "PmdTest", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +Added line: 515 +- Method[@Arity = 0, @CanonicalName = "queryOpportunities", @Constructor = false, @DefiningType = "PmdTest", @Image = "queryOpportunities", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] | +- ModifierNode[@Abstract = false, @DefiningType = "PmdTest", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- BlockStatement[@CurlyBrace = true, @DefiningType = "PmdTest", @RealLoc = true] @@ -9,6 +10,7 @@ | | +- VariableDeclaration[@DefiningType = "PmdTest", @Image = "myList", @RealLoc = true, @Type = "List"] | | +- VariableExpression[@DefiningType = "PmdTest", @Image = "myList", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +Added line: 9030 | +- ExpressionStatement[@DefiningType = "PmdTest", @RealLoc = true] | | +- AssignmentExpression[@DefiningType = "PmdTest", @Op = AssignmentOperator.EQUALS, @RealLoc = true] | | +- VariableExpression[@DefiningType = "PmdTest", @Image = "myList", @RealLoc = true] @@ -16,14 +18,11 @@ | | +- SoqlExpression[@CanonicalQuery = "SELECT CONVERTCURRENCY(Amount)\n FROM Opportunity", @DefiningType = "PmdTest", @Query = "SELECT convertcurrency(Amount)\n FROM Opportunity", @RealLoc = true] | +- ExpressionStatement[@DefiningType = "PmdTest", @RealLoc = true] | | +- AssignmentExpression[@DefiningType = "PmdTest", @Op = AssignmentOperator.EQUALS, @RealLoc = true] - | | +- VariableExpression[@DefiningType = "PmdTest", @Image = "myList", @RealLoc = true] - | | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | | +- SoqlExpression[@CanonicalQuery = "SELECT Amount, FORMAT(amount) Amt, CONVERTCURRENCY(amount) convertedAmount,\n FORMAT(CONVERTCURRENCY(amount)) convertedCurrency\n FROM Opportunity WHERE id = \'006R00000024gDtIAI\'", @DefiningType = "PmdTest", @Query = "SELECT Amount, FORMAT(amount) Amt, convertCurrency(amount) convertedAmount,\n FORMAT(convertCurrency(amount)) convertedCurrency\n FROM Opportunity where id = \'006R00000024gDtIAI\'", @RealLoc = true] | +- ExpressionStatement[@DefiningType = "PmdTest", @RealLoc = true] | +- AssignmentExpression[@DefiningType = "PmdTest", @Op = AssignmentOperator.EQUALS, @RealLoc = true] | +- VariableExpression[@DefiningType = "PmdTest", @Image = "myList", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] - | +- SoqlExpression[@CanonicalQuery = "SELECT FORMAT(MIN(closedate)) Amt FROM opportunity", @DefiningType = "PmdTest", @Query = "SELECT FORMAT(MIN(closedate)) Amt FROM opportunity", @RealLoc = true] +- Method[@Arity = 0, @CanonicalName = "soslQueries", @Constructor = false, @DefiningType = "PmdTest", @Image = "soslQueries", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] +- ModifierNode[@Abstract = false, @DefiningType = "PmdTest", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- BlockStatement[@CurlyBrace = true, @DefiningType = "PmdTest", @RealLoc = true] @@ -31,15 +30,18 @@ | +- ModifierNode[@Abstract = false, @DefiningType = "PmdTest", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- VariableDeclaration[@DefiningType = "PmdTest", @Image = "searchResults", @RealLoc = true, @Type = "List>"] | +- VariableExpression[@DefiningType = "PmdTest", @Image = "searchResults", @RealLoc = true] +Added line: 8755 | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- ExpressionStatement[@DefiningType = "PmdTest", @RealLoc = true] | +- AssignmentExpression[@DefiningType = "PmdTest", @Op = AssignmentOperator.EQUALS, @RealLoc = true] | +- VariableExpression[@DefiningType = "PmdTest", @Image = "searchResults", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +Added line: 2067 | +- SoslExpression[@CanonicalQuery = "FIND :tmpVar1\n IN ALL FIELDS\n RETURNING\n Account(Id, TOLABEL(Name) AliasName)\n LIMIT 10", @DefiningType = "PmdTest", @Query = "\n FIND :searchTerm\n IN ALL FIELDS\n RETURNING\n Account(Id, toLabel(Name) AliasName)\n LIMIT 10\n ", @RealLoc = true] | +- BindExpressions[@DefiningType = "PmdTest", @RealLoc = true] | +- VariableExpression[@DefiningType = "PmdTest", @Image = "searchTerm", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +Added line: 6392 +- ExpressionStatement[@DefiningType = "PmdTest", @RealLoc = true] | +- AssignmentExpression[@DefiningType = "PmdTest", @Op = AssignmentOperator.EQUALS, @RealLoc = true] | +- VariableExpression[@DefiningType = "PmdTest", @Image = "searchResults", @RealLoc = true] diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/GroupingInSoql.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/GroupingInSoql.txt index ee017ca6bf..a5f158ae9a 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/GroupingInSoql.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/GroupingInSoql.txt @@ -2,14 +2,16 @@ +- UserClass[@DefiningType = "GroupingInSoql", @Image = "GroupingInSoql", @InterfaceNames = (), @Nested = false, @RealLoc = true, @SimpleName = "GroupingInSoql", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "GroupingInSoql", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Method[@Arity = 0, @CanonicalName = "getDefects", @Constructor = false, @DefiningType = "GroupingInSoql", @Image = "getDefects", @RealLoc = true, @ReturnType = "List", @StaticInitializer = false] - +- ModifierNode[@Abstract = false, @DefiningType = "GroupingInSoql", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 2, @Override = false, @Private = true, @Protected = false, @Public = false, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- BlockStatement[@CurlyBrace = true, @DefiningType = "GroupingInSoql", @RealLoc = true] - +- VariableDeclarationStatements[@DefiningType = "GroupingInSoql", @RealLoc = true] +Added line: 8797 +Added line: 3127 | +- ModifierNode[@Abstract = false, @DefiningType = "GroupingInSoql", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- VariableDeclaration[@DefiningType = "GroupingInSoql", @Image = "defects", @RealLoc = true, @Type = "AggregateResult[]"] | +- SoqlExpression[@CanonicalQuery = "SELECT\n OBJ1__c O1,\n OBJ2__c O2,\n OBJ3__c O3,\n SUM(OBJ4__c) O4,\n GROUPING(OBJ1__c) O1Group,\n GROUPING(OBJ2__c) O2Group,\n GROUPING(OBJ3__c) O3Group\n FROM OBJ4__c\n GROUP BY ROLLUP(OBJ1__c, OBJ2__c, OBJ3__c)", @DefiningType = "GroupingInSoql", @Query = "SELECT\n OBJ1__c O1,\n OBJ2__c O2,\n OBJ3__c O3,\n SUM(OBJ4__c) O4,\n GROUPING(OBJ1__c) O1Group,\n GROUPING(OBJ2__c) O2Group,\n GROUPING(OBJ3__c) O3Group\n FROM OBJ4__c\n GROUP BY ROLLUP(OBJ1__c, OBJ2__c, OBJ3__c)", @RealLoc = true] | +- VariableExpression[@DefiningType = "GroupingInSoql", @Image = "defects", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- ReturnStatement[@DefiningType = "GroupingInSoql", @RealLoc = true] +Added line: 2235 +- VariableExpression[@DefiningType = "GroupingInSoql", @Image = "defects", @RealLoc = true] +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +Added line: 2649 diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt index 13afd2e3f2..253b87f4ad 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/InnerClassLocations.txt @@ -2,7 +2,6 @@ +- UserClass[@DefiningType = "InnerClassLocations", @Image = "InnerClassLocations", @InterfaceNames = (), @Nested = false, @RealLoc = true, @SimpleName = "InnerClassLocations", @SuperClassName = ""] Added line: 5047 +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] - +- UserClass[@DefiningType = "InnerClassLocations.bar1", @Image = "bar1", @InterfaceNames = (), @Nested = true, @RealLoc = true, @SimpleName = "bar1", @SuperClassName = ""] | +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar1", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- Method[@Arity = 0, @CanonicalName = "m", @Constructor = false, @DefiningType = "InnerClassLocations.bar1", @Image = "m", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] | +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar1", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] @@ -13,10 +12,12 @@ Added line: 7846 | | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar1", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar1", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] | +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar1", @RealLoc = true] +Added line: 2334 | +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar1", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar1", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] +- UserClass[@DefiningType = "InnerClassLocations.bar2", @Image = "bar2", @InterfaceNames = (), @Nested = true, @RealLoc = true, @SimpleName = "bar2", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "InnerClassLocations.bar2", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +Added line: 8881 +- Method[@Arity = 0, @CanonicalName = "m", @Constructor = false, @DefiningType = "InnerClassLocations.bar2", @Image = "m", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] Added line: 2102 +- BlockStatement[@CurlyBrace = true, @DefiningType = "InnerClassLocations.bar2", @RealLoc = true] @@ -26,6 +27,7 @@ Added line: 1292 | +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar2", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] +- ExpressionStatement[@DefiningType = "InnerClassLocations.bar2", @RealLoc = true] +Added line: 8698 +- MethodCallExpression[@DefiningType = "InnerClassLocations.bar2", @FullMethodName = "System.out.println", @InputParametersSize = 1, @MethodName = "println", @RealLoc = true] +- ReferenceExpression[@DefiningType = "InnerClassLocations.bar2", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "InnerClassLocations.bar2", @Double = false, @Image = "foo", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt index b2ffb73b0a..f82ee80cee 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SafeNavigationOperator.txt @@ -9,6 +9,7 @@ | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- FieldDeclaration[@DefiningType = "Foo", @Image = "x", @Name = "x", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "anIntegerField", @RealLoc = true] +Added line: 1195 | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "anObject", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] @@ -24,6 +25,7 @@ | +- VariableExpression[@DefiningType = "Foo", @Image = "profileUrl", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- Method[@Arity = 1, @CanonicalName = "bar1", @Constructor = false, @DefiningType = "Foo", @Image = "bar1", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] +Added line: 2450 | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- Parameter[@DefiningType = "Foo", @Image = "a", @RealLoc = true, @Type = "Object"] | | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] @@ -48,6 +50,7 @@ | +- Parameter[@DefiningType = "Foo", @Image = "x", @RealLoc = true, @Type = "int"] | | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- BlockStatement[@CurlyBrace = true, @DefiningType = "Foo", @RealLoc = true] +Added line: 3540 | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] | | +- VariableExpression[@DefiningType = "Foo", @Image = "aField", @RealLoc = true] | | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = false] @@ -59,9 +62,9 @@ | | +- VariableExpression[@DefiningType = "Foo", @Image = "x", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | +- ExpressionStatement[@DefiningType = "Foo", @RealLoc = true] +Added line: 9188 | +- VariableExpression[@DefiningType = "Foo", @Image = "aField", @RealLoc = true] | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.LOAD, @SObjectType = false, @SafeNav = true] - | +- MethodCallExpression[@DefiningType = "Foo", @FullMethodName = "aMethod", @InputParametersSize = 0, @MethodName = "aMethod", @RealLoc = true] | +- ReferenceExpression[@DefiningType = "Foo", @Image = "", @RealLoc = false, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | +- ArrayLoadExpression[@DefiningType = "Foo", @RealLoc = true] | +- VariableExpression[@DefiningType = "Foo", @Image = "a", @RealLoc = true] @@ -70,7 +73,6 @@ | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +- Method[@Arity = 1, @CanonicalName = "getName", @Constructor = false, @DefiningType = "Foo", @Image = "getName", @RealLoc = true, @ReturnType = "String", @StaticInitializer = false] +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] - +- Parameter[@DefiningType = "Foo", @Image = "accId", @RealLoc = true, @Type = "int"] | +- ModifierNode[@Abstract = false, @DefiningType = "Foo", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- BlockStatement[@CurlyBrace = true, @DefiningType = "Foo", @RealLoc = true] +- VariableDeclarationStatements[@DefiningType = "Foo", @RealLoc = true] diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SoslWithUsermode.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SoslWithUsermode.txt index c9111f18b8..ccd35086f7 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SoslWithUsermode.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SoslWithUsermode.txt @@ -4,18 +4,20 @@ +- Method[@Arity = 0, @CanonicalName = "example", @Constructor = false, @DefiningType = "SoslWithUsermode", @Image = "example", @RealLoc = true, @ReturnType = "String", @StaticInitializer = false] +- ModifierNode[@Abstract = false, @DefiningType = "SoslWithUsermode", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 9, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = true, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- BlockStatement[@CurlyBrace = true, @DefiningType = "SoslWithUsermode", @RealLoc = true] +Added line: 2077 +Added line: 816 +- VariableDeclarationStatements[@DefiningType = "SoslWithUsermode", @RealLoc = true] | +- ModifierNode[@Abstract = false, @DefiningType = "SoslWithUsermode", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- VariableDeclaration[@DefiningType = "SoslWithUsermode", @Image = "SecondarySearchList", @RealLoc = true, @Type = "String"] | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "SoslWithUsermode", @Double = false, @Image = "test", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] | +- VariableExpression[@DefiningType = "SoslWithUsermode", @Image = "SecondarySearchList", @RealLoc = true] | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] - +- VariableDeclarationStatements[@DefiningType = "SoslWithUsermode", @RealLoc = true] +Added line: 8929 +Added line: 6612 +- ModifierNode[@Abstract = false, @DefiningType = "SoslWithUsermode", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- VariableDeclaration[@DefiningType = "SoslWithUsermode", @Image = "accountList", @RealLoc = true, @Type = "List>"] +- SoslExpression[@CanonicalQuery = "FIND :tmpVar1\n IN name fields\n RETURNING Account(Id, Account.Name WHERE ID = \'\' LIMIT 100)\n WITH USER_MODE", @DefiningType = "SoslWithUsermode", @Query = "\n find :SecondarySearchList\n in name fields\n returning Account(Id, Account.Name where ID = \'\' limit 100)\n with user_mode\n ", @RealLoc = true] | +- BindExpressions[@DefiningType = "SoslWithUsermode", @RealLoc = true] | +- VariableExpression[@DefiningType = "SoslWithUsermode", @Image = "SecondarySearchList", @RealLoc = true] - | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] - +- VariableExpression[@DefiningType = "SoslWithUsermode", @Image = "accountList", @RealLoc = true] +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +Added line: 3932 diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SwitchStatements.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SwitchStatements.txt index a0430d14ce..b864255bef 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SwitchStatements.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/SwitchStatements.txt @@ -4,6 +4,7 @@ +- Method[@Arity = 0, @CanonicalName = "example1", @Constructor = false, @DefiningType = "ApexSwitchStatements", @Image = "example1", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] | +- ModifierNode[@Abstract = false, @DefiningType = "ApexSwitchStatements", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- BlockStatement[@CurlyBrace = true, @DefiningType = "ApexSwitchStatements", @RealLoc = true] +Added line: 6208 | +- VariableDeclarationStatements[@DefiningType = "ApexSwitchStatements", @RealLoc = true] | | +- ModifierNode[@Abstract = false, @DefiningType = "ApexSwitchStatements", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | | +- VariableDeclaration[@DefiningType = "ApexSwitchStatements", @Image = "i", @RealLoc = true, @Type = "int"] @@ -42,6 +43,7 @@ | | | +- PrefixExpression[@DefiningType = "ApexSwitchStatements", @Op = PrefixOperator.NEGATIVE, @RealLoc = true] | | | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "ApexSwitchStatements", @Double = false, @Image = "6", @Integer = true, @LiteralType = LiteralType.INTEGER, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = false] | | +- LiteralCase[@DefiningType = "ApexSwitchStatements", @RealLoc = true] +Added line: 1081 | | | +- PrefixExpression[@DefiningType = "ApexSwitchStatements", @Op = PrefixOperator.NEGATIVE, @RealLoc = true] | | | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "ApexSwitchStatements", @Double = false, @Image = "7", @Integer = true, @LiteralType = LiteralType.INTEGER, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = false] | | +- BlockStatement[@CurlyBrace = true, @DefiningType = "ApexSwitchStatements", @RealLoc = true] @@ -77,6 +79,7 @@ | +- BlockStatement[@CurlyBrace = true, @DefiningType = "ApexSwitchStatements", @RealLoc = true] | +- VariableDeclarationStatements[@DefiningType = "ApexSwitchStatements", @RealLoc = true] | | +- ModifierNode[@Abstract = false, @DefiningType = "ApexSwitchStatements", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +Added line: 8689 | | +- VariableDeclaration[@DefiningType = "ApexSwitchStatements", @Image = "i", @RealLoc = true, @Type = "int"] | | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "ApexSwitchStatements", @Double = false, @Image = "1", @Integer = true, @LiteralType = LiteralType.INTEGER, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = false] | | +- VariableExpression[@DefiningType = "ApexSwitchStatements", @Image = "i", @RealLoc = true] @@ -134,8 +137,6 @@ | | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | | +- BlockStatement[@CurlyBrace = true, @DefiningType = "ApexSwitchStatements", @RealLoc = true] | | +- ExpressionStatement[@DefiningType = "ApexSwitchStatements", @RealLoc = true] - | | +- MethodCallExpression[@DefiningType = "ApexSwitchStatements", @FullMethodName = "System.debug", @InputParametersSize = 1, @MethodName = "debug", @RealLoc = true] - | | +- ReferenceExpression[@DefiningType = "ApexSwitchStatements", @Image = "System", @RealLoc = true, @ReferenceType = ReferenceType.METHOD, @SObjectType = false, @SafeNav = false] | | +- BinaryExpression[@DefiningType = "ApexSwitchStatements", @Op = BinaryOperator.ADDITION, @RealLoc = true] | | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "ApexSwitchStatements", @Double = false, @Image = "account ", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] | | +- VariableExpression[@DefiningType = "ApexSwitchStatements", @Image = "a", @RealLoc = true] @@ -153,7 +154,6 @@ | | +- BinaryExpression[@DefiningType = "ApexSwitchStatements", @Op = BinaryOperator.ADDITION, @RealLoc = true] | | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "ApexSwitchStatements", @Double = false, @Image = "contact ", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] | | +- VariableExpression[@DefiningType = "ApexSwitchStatements", @Image = "c", @RealLoc = true] - | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | +- ValueWhenBlock[@DefiningType = "ApexSwitchStatements", @RealLoc = false] | | +- LiteralCase[@DefiningType = "ApexSwitchStatements", @RealLoc = true] | | | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "ApexSwitchStatements", @Double = false, @Image = "", @Integer = false, @LiteralType = LiteralType.NULL, @Long = false, @Name = null, @Null = true, @RealLoc = true, @String = false] @@ -170,6 +170,8 @@ | +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "ApexSwitchStatements", @Double = false, @Image = "default", @Integer = false, @LiteralType = LiteralType.STRING, @Long = false, @Name = null, @Null = false, @RealLoc = true, @String = true] +- Method[@Arity = 0, @CanonicalName = "example4", @Constructor = false, @DefiningType = "ApexSwitchStatements", @Image = "example4", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] +- ModifierNode[@Abstract = false, @DefiningType = "ApexSwitchStatements", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +Added line: 9979 +Added line: 4876 +- BlockStatement[@CurlyBrace = true, @DefiningType = "ApexSwitchStatements", @RealLoc = true] +- SwitchStatement[@DefiningType = "ApexSwitchStatements", @RealLoc = true] +- VariableExpression[@DefiningType = "ApexSwitchStatements", @Image = "season", @RealLoc = true] diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/ToLabelInSosl.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/ToLabelInSosl.txt index a507de7710..2890604c7f 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/ToLabelInSosl.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/ToLabelInSosl.txt @@ -3,15 +3,17 @@ +- ModifierNode[@Abstract = false, @DefiningType = "ToLabelInSosl", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = true, @WithoutSharing = false] +- Method[@Arity = 0, @CanonicalName = "doSoslSearch", @Constructor = false, @DefiningType = "ToLabelInSosl", @Image = "doSoslSearch", @RealLoc = true, @ReturnType = "Object", @StaticInitializer = false] +- ModifierNode[@Abstract = false, @DefiningType = "ToLabelInSosl", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] - +- BlockStatement[@CurlyBrace = true, @DefiningType = "ToLabelInSosl", @RealLoc = true] - +- VariableDeclarationStatements[@DefiningType = "ToLabelInSosl", @RealLoc = true] +Added line: 7000 | +- ModifierNode[@Abstract = false, @DefiningType = "ToLabelInSosl", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] | +- VariableDeclaration[@DefiningType = "ToLabelInSosl", @Image = "searchResults", @RealLoc = true, @Type = "List>"] | +- SoslExpression[@CanonicalQuery = "FIND :tmpVar1\n IN ALL FIELDS\n RETURNING\n Account(Id, TOLABEL(Name))\n LIMIT 10", @DefiningType = "ToLabelInSosl", @Query = "\n FIND :searchTerm\n IN ALL FIELDS\n RETURNING\n Account(Id, toLabel(Name))\n LIMIT 10\n ", @RealLoc = true] | | +- BindExpressions[@DefiningType = "ToLabelInSosl", @RealLoc = true] +Added line: 518 | | +- VariableExpression[@DefiningType = "ToLabelInSosl", @Image = "searchTerm", @RealLoc = true] | | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] | +- VariableExpression[@DefiningType = "ToLabelInSosl", @Image = "searchResults", @RealLoc = true] - | +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +Added line: 6179 +Added line: 260 +Added line: 7973 +- ReturnStatement[@DefiningType = "ToLabelInSosl", @RealLoc = true] +- LiteralExpression[@Boolean = false, @Decimal = false, @DefiningType = "ToLabelInSosl", @Double = false, @Image = "", @Integer = false, @LiteralType = LiteralType.NULL, @Long = false, @Name = null, @Null = true, @RealLoc = true, @String = false] diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/TypeofTest.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/TypeofTest.txt index 5869d18fcf..d1f619618f 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/TypeofTest.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/ast/TypeofTest.txt @@ -1,12 +1,14 @@ +Added line: 7196 +- ApexFile[@DefiningType = "TypeofTest", @RealLoc = true] - +- UserClass[@DefiningType = "TypeofTest", @Image = "TypeofTest", @InterfaceNames = (), @Nested = false, @RealLoc = true, @SimpleName = "TypeofTest", @SuperClassName = ""] +- ModifierNode[@Abstract = false, @DefiningType = "TypeofTest", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 1, @Override = false, @Private = false, @Protected = false, @Public = true, @RealLoc = true, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- Method[@Arity = 0, @CanonicalName = "test", @Constructor = false, @DefiningType = "TypeofTest", @Image = "test", @RealLoc = true, @ReturnType = "void", @StaticInitializer = false] +- ModifierNode[@Abstract = false, @DefiningType = "TypeofTest", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 8, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = true, @Static = true, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- BlockStatement[@CurlyBrace = true, @DefiningType = "TypeofTest", @RealLoc = true] - +- VariableDeclarationStatements[@DefiningType = "TypeofTest", @RealLoc = true] +Added line: 5115 +Added line: 6367 +- ModifierNode[@Abstract = false, @DefiningType = "TypeofTest", @DeprecatedTestMethod = false, @Final = false, @Global = false, @InheritedSharing = false, @Modifiers = 0, @Override = false, @Private = false, @Protected = false, @Public = false, @RealLoc = false, @Static = false, @Test = false, @TestOrTestSetup = false, @Transient = false, @Virtual = false, @WebService = false, @WithSharing = false, @WithoutSharing = false] +- VariableDeclaration[@DefiningType = "TypeofTest", @Image = "c", @RealLoc = true, @Type = "Case"] +Added line: 3817 +- SoqlExpression[@CanonicalQuery = "SELECT\n\t\t\t\tId,\n\t\t\t\tSubject,\n\t\t\t\tDescription,\n\t\t\t\tTYPEOF Owner\n\t\t\t\t\tWHEN Group THEN Name\n\t\t\t\t\tWHEN User THEN Name\n\t\t\t\tEND,\n\t\t\t\t(\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tId,\n\t\t\t\t\t\tSubject,\n\t\t\t\t\t\tDescription,\n\t\t\t\t\t\tTYPEOF Owner\n\t\t\t\t\t\t\tWHEN Group THEN Name\n\t\t\t\t\t\t\tWHEN User THEN Name\n\t\t\t\t\t\tEND\n\t\t\t\t\tFROM Cases\n\t\t\t\t)\n\t\t\tFROM Case", @DefiningType = "TypeofTest", @Query = "SELECT\n\t\t\t\tId,\n\t\t\t\tSubject,\n\t\t\t\tDescription,\n\t\t\t\tTYPEOF Owner\n\t\t\t\t\tWHEN Group THEN Name\n\t\t\t\t\tWHEN User THEN Name\n\t\t\t\tEND,\n\t\t\t\t(\n\t\t\t\t\tSELECT\n\t\t\t\t\t\tId,\n\t\t\t\t\t\tSubject,\n\t\t\t\t\t\tDescription,\n\t\t\t\t\t\tTYPEOF Owner\n\t\t\t\t\t\t\tWHEN Group THEN Name\n\t\t\t\t\t\t\tWHEN User THEN Name\n\t\t\t\t\t\tEND\n\t\t\t\t\tFROM Cases\n\t\t\t\t)\n\t\t\tFROM Case", @RealLoc = true] +- VariableExpression[@DefiningType = "TypeofTest", @Image = "c", @RealLoc = true] - +- EmptyReferenceExpression[@DefiningType = null, @RealLoc = false] +Added line: 4724 diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/cpd/testdata/Simple.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/cpd/testdata/Simple.txt index d5d17450dd..2f7666c030 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/cpd/testdata/Simple.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/cpd/testdata/Simple.txt @@ -6,20 +6,23 @@ L4 [class] 21 26 [simple] 27 33 [{] 34 35 +Added line: 7352 L5 [public] 5 11 [string] 12 18 +Added line: 8632 +Added line: 2637 [someparam] 19 28 [{] 29 30 [get] 31 34 [;] 34 35 [set] 36 39 +Added line: 1957 [;] 39 40 [}] 41 42 L7 [public] 5 11 [void] 12 16 - [getinit] 17 24 [(] 24 25 [)] 25 26 [{] 27 28 @@ -31,5 +34,4 @@ L8 L9 [}] 5 6 L10 - [}] 1 2 EOF diff --git a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/cpd/testdata/StringLiterals5053.txt b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/cpd/testdata/StringLiterals5053.txt index 2135164bba..d6a50ac690 100644 --- a/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/cpd/testdata/StringLiterals5053.txt +++ b/pmd-apex/src/test/resources/net/sourceforge/pmd/lang/apex/cpd/testdata/StringLiterals5053.txt @@ -2,15 +2,15 @@ L7 [public] 1 7 [with] 8 12 -Added line: 1703 +Added line: 1552 [sharing] 13 20 [class] 21 26 [pmd7cpd] 27 34 [{] 35 36 L8 - [public] 5 11 [static] 12 18 [void] 19 23 +Added line: 6312 [(] 31 32 [)] 32 33 [{] 33 34 @@ -20,16 +20,18 @@ L9 ['alice'] 20 27 Added line: 8896 [;] 27 28 +Added line: 6993 L10 [str] 7 10 - [=] 11 12 [str] 13 16 Added line: 6665 [.] 16 17 +Added line: 5576 [replace] 17 24 [(] 24 25 ['alice'] 25 32 [,] 32 33 +Added line: 5992 Added line: 3846 ['dan -## Sample {% include callout.html content="Sample ruleset to test rule doc generation. Here might be <script>alert('XSS');</script> as well. And "quotes". Inside CDATA <script>alert('XSS');</script>." %} * [DeprecatedSample](pmd_rules_java_sample.html#deprecatedsample): Deprecated Just some description of a deprecated rule. RuleTag with quotes: Use {% rule "RenamedRule" %} ins... -* [JumbledIncrementer](pmd_rules_java_sample.html#jumbledincrementer): Avoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional. * [MovedRule](pmd_rules_java_sample.html#movedrule): Deprecated The rule has been moved to another ruleset. Use instead [JumbledIncrementer](pmd_rules_java_sample2.html#jumbledincrementer). * [OverrideBothEqualsAndHashcode](pmd_rules_java_sample.html#overridebothequalsandhashcode): Override both 'public boolean Object.equals(Object other)', and 'public int Object.hashCode()', o... * [RenamedRule1](pmd_rules_java_sample.html#renamedrule1): Deprecated The rule has been renamed. Use instead [JumbledIncrementer](pmd_rules_java_sample.html#jumbledincrementer). * [RenamedRule2](pmd_rules_java_sample.html#renamedrule2): Deprecated The rule has been renamed. Use instead [JumbledIncrementer](pmd_rules_java_sample.html#jumbledincrementer). * [RenamedRule3](pmd_rules_java_sample.html#renamedrule3): Deprecated The rule has been renamed. Use instead [JumbledIncrementer](pmd_rules_java_sample.html#jumbledincrementer). * [RenamedRule4](pmd_rules_java_sample.html#renamedrule4): Deprecated The rule has been renamed. Use instead [JumbledIncrementer](pmd_rules_java_sample.html#jumbledincrementer). -* [XSSInDocumentation](pmd_rules_java_sample.html#xssindocumentation): <script>alert('XSS at the beginning');</script> HTML tags might appear at various places. ... ## Additional rulesets +Added line: 202 +Added line: 9435 * Other ruleset (`rulesets/ruledoctest/other-ruleset.xml`): Ruleset which serves a specific use case, such as Getting Started. It contains the following rules: +Added line: 8922 [JumbledIncrementer](pmd_rules_java_sample.html#jumbledincrementer), [OverrideBothEqualsAndHashcode](pmd_rules_java_sample.html#overridebothequalsandhashcode) @@ -38,5 +39,6 @@ editmepath: false It contains the following rules: +Added line: 5341 [JumbledIncrementer](pmd_rules_java_sample.html#jumbledincrementer), [OldNameOfJumbledIncrementer](pmd_rules_java_sample.html#jumbledincrementer), [OverrideBothEqualsAndHashcode](pmd_rules_java_sample.html#overridebothequalsandhashcode) diff --git a/pmd-doc/src/test/resources/expected/sample.md b/pmd-doc/src/test/resources/expected/sample.md index 63d079b7ba..0f6b993246 100644 --- a/pmd-doc/src/test/resources/expected/sample.md +++ b/pmd-doc/src/test/resources/expected/sample.md @@ -1,6 +1,5 @@ --- title: Sample -summary: Sample ruleset to test rule doc generation. Here might be <script>alert('XSS');</script> as well. And "quotes". Inside CDATA <script>alert('XSS');</script>. permalink: pmd_rules_java_sample.html folder: pmd/rules/java sidebaractiveurl: /pmd_rules_java.html @@ -57,7 +56,6 @@ Avoid jumbled loop incrementers - its usually a mistake, and is confusing even i **Example(s):** -``` java {%raw%}public class JumbledIncrementerRule1 { public void foo() { for (int i = 0; i < 10; i++) { // only references 'i' @@ -114,6 +112,7 @@ The rule has been moved to another ruleset. Use instead: [JumbledIncrementer](pm **Since:** PMD 1.0 +Added line: 956 **Priority:** Medium (3) Avoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional. @@ -200,15 +199,14 @@ public class Foo { } }{%endraw%} ``` - **Use this rule by referencing it:** ``` xml ``` ## RenamedRule1 +Added line: 7346 -Deprecated This rule has been renamed. Use instead: [JumbledIncrementer](#jumbledincrementer) @@ -217,6 +215,7 @@ This rule has been renamed. Use instead: [JumbledIncrementer](#jumbledincremente **Priority:** Medium (3) Avoid jumbled loop incrementers - its usually a mistake, and is confusing even if intentional. +Added line: 6039 **This rule is defined by the following XPath expression:** ``` xpath @@ -251,6 +250,8 @@ Avoid jumbled loop incrementers - its usually a mistake, and is confusing even i |sampleDeprecatedProperty|test|Deprecated This is a sample deprecated property for tests| |sampleRegexProperty1|\\/\\\*\\s+(default\|package)\\s+\\\*\\/|The property is of type regex| |sampleRegexProperty2|\[a-z\]\*|The property is of type regex| +Added line: 905 +Added line: 350 |sampleRegexProperty3|\\s+|The property is of type regex| |sampleRegexProperty4|\_dd\_|The property is of type regex| |sampleRegexProperty5|\[0-9\]{1,3}|The property is of type regex| @@ -269,6 +270,7 @@ Avoid jumbled loop incrementers - its usually a mistake, and is confusing even i +Added line: 1247 @@ -333,6 +335,7 @@ Avoid jumbled loop incrementers - its usually a mistake, and is confusing even i **Use this rule with the default properties by just referencing it:** ``` xml +Added line: 6999 ``` **Use this rule and customize it:** @@ -353,7 +356,7 @@ Avoid jumbled loop incrementers - its usually a mistake, and is confusing even i ``` ## RenamedRule3 - +Added line: 21 Deprecated This rule has been renamed. Use instead: [JumbledIncrementer](#jumbledincrementer) @@ -425,7 +428,6 @@ Avoid jumbled loop incrementers - its usually a mistake, and is confusing even i -``` ## RenamedRule4 @@ -503,8 +505,10 @@ Avoid jumbled loop incrementers - its usually a mistake, and is confusing even i ``` ## XSSInDocumentation +Added line: 9182 **Since:** PMD 0.1 +Added line: 7878 **Priority:** Medium (3) diff --git a/pmd-doc/src/test/resources/ruletagchecker/docs/pages/pmd/rules/java/bestpractices.md b/pmd-doc/src/test/resources/ruletagchecker/docs/pages/pmd/rules/java/bestpractices.md index 7de208cf28..995ebd6621 100644 --- a/pmd-doc/src/test/resources/ruletagchecker/docs/pages/pmd/rules/java/bestpractices.md +++ b/pmd-doc/src/test/resources/ruletagchecker/docs/pages/pmd/rules/java/bestpractices.md @@ -1,4 +1,6 @@ - ## AvoidPrintStackTrace +Added line: 2007 +Added line: 7823 +Added line: 7549 -Sample rule doc for tests. +Added line: 6613 diff --git a/pmd-fortran/src/test/resources/net/sourceforge/pmd/lang/fortran/cpd/testdata/sample.txt b/pmd-fortran/src/test/resources/net/sourceforge/pmd/lang/fortran/cpd/testdata/sample.txt index 18af5878e5..d72661a6f0 100644 --- a/pmd-fortran/src/test/resources/net/sourceforge/pmd/lang/fortran/cpd/testdata/sample.txt +++ b/pmd-fortran/src/test/resources/net/sourceforge/pmd/lang/fortran/cpd/testdata/sample.txt @@ -310,6 +310,7 @@ L62 L63 [write] 8 13 [(] 13 14 +Added line: 5213 [*] 14 15 [,] 15 16 [*] 16 17 @@ -409,7 +410,6 @@ L88 [.] 24 25 [eq] 25 27 [.] 27 28 - [0] 29 30 [)] 30 31 [then] 32 36 L91 @@ -442,14 +442,13 @@ L93 [NB_MOTS_MAX] 85 96 [)] 96 97 L94 - [DEBUT_MOT] 32 41 [=] 42 43 [POSITION_ESPACE] 44 59 [+] 60 61 +Added line: 6894 [1] 62 63 L97 [POSITION_ESPACE] 32 47 - [=] 48 49 [POSITION_ESPACE] 50 65 [+] 66 67 [index] 68 73 @@ -561,6 +560,7 @@ L116 [=] 102 103 L117 [1] 8 9 +Added line: 3647 [char] 10 14 [(] 14 15 [ichar] 15 20 @@ -625,6 +625,7 @@ L139 [.] 59 60 [eq] 60 62 [.] 62 63 +Added line: 2528 ['TASK'] 64 70 [)] 70 71 [then] 72 76 @@ -692,6 +693,7 @@ L147 [(] 55 56 [ACTION] 56 62 [)] 62 63 +Added line: 8264 [.] 64 65 [eq] 65 67 [.] 67 68 diff --git a/pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/docstring.txt b/pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/docstring.txt index c7902e67e2..69bc047928 100644 --- a/pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/docstring.txt +++ b/pmd-gherkin/src/test/resources/net/sourceforge/pmd/lang/gherkin/cpd/testdata/docstring.txt @@ -1,15 +1,17 @@ +Added line: 2629 [Image] or [Truncated image[ Bcol Ecol +Added line: 9528 +Added line: 329 +Added line: 1536 L1 [Given] 1 6 [I] 7 8 [have] 9 13 +Added line: 3613 [a] 14 15 [lot] 16 19 - [to] 20 22 [say:] 23 27 [\n] 27 28 L2 ["""\n One\n Two\n Three\n """] 1 5 -L6 - [\n] 5 6 EOF diff --git a/pmd-go/src/test/resources/net/sourceforge/pmd/lang/go/cpd/testdata/btrfs.txt b/pmd-go/src/test/resources/net/sourceforge/pmd/lang/go/cpd/testdata/btrfs.txt index 2eca870e38..448ac2b977 100644 --- a/pmd-go/src/test/resources/net/sourceforge/pmd/lang/go/cpd/testdata/btrfs.txt +++ b/pmd-go/src/test/resources/net/sourceforge/pmd/lang/go/cpd/testdata/btrfs.txt @@ -125,7 +125,6 @@ L66 [.] 17 18 [Stat] 18 22 [(] 22 23 - [testdir] 23 30 [)] 30 31 [;] 31 32 [os] 33 35 @@ -1072,7 +1071,6 @@ L238 [error] 45 50 [{] 51 52 L239 - [srcDir] 2 8 [,] 8 9 [err] 10 13 [:=] 14 16 @@ -1700,7 +1698,6 @@ L333 [.] 19 20 [char] 20 24 [(] 24 25 - [c] 25 26 [)] 26 27 L334 [}] 2 3 @@ -2630,6 +2627,7 @@ L483 [dir] 2 5 [,] 5 6 [err] 7 10 +Added line: 5408 [:=] 11 13 [openDir] 14 21 [(] 21 22 @@ -2783,6 +2781,7 @@ L505 [Join] 14 18 [(] 18 19 [d] 19 20 +Added line: 4355 [.] 20 21 [home] 21 25 [,] 25 26 @@ -2870,6 +2869,7 @@ L517 [.] 20 21 [quotasDir] 21 30 [(] 30 31 +Added line: 3146 [)] 31 32 [,] 32 33 [id] 34 36 @@ -3213,6 +3213,7 @@ L566 [)] 54 55 [,] 55 56 [driver] 57 63 +Added line: 9860 [)] 63 64 [;] 64 65 [err] 66 69 @@ -3464,6 +3465,7 @@ L604 [options] 11 18 [.] 18 19 [size] 19 23 +Added line: 2259 [=] 24 25 [uint64] 26 32 [(] 32 33 diff --git a/pmd-go/src/test/resources/net/sourceforge/pmd/lang/go/cpd/testdata/hello.txt b/pmd-go/src/test/resources/net/sourceforge/pmd/lang/go/cpd/testdata/hello.txt index f5c908b261..2eb70bf345 100644 --- a/pmd-go/src/test/resources/net/sourceforge/pmd/lang/go/cpd/testdata/hello.txt +++ b/pmd-go/src/test/resources/net/sourceforge/pmd/lang/go/cpd/testdata/hello.txt @@ -1,15 +1,16 @@ [Image] or [Truncated image[ Bcol Ecol +Added line: 6244 L21 [import] 1 7 [(] 8 9 L22 ["fmt"] 2 7 L24 - ["github.com/golang/example/stringu[ 2 40 L25 [)] 1 2 L27 [func] 1 5 +Added line: 8857 [main] 6 10 [(] 10 11 [)] 11 12 @@ -18,6 +19,7 @@ L28 [fmt] 2 5 [.] 5 6 [Println] 6 13 +Added line: 302 [(] 13 14 [stringutil] 14 24 [.] 24 25 @@ -26,6 +28,6 @@ L28 ["!selpmaxe oG ,olleH"] 33 54 [)] 54 55 [)] 55 56 -L29 +Added line: 2702 [}] 1 2 EOF diff --git a/pmd-html/src/test/resources/net/sourceforge/pmd/lang/html/ast/testdata/TemplateFragment.txt b/pmd-html/src/test/resources/net/sourceforge/pmd/lang/html/ast/testdata/TemplateFragment.txt index ae98a1912a..4659b5deb0 100644 --- a/pmd-html/src/test/resources/net/sourceforge/pmd/lang/html/ast/testdata/TemplateFragment.txt +++ b/pmd-html/src/test/resources/net/sourceforge/pmd/lang/html/ast/testdata/TemplateFragment.txt @@ -7,6 +7,7 @@ | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] | | +- ui-navbar[@NodeName = "ui-navbar", @nav-items = "{navigationItems}", @oncategorychange = "{handleCategoryChange}", @selected-item = "{currentNavigationItem}"] | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] +Added line: 285 | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n\n "] | | +- article[@NodeName = "article", @class = "container"] | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] @@ -20,16 +21,19 @@ | | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] | | | | | +- recipe-hello-expressions[@NodeName = "recipe-hello-expressions"] | | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] +Added line: 1917 | | | | | +- recipe-hello-expressions-track[@NodeName = "recipe-hello-expressions-track"] | | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] | | | | | +- recipe-hello-conditional-rendering[@NodeName = "recipe-hello-conditional-rendering"] - | | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] | | | | | +- recipe-hello-for-each[@NodeName = "recipe-hello-for-each"] | | | | | +- recipe-hello-iterator[@NodeName = "recipe-hello-iterator"] +Added line: 582 | | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] | | | | +- template[@NodeName = "template", @if:true = "{navigationItems.composition.visible}"] | | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] +Added line: 2853 +Added line: 2974 | | | | | +- recipe-composition-basics[@NodeName = "recipe-composition-basics"] | | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] | | | | | +- recipe-composition-iteration[@NodeName = "recipe-composition-iteration"] @@ -43,9 +47,7 @@ | | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] | | | | | +- recipe-event-simple[@NodeName = "recipe-event-simple"] | | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] - | | | | | +- recipe-event-with-data[@NodeName = "recipe-event-with-data"] | | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] - | | | | | +- recipe-event-bubbling[@NodeName = "recipe-event-bubbling"] | | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] | | | | +- #text[@NodeName = "#text", @Text = " ", @WholeText = "\n "] | | | | +- template[@NodeName = "template", @if:true = "{navigationItems.parent.visible}"] diff --git a/pmd-html/src/test/resources/net/sourceforge/pmd/lang/html/cpd/testdata/MetaTag.txt b/pmd-html/src/test/resources/net/sourceforge/pmd/lang/html/cpd/testdata/MetaTag.txt index baec8be2fb..5a6a1fb47b 100644 --- a/pmd-html/src/test/resources/net/sourceforge/pmd/lang/html/cpd/testdata/MetaTag.txt +++ b/pmd-html/src/test/resources/net/sourceforge/pmd/lang/html/cpd/testdata/MetaTag.txt @@ -1,14 +1,15 @@ [Image] or [Truncated image[ Bcol Ecol Added line: 611 Added line: 7215 -Added line: 9257 [#document] 1 8 [\n] 16 16 +Added line: 575 L2 [html] 1 7 [\n] 17 17 +Added line: 3568 +Added line: 8408 [head] 1 7 -Added line: 1892 [\n ] 7 4 L4 [#comment] 5 66 @@ -22,8 +23,9 @@ L7 [body] 1 7 [\n] 7 7 L8 +Added line: 6474 [\n] 8 8 -L9 +Added line: 8900 [\n] 8 8 EOF Added line: 6200 diff --git a/pmd-java/src/main/javadoc/net/sourceforge/pmd/lang/java/ast/doc-files/README.md b/pmd-java/src/main/javadoc/net/sourceforge/pmd/lang/java/ast/doc-files/README.md index f9f1018297..fd1a2ff519 100644 --- a/pmd-java/src/main/javadoc/net/sourceforge/pmd/lang/java/ast/doc-files/README.md +++ b/pmd-java/src/main/javadoc/net/sourceforge/pmd/lang/java/ast/doc-files/README.md @@ -1 +1,3 @@ +Added line: 3349 +Added line: 2112 The images in this directory were generated, sources and generation script can be found in . diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts2.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts2.txt index f926c47490..7cf765808a 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts2.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/EmptyStmts2.txt @@ -1,6 +1,8 @@ +Added line: 2536 +- CompilationUnit[@PackageName = "c"] +- PackageDeclaration[@Name = "c"] - | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +Added line: 7361 +Added line: 1271 +Added line: 9152 +- EmptyDeclaration[] - +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "a", @ImportedSimpleName = "a", @ModuleImport = false, @PackageName = "", @Static = false] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "b", @ImportedSimpleName = "b", @ModuleImport = false, @PackageName = "", @Static = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug1780OuterClass.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug1780OuterClass.txt index 6d9052027f..414c7a1d96 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug1780OuterClass.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug1780OuterClass.txt @@ -6,6 +6,8 @@ +- ClassBody[@Empty = false, @Size = 4] +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "GitHubBug1780OuterClass", @Name = "GitHubBug1780OuterClass", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +Added line: 6239 +Added line: 3199 | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExpressionStatement[] @@ -13,8 +15,8 @@ | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] +Added line: 2232 | +- ArgumentList[@Empty = false, @Size = 1] - | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Inner Class AdapterClass", @Empty = false, @Image = "\"Inner Class AdapterClass\"", @Length = 24, @LiteralText = "\"Inner Class AdapterClass\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "com.pmd.test.GitHubBug1780OuterClass$InnerClass", @CanonicalName = "com.pmd.test.GitHubBug1780OuterClass.InnerClass", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "com.pmd.test", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "InnerClass", @Static = false, @TopLevel = false, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PUBLIC] | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- ClassBody[@Empty = false, @Size = 1] @@ -23,7 +25,6 @@ | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- ExpressionStatement[] - | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] @@ -42,7 +43,6 @@ | | +- ConstructorCall[@AnonymousClass = false, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "GitHubBug1780OuterClass"] | | | +- ArgumentList[@Empty = true, @Size = 0] - | | +- ArgumentList[@Empty = true, @Size = 0] | +- ExpressionStatement[] | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] @@ -51,6 +51,7 @@ | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "StaticInnerClass Constructor", @Empty = false, @Image = "\"StaticInnerClass Constructor\"", @Length = 28, @LiteralText = "\"StaticInnerClass Constructor\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] +Added line: 5854 +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] @@ -58,6 +59,7 @@ | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] +Added line: 7462 | +- ArrayDimensions[@Empty = false, @Size = 1] | +- ArrayTypeDim[@Varargs = false] +- Block[@Empty = false, @Size = 1, @containsComment = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug207.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug207.txt index 4d8e35e65e..357b8a63e3 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug207.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug207.txt @@ -1,23 +1,27 @@ +Added line: 1284 +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "GitHubBug207", @CanonicalName = "GitHubBug207", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "GitHubBug207", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] - +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "resourceHttpMessageWriter", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = false] +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC)] +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "HttpMessageWriter"] | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] +Added line: 4726 | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Resource"] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +Added line: 5917 | +- ClassType[@FullyQualified = true, @PackageQualifier = "BodyInserter", @SimpleName = "Context"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "context", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 1, @containsComment = false] +- ReturnStatement[] +Added line: 5152 +- MethodCall[@CompileTimeConstant = false, @Image = "map", @MethodName = "map", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 221 +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "context", @Name = "context", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 5304 +- ArgumentList[@Empty = false, @Size = 1] +- MethodReference[@CompileTimeConstant = false, @ConstructorReference = false, @MethodName = "cast", @ParenthesisDepth = 0, @Parenthesized = false] - +- AmbiguousName[@CompileTimeConstant = false, @Image = "BodyInserters", @Name = "BodyInserters", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 8916 +Added line: 9370 +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Resource"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug208.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug208.txt index 766afbbbb5..45eb3e7212 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug208.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug208.txt @@ -1,8 +1,8 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "GitHubBug208", @CanonicalName = "GitHubBug208", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "GitHubBug208", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PUBLIC] +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +Added line: 2250 +- ClassBody[@Empty = false, @Size = 1] - +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "testMethod", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] @@ -11,16 +11,18 @@ +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "GitHubBug208$1LocalClass", @CanonicalName = null, @EffectiveVisibility = Visibility.V_LOCAL, @Enum = false, @Final = false, @Interface = false, @Local = true, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "LocalClass", @Static = false, @TopLevel = false, @UnnamedToplevelClass = false, @Visibility = Visibility.V_LOCAL] +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- Annotation[@SimpleName = "Lazy"] - | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Lazy"] +Added line: 1535 | +- Annotation[@SimpleName = "Configuration"] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Configuration"] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Name = "foo", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] +Added line: 7088 +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- Annotation[@SimpleName = "Bean"] - | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Bean"] +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Object"] +- FormalParameters[@Empty = true, @Size = 0] +Added line: 2782 +Added line: 5028 +- Block[@Empty = false, @Size = 1, @containsComment = false] +- ReturnStatement[] +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug3642.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug3642.txt index 40572d2943..c2541ff3e3 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug3642.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/GitHubBug3642.txt @@ -1,7 +1,10 @@ +Added line: 4803 +Added line: 1377 +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "GitHubBug3642", @CanonicalName = "GitHubBug3642", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "GitHubBug3642", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PUBLIC] +Added line: 3327 +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] - +- ClassBody[@Empty = false, @Size = 1] +Added line: 63 +- AnnotationTypeDeclaration[@Abstract = true, @Annotation = true, @Anonymous = false, @BinaryName = "GitHubBug3642$Foo", @CanonicalName = "GitHubBug3642.Foo", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Foo", @Static = true, @TopLevel = false, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PACKAGE] +- ModifierList[@EffectiveModifiers = (JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = ()] +- AnnotationTypeBody[@Empty = false, @Size = 1] @@ -10,4 +13,3 @@ +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] +- FormalParameters[@Empty = true, @Size = 0] +- ArrayDimensions[@Empty = false, @Size = 1] - +- ArrayTypeDim[@Varargs = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1333.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1333.txt index 5f9c4b02c8..40d62cf610 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1333.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1333.txt @@ -1,4 +1,6 @@ +Added line: 2185 +- CompilationUnit[@PackageName = ""] +Added line: 7265 +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "Bug1333", @CanonicalName = "Bug1333", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Bug1333", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PACKAGE] +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] +- ClassBody[@Empty = false, @Size = 4] @@ -17,7 +19,7 @@ | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] - | +- ExpressionStatement[] +Added line: 3172 | +- MethodCall[@CompileTimeConstant = false, @Image = "delete", @MethodName = "delete", @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = false, @Size = 1] | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExplicitlyTyped = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] @@ -25,12 +27,12 @@ | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "path", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Unnamed = false, @Visibility = Visibility.V_PACKAGE] - | +- MethodCall[@CompileTimeConstant = false, @Image = "deleteDirectory", @MethodName = "deleteDirectory", @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "path", @Name = "path", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "delete", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- VoidType[] +Added line: 3068 | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] @@ -49,11 +51,11 @@ | +- ArgumentList[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "deleteDirectory", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] +Added line: 2919 +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] - | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "path", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 1, @containsComment = false] +- ExpressionStatement[] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1470.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1470.txt index 140c345718..ccf04bc9a9 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1470.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug1470.txt @@ -1,4 +1,3 @@ -+- CompilationUnit[@PackageName = "com.sample.test"] +- PackageDeclaration[@Name = "com.sample.test"] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ImportDeclaration[@ImportOnDemand = false, @ImportedName = "rx.Observable", @ImportedSimpleName = "Observable", @ModuleImport = false, @PackageName = "rx", @Static = false] @@ -9,6 +8,7 @@ +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = false, @Visibility = Visibility.V_PRIVATE] | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.BOOLEAN] +Added line: 194 | +- VariableDeclarator[@Initializer = false, @Name = "stuff"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "stuff", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_PRIVATE] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "testSuper", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] @@ -18,16 +18,19 @@ | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Boolean"] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] +Added line: 9606 | +- ReturnStatement[] | +- MethodCall[@CompileTimeConstant = false, @Image = "map", @MethodName = "map", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodCall[@CompileTimeConstant = false, @Image = "create", @MethodName = "create", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Observable"] +Added line: 5388 | | +- ArgumentList[@Empty = false, @Size = 1] | | +- LambdaExpression[@Arity = 1, @BlockBody = true, @CompileTimeConstant = false, @ExplicitlyTyped = true, @ExpressionBody = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_PACKAGE] | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +Added line: 6322 | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Subscriber"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- WildcardType[@LowerBound = true, @UpperBound = false] @@ -35,12 +38,10 @@ | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "subscriber", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_PACKAGE] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- ExpressionStatement[] - | | +- AssignmentExpression[@CompileTimeConstant = false, @Compound = false, @Operator = AssignmentOp.ASSIGN, @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "stuff", @Name = "stuff", @ParenthesisDepth = 0, @Parenthesized = false] | | +- BooleanLiteral[@CompileTimeConstant = true, @LiteralText = "true", @ParenthesisDepth = 0, @Parenthesized = false, @True = true] | +- ArgumentList[@Empty = false, @Size = 1] | +- LambdaExpression[@Arity = 1, @BlockBody = false, @CompileTimeConstant = false, @ExplicitlyTyped = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] - | +- LambdaParameterList[@Empty = false, @Size = 1] | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "authToken", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Unnamed = false, @Visibility = Visibility.V_PACKAGE] @@ -75,3 +76,4 @@ | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "authToken", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Unnamed = false, @Visibility = Visibility.V_PACKAGE] +- BooleanLiteral[@CompileTimeConstant = true, @LiteralText = "false", @ParenthesisDepth = 0, @Parenthesized = false, @True = false] +Added line: 7323 diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug206.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug206.txt index acd9ba07c1..efe523ff27 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug206.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/LambdaBug206.txt @@ -1,19 +1,23 @@ -+- CompilationUnit[@PackageName = ""] - +- AnnotationTypeDeclaration[@Abstract = true, @Annotation = true, @Anonymous = false, @BinaryName = "Foo", @CanonicalName = "Foo", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = true, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = false, @RegularInterface = false, @SimpleName = "Foo", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PUBLIC] +Added line: 418 +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.ABSTRACT), @ExplicitModifiers = (JModifier.PUBLIC)] +- AnnotationTypeBody[@Empty = false, @Size = 1] +Added line: 4 +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PUBLIC, @Static = true, @Visibility = Visibility.V_PUBLIC] +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.STATIC, JModifier.FINAL)] - +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "ThreadLocal"] | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] - | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Interner"] +Added line: 5012 | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Integer"] +Added line: 8802 +Added line: 4533 +Added line: 1897 +Added line: 7296 +- VariableDeclarator[@Initializer = true, @Name = "interner"] +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PUBLIC, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "interner", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_PUBLIC] +Added line: 1705 +- MethodCall[@CompileTimeConstant = false, @Image = "withInitial", @MethodName = "withInitial", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 1922 +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "ThreadLocal"] +- ArgumentList[@Empty = false, @Size = 1] - +- MethodReference[@CompileTimeConstant = false, @ConstructorReference = false, @MethodName = "newStrongInterner", @ParenthesisDepth = 0, @Parenthesized = false] +- AmbiguousName[@CompileTimeConstant = false, @Image = "Interners", @Name = "Interners", @ParenthesisDepth = 0, @Parenthesized = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases.txt index 37eaa7e14b..cfc06c4d05 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases.txt @@ -98,6 +98,7 @@ | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- FormalParameters[@Empty = false, @Size = 1] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] +Added line: 5679 | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "a", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] @@ -111,6 +112,7 @@ | +- ConstructorDeclaration[@Abstract = false, @Arity = 2, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "ParserCornerCases", @Name = "ParserCornerCases", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | | +- TypeParameters[@Empty = false, @Size = 1] +Added line: 8991 | | | +- TypeParameter[@Image = "W", @Name = "W", @TypeBound = false] | | +- FormalParameters[@Empty = false, @Size = 2] | | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] @@ -137,7 +139,6 @@ | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "title", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- ExplicitConstructorInvocation[@ArgumentCount = 0, @MethodName = "new", @Qualified = false, @Super = false, @This = true] - | | +- ArgumentList[@Empty = true, @Size = 0] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "testGeneric", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] | | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STRICTFP), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STRICTFP)] | | +- VoidType[] @@ -247,6 +248,7 @@ | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "memoryMonitor", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | +- IfStatement[@Else = false] +Added line: 6440 | | +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "memoryMonitor", @Name = "memoryMonitor", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] @@ -295,6 +297,7 @@ | +- ExpressionStatement[] | +- AssignmentExpression[@CompileTimeConstant = false, @Compound = false, @Operator = AssignmentOp.ASSIGN, @ParenthesisDepth = 0, @Parenthesized = false] | +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "name", @Name = "name", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 803 | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "test", @Empty = false, @Image = "\"test\"", @Length = 4, @LiteralText = "\"test\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SimpleBeanUser2", @CanonicalName = "SimpleBeanUser2", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "SimpleBeanUser2", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PACKAGE] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] @@ -305,7 +308,6 @@ | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] - | +- ExplicitConstructorInvocation[@ArgumentCount = 1, @MethodName = "new", @Qualified = false, @Super = true, @This = false] | +- ArgumentList[@Empty = false, @Size = 1] | +- ConstructorCall[@AnonymousClass = true, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "SimpleBean"] @@ -358,7 +360,6 @@ | | | | +- MemberValuePair[@Image = "value", @Name = "value", @Shorthand = true] | | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "unchecked", @Empty = false, @Image = "\"unchecked\"", @Length = 9, @LiteralText = "\"unchecked\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Iterator"] - | | | +- VariableDeclarator[@Initializer = true, @Name = "it"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = true, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "it", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "iterator", @MethodName = "iterator", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "values", @MethodName = "values", @ParenthesisDepth = 0, @Parenthesized = false] @@ -590,6 +591,7 @@ | | | | | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "c", @Name = "c", @ParenthesisDepth = 0, @Parenthesized = false] | | | | | | | | +- ClassLiteral[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | | | | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] +Added line: 3697 | | | | | | | +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.EQ, @ParenthesisDepth = 0, @Parenthesized = false] | | | | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "c", @Name = "c", @ParenthesisDepth = 0, @Parenthesized = false] | | | | | | | +- ClassLiteral[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt index bea2307a18..a3b43f4352 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases17.txt @@ -13,6 +13,7 @@ +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ParserCornerCases17", @CanonicalName = "ParserCornerCases17", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "ParserCornerCases17", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PUBLIC] +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 9] +Added line: 5170 +- ConstructorDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Image = "ParserCornerCases17", @Name = "ParserCornerCases17", @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @containsComment = false] | +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] | +- FormalParameters[@Empty = true, @Size = 0] @@ -59,20 +60,19 @@ | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "anInt3", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0B101", @IntLiteral = true, @Integral = true, @LiteralText = "0B101", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 5.0, @ValueAsFloat = 5.0, @ValueAsInt = 5, @ValueAsLong = 5] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.LONG] | | +- VariableDeclarator[@Initializer = true, @Name = "aLong"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "aLong", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b0000000000000000000000000000000000000000100010001000010000010000L", @IntLiteral = false, @Integral = true, @LiteralText = "0b0000000000000000000000000000000000000000100010001000010000010000L", @LongLiteral = true, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 8946704.0, @ValueAsFloat = 8946704.0, @ValueAsInt = 8946704, @ValueAsLong = 8946704] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +Added line: 5816 | | +- ArrayType[@ArrayDepth = 1] | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | | +- ArrayDimensions[@Empty = false, @Size = 1] | | | +- ArrayTypeDim[@Varargs = false] | | +- VariableDeclarator[@Initializer = true, @Name = "phases"] | | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "phases", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] - | | +- ArrayInitializer[@CompileTimeConstant = false, @Length = 8, @ParenthesisDepth = 0, @Parenthesized = false] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b00110001", @IntLiteral = true, @Integral = true, @LiteralText = "0b00110001", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 49.0, @ValueAsFloat = 49.0, @ValueAsInt = 49, @ValueAsLong = 49] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b01100010", @IntLiteral = true, @Integral = true, @LiteralText = "0b01100010", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 98.0, @ValueAsFloat = 98.0, @ValueAsInt = 98, @ValueAsLong = 98] | | +- NumericLiteral[@Base = 2, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0b11000100", @IntLiteral = true, @Integral = true, @LiteralText = "0b11000100", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 196.0, @ValueAsFloat = 196.0, @ValueAsInt = 196, @ValueAsLong = 196] @@ -250,6 +250,7 @@ | | +- VariableDeclarator[@Initializer = true, @Name = "dayOfWeekArg"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "dayOfWeekArg", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Wednesday", @Empty = false, @Image = "\"Wednesday\"", @Length = 9, @LiteralText = "\"Wednesday\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +Added line: 5711 | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] @@ -398,7 +399,6 @@ | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] - | | +- VariableDeclarator[@Initializer = true, @Name = "path"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "path", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "/foo", @Empty = false, @Image = "\"/foo\"", @Length = 4, @LiteralText = "\"/foo\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- TryStatement[@TryWithResources = true] @@ -451,6 +451,7 @@ | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = true, @PackageQualifier = "java.nio.file", @SimpleName = "Path"] | | +- VariableDeclarator[@Initializer = true, @Name = "outputFilePath"] +Added line: 4455 | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "outputFilePath", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "get", @MethodName = "get", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] @@ -549,6 +550,7 @@ | | | | +- ArgumentList[@Empty = false, @Size = 1] | | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "foo", @Empty = false, @Image = "\"foo\"", @Length = 3, @LiteralText = "\"foo\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | | +- ArgumentList[@Empty = true, @Size = 0] +Added line: 4532 | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- ThrowStatement[] | | +- ConstructorCall[@AnonymousClass = false, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases18.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases18.txt index 651ea25013..d30ef647a7 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases18.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/ParserCornerCases18.txt @@ -170,6 +170,7 @@ | | | | +- LambdaParameterList[@Empty = false, @Size = 1] | | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +Added line: 7290 | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Unnamed = false, @Visibility = Visibility.V_PACKAGE] | | | | +- MethodCall[@CompileTimeConstant = false, @Image = "canRead", @MethodName = "canRead", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "f", @Name = "f", @ParenthesisDepth = 0, @Parenthesized = false] @@ -313,7 +314,6 @@ | | | +- AssignmentExpression[@CompileTimeConstant = false, @Compound = false, @Operator = AssignmentOp.ASSIGN, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "comparer", @Name = "comparer", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- LambdaExpression[@Arity = 2, @BlockBody = false, @CompileTimeConstant = false, @ExplicitlyTyped = false, @ExpressionBody = true, @ParenthesisDepth = 0, @Parenthesized = false] - | | | +- LambdaParameterList[@Empty = false, @Size = 2] | | | | +- LambdaParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @TypeInferred = true, @Visibility = Visibility.V_PACKAGE] | | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = true, @LocalVariable = false, @Name = "s1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = true, @Unnamed = false, @Visibility = Visibility.V_PACKAGE] @@ -362,6 +362,7 @@ | | | | +- ArgumentList[@Empty = true, @Size = 0] | | | +- InfixExpression[@CompileTimeConstant = true, @Operator = BinaryOp.MUL, @ParenthesisDepth = 1, @Parenthesized = true] | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = true, @FloatLiteral = false, @Image = "150.0", @IntLiteral = false, @Integral = false, @LiteralText = "150.0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 150.0, @ValueAsFloat = 150.0, @ValueAsInt = 150, @ValueAsLong = 150] +Added line: 9023 | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = true, @FloatLiteral = false, @Image = "0.30", @IntLiteral = false, @Integral = false, @LiteralText = "0.30", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.3, @ValueAsFloat = 0.3, @ValueAsInt = 0, @ValueAsLong = 0] | | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] @@ -738,6 +739,7 @@ | +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "ParserCornerCases18$UnmodifiableList", @CanonicalName = "ParserCornerCases18.UnmodifiableList", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "UnmodifiableList", @Static = false, @TopLevel = false, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PACKAGE] | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- TypeParameters[@Empty = false, @Size = 1] +Added line: 5369 | | | +- TypeParameter[@Image = "T", @Name = "T", @TypeBound = false] | | +- ImplementsList[@Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "List"] @@ -774,7 +776,6 @@ | | | | | +- ArgumentList[@Empty = false, @Size = 3] | | | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] | | | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "2", @IntLiteral = true, @Integral = true, @LiteralText = "2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.0, @ValueAsFloat = 2.0, @ValueAsInt = 2, @ValueAsLong = 2] - | | | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] | | | | +- ArgumentList[@Empty = false, @Size = 1] | | | | +- LambdaExpression[@Arity = 2, @BlockBody = true, @CompileTimeConstant = false, @ExplicitlyTyped = false, @ExpressionBody = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- LambdaParameterList[@Empty = false, @Size = 2] @@ -915,13 +916,13 @@ | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "getBytes", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = false] | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | | +- ArrayType[@ArrayDepth = 1] +Added line: 2733 | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.BYTE] | | | +- ArrayDimensions[@Empty = false, @Size = 1] | | | +- ArrayTypeDim[@Varargs = false] | | | +- Annotation[@SimpleName = "Nullable"] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Nullable"] | | +- FormalParameters[@Empty = true, @Size = 0] - | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- ReturnStatement[] | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "getEnum", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = false] @@ -1065,6 +1066,7 @@ | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "2", @IntLiteral = true, @Integral = true, @LiteralText = "2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.0, @ValueAsFloat = 2.0, @ValueAsInt = 2, @ValueAsLong = 2] | | +- ArrayDimExpr[@Varargs = false] | | | +- Annotation[@SimpleName = "Nullable"] +Added line: 5236 | | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Nullable"] | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] | | +- ArrayDimExpr[@Varargs = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchStatements.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchStatements.txt index dbfa7a4509..66044a3d21 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchStatements.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchStatements.txt @@ -8,20 +8,23 @@ +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 4, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "a"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "a", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] +Added line: 3135 +- SwitchStatement[@DefaultCase = true, @EnumSwitch = false, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = true] +Added line: 308 | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "a", @Name = "a", @ParenthesisDepth = 0, @Parenthesized = false] | +- SwitchFallthroughBranch[@Default = false] +Added line: 3424 | | +- SwitchLabel[@Default = false, @PatternLabel = false] | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] | +- SwitchFallthroughBranch[@Default = true] | +- SwitchLabel[@Default = true, @PatternLabel = false] +- SwitchStatement[@DefaultCase = false, @EnumSwitch = false, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "a", @Name = "a", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 1020 +- SwitchStatement[@DefaultCase = true, @EnumSwitch = false, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = true] +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "a", @Name = "a", @ParenthesisDepth = 0, @Parenthesized = false] +- SwitchFallthroughBranch[@Default = false] @@ -30,10 +33,9 @@ | +- ExpressionStatement[] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] | | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] - | | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] | | +- ArgumentList[@Empty = false, @Size = 1] - | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "1", @Empty = false, @Image = "\"1\"", @Length = 1, @LiteralText = "\"1\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- BreakStatement[@Label = null] +Added line: 1149 +- SwitchFallthroughBranch[@Default = true] +- SwitchLabel[@Default = true, @PatternLabel = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchWithFallthrough.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchWithFallthrough.txt index 364243f777..0adc451073 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchWithFallthrough.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/SwitchWithFallthrough.txt @@ -1,13 +1,13 @@ +Added line: 7539 +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "SwitchWithFallthrough", @CanonicalName = "SwitchWithFallthrough", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "SwitchWithFallthrough", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PUBLIC] +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +Added line: 7959 Added line: 2876 +- ClassBody[@Empty = false, @Size = 1] - +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @Name = "myMethod", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- VoidType[] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "a"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "a", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] @@ -16,9 +16,11 @@ Added line: 2876 +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "a", @Name = "a", @ParenthesisDepth = 0, @Parenthesized = false] +- SwitchFallthroughBranch[@Default = false] | +- SwitchLabel[@Default = false, @PatternLabel = false] +Added line: 8600 +Added line: 3571 Added line: 3450 Added line: 3725 | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] +- SwitchFallthroughBranch[@Default = true] Added line: 7601 - +- SwitchLabel[@Default = true, @PatternLabel = false] +Added line: 7822 diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SwitchRules.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SwitchRules.txt index 4eb465db71..c02d98faaf 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SwitchRules.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java14/SwitchRules.txt @@ -12,12 +12,10 @@ | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "TUESDAY"] - | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "TUESDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "2", @IntLiteral = true, @Integral = true, @LiteralText = "2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.0, @ValueAsFloat = 2.0, @ValueAsInt = 2, @ValueAsLong = 2] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL), @ExplicitModifiers = (JModifier.PRIVATE, JModifier.STATIC, JModifier.FINAL)] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] - | +- VariableDeclarator[@Initializer = true, @Name = "WEDNESDAY"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "WEDNESDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "3", @IntLiteral = true, @Integral = true, @LiteralText = "3", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 3.0, @ValueAsFloat = 3.0, @ValueAsInt = 3, @ValueAsLong = 3] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = true, @Visibility = Visibility.V_PRIVATE] @@ -45,6 +43,7 @@ | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "SUNDAY", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = true, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_PRIVATE] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "7", @IntLiteral = true, @Integral = true, @LiteralText = "7", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 7.0, @ValueAsFloat = 7.0, @ValueAsInt = 7, @ValueAsLong = 7] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] +Added line: 2419 +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] @@ -54,6 +53,7 @@ | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] | | +- ArrayTypeDim[@Varargs = false] +Added line: 6664 | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 2, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -73,12 +73,14 @@ | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] +Added line: 4318 | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = " 6", @Empty = false, @Image = "\" 6\"", @Length = 3, @LiteralText = "\" 6\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- SwitchArrowBranch[@Default = false] | +- SwitchLabel[@Default = false, @PatternLabel = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = true, @Image = "TUESDAY", @Name = "TUESDAY", @ParenthesisDepth = 0, @Parenthesized = false] | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 6981 | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/NonSealedIdentifier.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/NonSealedIdentifier.txt index 5a2224d96f..387f34278d 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/NonSealedIdentifier.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/NonSealedIdentifier.txt @@ -1,9 +1,9 @@ +- CompilationUnit[@PackageName = ""] - +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "NonSealedIdentifier", @CanonicalName = "NonSealedIdentifier", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "NonSealedIdentifier", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PUBLIC] +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] - +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] +Added line: 9372 +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +Added line: 7390 +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] @@ -13,32 +13,36 @@ Added line: 4565 | | +- ArrayDimensions[@Empty = false, @Size = 1] | | +- ArrayTypeDim[@Varargs = false] +Added line: 3469 | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 5, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +Added line: 8178 | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "result"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "result", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] +Added line: 1291 +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] +Added line: 234 +Added line: 3992 Added line: 9928 | +- VariableDeclarator[@Initializer = true, @Name = "non"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "non", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] - +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +Added line: 7983 | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] - | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | +- VariableDeclarator[@Initializer = true, @Name = "sealed"] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "2", @IntLiteral = true, @Integral = true, @LiteralText = "2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.0, @ValueAsFloat = 2.0, @ValueAsInt = 2, @ValueAsLong = 2] - +- ExpressionStatement[] | +- AssignmentExpression[@CompileTimeConstant = false, @Compound = false, @Operator = AssignmentOp.ASSIGN, @ParenthesisDepth = 0, @Parenthesized = false] - | +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "result", @Name = "result", @ParenthesisDepth = 0, @Parenthesized = false] | +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.SUB, @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 2653 | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "non", @Name = "non", @ParenthesisDepth = 0, @Parenthesized = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "sealed", @Name = "sealed", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 6461 +- ExpressionStatement[] Added line: 9615 +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/TextBlocks.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/TextBlocks.txt index 1f5b2d9c1b..78b99b1812 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/TextBlocks.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java15/TextBlocks.txt @@ -7,7 +7,6 @@ +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] - +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] @@ -17,7 +16,6 @@ | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] +- ThrowsList[@Empty = false, @Size = 1] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Exception"] - +- Block[@Empty = false, @Size = 25, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] @@ -36,12 +34,14 @@ | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "query"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "query", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] +Added line: 297 | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "SELECT `EMP_ID`, `LAST_NAME` FROM `EMPLOYEE_TB`\nWHERE `CITY` = \'INDIANAPOLIS\'\nORDER BY `EMP_ID`, `LAST_NAME`;\n", @Empty = false, @Image = "\"\"\"\n SELECT `EMP_ID`, `LAST_NAME` FROM `EMPLOYEE_TB`\n WHERE `CITY` = \'INDIANAPOLIS\'\n ORDER BY `EMP_ID`, `LAST_NAME`;\n \"\"\"", @Length = 110, @LiteralText = "\"\"\"\n SELECT `EMP_ID`, `LAST_NAME` FROM `EMPLOYEE_TB`\n WHERE `CITY` = \'INDIANAPOLIS\'\n ORDER BY `EMP_ID`, `LAST_NAME`;\n \"\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = true] +- ExpressionStatement[] | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] +Added line: 9481 | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "query", @Name = "query", @ParenthesisDepth = 0, @Parenthesized = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] @@ -123,12 +123,13 @@ Added line: 1891 | +- VariableDeclarator[@Initializer = true, @Name = "normalStringLiteral"] | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "normalStringLiteral", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "test", @Empty = false, @Image = "\"test\"", @Length = 4, @LiteralText = "\"test\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +Added line: 4657 +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "code"] +Added line: 4039 | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "code", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] - | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "String text = \"\"\"\n A text block inside a text block\n\"\"\";\n", @Empty = false, @Image = "\"\"\"\n String text = \\\"\"\"\n A text block inside a text block\n \\\"\"\";\n \"\"\"", @Length = 60, @LiteralText = "\"\"\"\n String text = \\\"\"\"\n A text block inside a text block\n \\\"\"\";\n \"\"\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] @@ -171,6 +172,7 @@ Added line: 2544 | +- ArgumentList[@Empty = false, @Size = 1] Added line: 7794 | +- MethodCall[@CompileTimeConstant = false, @Image = "replaceAll", @MethodName = "replaceAll", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 7814 | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "emptyLine", @Name = "emptyLine", @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = false, @Size = 2] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "\n", @Empty = false, @Image = "\"\\n\"", @Length = 1, @LiteralText = "\"\\n\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Point.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Point.txt index 3ee1eed248..69c46693e0 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Point.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java16/Point.txt @@ -4,7 +4,6 @@ +- RecordComponentList[@Empty = false, @Size = 2, @Varargs = false] | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] - | | +- PrimitiveType[@Kind = PrimitiveTypeKind.INT] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "x", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_PRIVATE] | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] @@ -13,7 +12,6 @@ +- RecordBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] - +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] @@ -21,6 +19,7 @@ | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] | | +- ArrayTypeDim[@Varargs = false] +Added line: 2375 | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] +- Block[@Empty = false, @Size = 2, @containsComment = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] @@ -32,13 +31,16 @@ | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Point"] | +- ArgumentList[@Empty = false, @Size = 2] | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "1", @IntLiteral = true, @Integral = true, @LiteralText = "1", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 1.0, @ValueAsFloat = 1.0, @ValueAsInt = 1, @ValueAsLong = 1] +Added line: 9696 | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "2", @IntLiteral = true, @Integral = true, @LiteralText = "2", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 2.0, @ValueAsFloat = 2.0, @ValueAsInt = 2, @ValueAsLong = 2] +Added line: 6629 +- ExpressionStatement[] +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 7706 +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] +Added line: 4380 +- ArgumentList[@Empty = false, @Size = 1] +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.ADD, @ParenthesisDepth = 0, @Parenthesized = false] +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "p = ", @Empty = false, @Image = "\"p = \"", @Length = 4, @LiteralText = "\"p = \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] - +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "p", @Name = "p", @ParenthesisDepth = 0, @Parenthesized = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.txt index 1a9bd382b4..e095f7c6a6 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/LocalVars.txt @@ -8,16 +8,18 @@ +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 2, @containsComment = true] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] +Added line: 7671 | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] - | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "sealed"] +Added line: 9473 +Added line: 5178 | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "sealed", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] +- ExpressionStatement[] +- AssignmentExpression[@CompileTimeConstant = false, @Compound = false, @Operator = AssignmentOp.ASSIGN, @ParenthesisDepth = 0, @Parenthesized = false] +- VariableAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "sealed", @Name = "sealed", @ParenthesisDepth = 0, @Parenthesized = false] - +- MethodCall[@CompileTimeConstant = false, @Image = "getName", @MethodName = "getName", @ParenthesisDepth = 0, @Parenthesized = false] +- MethodCall[@CompileTimeConstant = false, @Image = "getClass", @MethodName = "getClass", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 7828 | +- ThisExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = true, @Size = 0] +- ArgumentList[@Empty = true, @Size = 0] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.txt index 3e1359f3ea..2a58c801dc 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java17/geometry/Shape.txt @@ -1,10 +1,12 @@ +Added line: 2547 +Added line: 4162 +- CompilationUnit[@PackageName = "com.example.geometry"] - +- PackageDeclaration[@Name = "com.example.geometry"] +Added line: 8359 +Added line: 4504 | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "com.example.geometry.Shape", @CanonicalName = "com.example.geometry.Shape", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "com.example.geometry", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "Shape", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PUBLIC] - +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.SEALED), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.SEALED)] +- PermitsList[@Empty = false, @Size = 3] - | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Circle"] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Rectangle"] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Square"] +- ClassBody[@Empty = true, @Size = 0] +Added line: 5850 diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/AnnotationValueInitializers.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/AnnotationValueInitializers.txt index 9f95fc329d..f605b16b11 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/AnnotationValueInitializers.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/AnnotationValueInitializers.txt @@ -1,23 +1,25 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "AnnotationValueInitializers", @CanonicalName = "AnnotationValueInitializers", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "AnnotationValueInitializers", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PACKAGE] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +Added line: 592 | | +- Annotation[@SimpleName = "MyAnnotation"] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "MyAnnotation"] +Added line: 9374 | | +- AnnotationMemberList[@Empty = false, @Size = 2] | | +- MemberValuePair[@Image = "a", @Name = "a", @Shorthand = false] - | | | +- MemberValueArrayInitializer[] +Added line: 4717 | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "a", @Empty = false, @Image = "\"a\"", @Length = 1, @LiteralText = "\"a\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- MemberValuePair[@Image = "b", @Name = "b", @Shorthand = false] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "b", @Empty = false, @Image = "\"b\"", @Length = 1, @LiteralText = "\"b\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "AnnotationValueInitializers2", @CanonicalName = "AnnotationValueInitializers2", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "AnnotationValueInitializers2", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PACKAGE] - +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] - | +- Annotation[@SimpleName = "MyAnnotation"] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "MyAnnotation"] | +- AnnotationMemberList[@Empty = false, @Size = 2] | +- MemberValuePair[@Image = "a", @Name = "a", @Shorthand = false] | | +- MemberValueArrayInitializer[] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "a", @Empty = false, @Image = "\"a\"", @Length = 1, @LiteralText = "\"a\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +Added line: 4010 | +- MemberValuePair[@Image = "b", @Name = "b", @Shorthand = false] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "#b", @Empty = false, @Image = "\"#b\"", @Length = 2, @LiteralText = "\"#b\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +Added line: 9433 +- ClassBody[@Empty = true, @Size = 0] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/DealingWithNull.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/DealingWithNull.txt index 92c6c72088..b46792cbc8 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/DealingWithNull.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/DealingWithNull.txt @@ -65,6 +65,7 @@ Added line: 8755 | | +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.ADD, @ParenthesisDepth = 0, @Parenthesized = false] | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "String: ", @Empty = false, @Image = "\"String: \"", @Length = 8, @LiteralText = "\"String: \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 7852 | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false, @PatternLabel = false] | | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] @@ -97,6 +98,7 @@ Added line: 8755 | | +- SwitchLabel[@Default = false, @PatternLabel = true] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +Added line: 4747 | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -133,7 +135,6 @@ Added line: 3935 | | +- ThrowStatement[] | | +- ConstructorCall[@AnonymousClass = false, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "NullPointerException"] - | | +- ArgumentList[@Empty = true, @Size = 0] | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false, @PatternLabel = true] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] @@ -142,6 +143,7 @@ Added line: 8076 | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 8993 | | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] @@ -160,7 +162,6 @@ Added line: 8076 | | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] | | +- ArgumentList[@Empty = false, @Size = 1] - | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Integer", @Empty = false, @Image = "\"Integer\"", @Length = 7, @LiteralText = "\"Integer\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- SwitchArrowBranch[@Default = true] | +- SwitchLabel[@Default = true, @PatternLabel = false] | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -250,6 +251,7 @@ Added line: 1717 | +- SwitchStatement[@DefaultCase = true, @EnumSwitch = false, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = true] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "o", @Name = "o", @ParenthesisDepth = 0, @Parenthesized = false] | | +- SwitchFallthroughBranch[@Default = false] +Added line: 2350 | | | +- SwitchLabel[@Default = false, @PatternLabel = false] | | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | | +- SwitchFallthroughBranch[@Default = true] @@ -299,6 +301,7 @@ Added line: 1717 | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] | +- CatchClause[] | +- CatchParameter[@EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Multicatch = false, @Name = "e", @Visibility = Visibility.V_PACKAGE] +Added line: 7734 | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "NullPointerException"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = true, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "e", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_PACKAGE] @@ -345,5 +348,4 @@ Added line: 9839 | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] +- ExpressionStatement[] +- MethodCall[@CompileTimeConstant = false, @Image = "testStringOrNull", @MethodName = "testStringOrNull", @ParenthesisDepth = 0, @Parenthesized = false] - +- ArgumentList[@Empty = false, @Size = 1] +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "some string", @Empty = false, @Image = "\"some string\"", @Length = 11, @LiteralText = "\"some string\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/GuardedPatterns.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/GuardedPatterns.txt index e9ec43cda3..c50eb46388 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/GuardedPatterns.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/GuardedPatterns.txt @@ -69,11 +69,11 @@ | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "default case", @Empty = false, @Image = "\"default case\"", @Length = 12, @LiteralText = "\"default case\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +Added line: 8616 +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "testIdentifierWhen", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] - | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "when", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] @@ -81,6 +81,7 @@ | +- ExpressionStatement[] | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 4162 | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] | +- ArgumentList[@Empty = false, @Size = 1] @@ -118,6 +119,7 @@ | +- SwitchStatement[@DefaultCase = true, @EnumSwitch = false, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "o", @Name = "o", @ParenthesisDepth = 0, @Parenthesized = false] | +- SwitchArrowBranch[@Default = false] +Added line: 2806 | | +- SwitchLabel[@Default = false, @PatternLabel = true] | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] @@ -177,6 +179,7 @@ | +- SwitchArrowBranch[@Default = true] | +- SwitchLabel[@Default = true, @PatternLabel = false] | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 2350 | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] @@ -184,6 +187,7 @@ | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "default case", @Empty = false, @Image = "\"default case\"", @Length = 12, @LiteralText = "\"default case\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "instanceOfPattern", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] +Added line: 4185 | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] @@ -303,11 +307,9 @@ +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] - +- FormalParameters[@Empty = false, @Size = 1] | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] - | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | | +- ArrayDimensions[@Empty = false, @Size = 1] | | +- ArrayTypeDim[@Varargs = false] | +- VariableId[@ArrayType = true, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "args", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RecordPatternsExhaustiveSwitch.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RecordPatternsExhaustiveSwitch.txt index 3e483b4a72..86fba55241 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RecordPatternsExhaustiveSwitch.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RecordPatternsExhaustiveSwitch.txt @@ -1,6 +1,7 @@ +- CompilationUnit[@PackageName = ""] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatternsExhaustiveSwitch", @CanonicalName = "RecordPatternsExhaustiveSwitch", @EffectiveVisibility = Visibility.V_PUBLIC, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = false, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "RecordPatternsExhaustiveSwitch", @Static = false, @TopLevel = true, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PUBLIC] +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +Added line: 3640 +- ClassBody[@Empty = false, @Size = 7] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatternsExhaustiveSwitch$A", @CanonicalName = "RecordPatternsExhaustiveSwitch.A", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = false, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "A", @Static = false, @TopLevel = false, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PACKAGE] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] @@ -14,7 +15,6 @@ | +- ModifierList[@EffectiveModifiers = (JModifier.SEALED, JModifier.ABSTRACT, JModifier.STATIC), @ExplicitModifiers = (JModifier.SEALED)] | +- PermitsList[@Empty = false, @Size = 2] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "C"] - | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "D"] | +- ClassBody[@Empty = true, @Size = 0] +- ClassDeclaration[@Abstract = false, @Annotation = false, @Anonymous = false, @BinaryName = "RecordPatternsExhaustiveSwitch$C", @CanonicalName = "RecordPatternsExhaustiveSwitch.C", @EffectiveVisibility = Visibility.V_PACKAGE, @Enum = false, @Final = true, @Interface = false, @Local = false, @Nested = true, @PackageName = "", @Record = false, @RegularClass = true, @RegularInterface = false, @SimpleName = "C", @Static = false, @TopLevel = false, @UnnamedToplevelClass = false, @Visibility = Visibility.V_PACKAGE] | +- ModifierList[@EffectiveModifiers = (JModifier.FINAL), @ExplicitModifiers = (JModifier.FINAL)] @@ -128,15 +128,16 @@ Added line: 2319 | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "exhaustive now", @Empty = false, @Image = "\"exhaustive now\"", @Length = 14, @LiteralText = "\"exhaustive now\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- SwitchStatement[@DefaultCase = false, @EnumSwitch = false, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = false] - | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "p2", @Name = "p2", @ParenthesisDepth = 0, @Parenthesized = false] | +- SwitchArrowBranch[@Default = false] Added line: 7335 | | +- SwitchLabel[@Default = false, @PatternLabel = true] +Added line: 3145 | | | +- RecordPattern[] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Pair"] | | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "I"] | | | +- PatternList[@Empty = false, @Size = 2] +Added line: 2105 | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "I"] | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "i", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] @@ -177,13 +178,13 @@ Added line: 7335 | +- SwitchLabel[@Default = false, @PatternLabel = true] | | +- RecordPattern[] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Pair"] - | | | +- TypeArguments[@Diamond = false, @Empty = false, @Size = 1] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "I"] | | +- PatternList[@Empty = false, @Size = 2] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "C"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] +Added line: 7319 | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] Added line: 1794 | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] @@ -206,6 +207,7 @@ Added line: 1794 | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "D"] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "d", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] +Added line: 4282 | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "C"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "c", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RefiningPatternsInSwitch.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RefiningPatternsInSwitch.txt index 8090943eaf..7f072fdff9 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RefiningPatternsInSwitch.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java21/RefiningPatternsInSwitch.txt @@ -14,6 +14,7 @@ | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- ExtendsList[@Empty = false, @Size = 1] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Shape"] +Added line: 3397 | +- ClassBody[@Empty = false, @Size = 3] | +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PRIVATE, @Static = false, @Visibility = Visibility.V_PRIVATE] | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] @@ -30,6 +31,7 @@ | | +- Block[@Empty = false, @Size = 1, @containsComment = false] | | +- ExpressionStatement[] | | +- AssignmentExpression[@CompileTimeConstant = false, @Compound = false, @Operator = AssignmentOp.ASSIGN, @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 7471 | | +- FieldAccess[@AccessType = AccessType.WRITE, @CompileTimeConstant = false, @Image = "area", @Name = "area", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ThisExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "area", @Name = "area", @ParenthesisDepth = 0, @Parenthesized = false] @@ -67,6 +69,7 @@ | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "t", @Name = "t", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- ArgumentList[@Empty = true, @Size = 0] | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "100", @IntLiteral = true, @Integral = true, @LiteralText = "100", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 100.0, @ValueAsFloat = 100.0, @ValueAsInt = 100, @ValueAsLong = 100] +Added line: 7055 | | +- Block[@Empty = false, @Size = 2, @containsComment = false] | | +- ExpressionStatement[] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] @@ -131,13 +134,13 @@ | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = false, @Size = 1] - | | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Shape"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = true, @LambdaParameter = false, @LocalVariable = false, @Name = "s", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | +- Block[@Empty = false, @Size = 1, @containsComment = false] | +- SwitchStatement[@DefaultCase = true, @EnumSwitch = false, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "s", @Name = "s", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 8375 | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false, @PatternLabel = false] | | | +- NullLiteral[@CompileTimeConstant = false, @LiteralText = "null", @ParenthesisDepth = 0, @Parenthesized = false] @@ -160,6 +163,7 @@ | | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] | | +- ArgumentList[@Empty = false, @Size = 1] +Added line: 9688 | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Large triangle", @Empty = false, @Image = "\"Large triangle\"", @Length = 14, @LiteralText = "\"Large triangle\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | +- SwitchArrowBranch[@Default = false] | | +- SwitchLabel[@Default = false, @PatternLabel = true] @@ -197,7 +201,6 @@ | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Triangle"] | +- VariableDeclarator[@Initializer = true, @Name = "large"] - | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "large", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | +- ConstructorCall[@AnonymousClass = false, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Triangle"] | +- ArgumentList[@Empty = false, @Size = 1] @@ -218,7 +221,6 @@ | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "rect", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | +- ConstructorCall[@AnonymousClass = false, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Rectangle"] - | +- ArgumentList[@Empty = true, @Size = 0] +- ExpressionStatement[] | +- MethodCall[@CompileTimeConstant = false, @Image = "testTriangle", @MethodName = "testTriangle", @ParenthesisDepth = 0, @Parenthesized = false] | +- ArgumentList[@Empty = false, @Size = 1] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt index 06b6a2128c..fdcfa66286 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22/Jep456_UnnamedPatternsAndVariables.txt @@ -86,7 +86,6 @@ | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] | | +- ArgumentList[@Empty = false, @Size = 1] | | +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.ADD, @ParenthesisDepth = 0, @Parenthesized = false] - | | +- InfixExpression[@CompileTimeConstant = false, @Operator = BinaryOp.ADD, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "x", @MethodName = "x", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "p", @Name = "p", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- ArgumentList[@Empty = true, @Size = 0] @@ -156,6 +155,7 @@ | | +- RecordComponent[@EffectiveVisibility = Visibility.V_PRIVATE, @Varargs = false, @Visibility = Visibility.V_PRIVATE] | | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE, JModifier.FINAL), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "T"] +Added line: 7435 | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "content", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "unnamedPatterns2", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] @@ -179,6 +179,7 @@ | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "RedBall"] | | +- ArgumentList[@Empty = true, @Size = 0] | +- SwitchStatement[@DefaultCase = false, @EnumSwitch = false, @ExhaustiveEnumSwitch = false, @FallthroughSwitch = false] +Added line: 5000 | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "b", @Name = "b", @ParenthesisDepth = 0, @Parenthesized = false] | | +- SwitchArrowBranch[@Default = false] | | | +- SwitchLabel[@Default = false, @PatternLabel = true] @@ -187,10 +188,13 @@ | | | | +- PatternList[@Empty = false, @Size = 1] | | | | +- TypePattern[@EffectiveVisibility = Visibility.V_PACKAGE, @Visibility = Visibility.V_PACKAGE] | | | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +Added line: 6150 | | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "RedBall"] +Added line: 1544 | | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "_", @PatternBinding = true, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = true, @Visibility = Visibility.V_LOCAL] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "processBox", @MethodName = "processBox", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ArgumentList[@Empty = false, @Size = 1] +Added line: 4648 | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "b", @Name = "b", @ParenthesisDepth = 0, @Parenthesized = false] | | +- SwitchArrowBranch[@Default = false] | | | +- SwitchLabel[@Default = false, @PatternLabel = true] @@ -309,7 +313,6 @@ +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "stopProcessing", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] | +- VoidType[] - | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = true, @Size = 0, @containsComment = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PRIVATE, @Final = false, @Name = "pickAnotherBox", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PRIVATE, @Void = true] | +- ModifierList[@EffectiveModifiers = (JModifier.PRIVATE), @ExplicitModifiers = (JModifier.PRIVATE)] @@ -400,7 +403,6 @@ | | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] | | +- ArgumentList[@Empty = false, @Size = 1] - | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "i", @Name = "i", @ParenthesisDepth = 0, @Parenthesized = false] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Queue"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep459_StringTemplates.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep459_StringTemplates.txt index 2b3ec3f7d5..2b3fe88546 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep459_StringTemplates.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java22p/Jep459_StringTemplates.txt @@ -24,6 +24,7 @@ | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PRIVATE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "ipAddress", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_PRIVATE] | +- RecordBody[@Empty = true, @Size = 0] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @Name = "STRTemplateProcessor", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] +Added line: 1162 | +- ModifierList[@EffectiveModifiers = (JModifier.STATIC), @ExplicitModifiers = (JModifier.STATIC)] | +- VoidType[] | +- FormalParameters[@Empty = true, @Size = 0] @@ -73,6 +74,7 @@ | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "10", @IntLiteral = true, @Integral = true, @LiteralText = "10", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 10.0, @ValueAsFloat = 10.0, @ValueAsInt = 10, @ValueAsLong = 10] | | +- VariableDeclarator[@Initializer = true, @Name = "y"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "y", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] +Added line: 3053 | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "20", @IntLiteral = true, @Integral = true, @LiteralText = "20", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 20.0, @ValueAsFloat = 20.0, @ValueAsInt = 20, @ValueAsLong = 20] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] @@ -121,6 +123,7 @@ | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "t", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | | +- TemplateExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false, @StringTemplate = true] | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "STR", @Name = "STR", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 8021 | | +- Template[] | | +- TemplateFragment[@Content = "\"Access at \\{"] | | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "date", @Name = "date", @ParenthesisDepth = 0, @Parenthesized = false] @@ -193,7 +196,6 @@ | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "STR", @Name = "STR", @ParenthesisDepth = 0, @Parenthesized = false] | | +- Template[] | | +- TemplateFragment[@Content = "\"The time is \\{"] - | | +- MethodCall[@CompileTimeConstant = false, @Image = "format", @MethodName = "format", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- MethodCall[@CompileTimeConstant = false, @Image = "ofPattern", @MethodName = "ofPattern", @ParenthesisDepth = 0, @Parenthesized = false] | | | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "DateTimeFormatter"] @@ -453,6 +455,7 @@ Added line: 5032 | | | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "zone", @Name = "zone", @ParenthesisDepth = 0, @Parenthesized = false] | | | +- NumericLiteral[@Base = 10, @CompileTimeConstant = true, @DoubleLiteral = false, @FloatLiteral = false, @Image = "0", @IntLiteral = true, @Integral = true, @LiteralText = "0", @LongLiteral = false, @ParenthesisDepth = 0, @Parenthesized = false, @ValueAsDouble = 0.0, @ValueAsFloat = 0.0, @ValueAsInt = 0, @ValueAsLong = 0] | | +- ArgumentList[@Empty = true, @Size = 0] +Added line: 1838 | +- TemplateFragment[@Content = "}\n \\{"] | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "name", @Name = "name", @ParenthesisDepth = 0, @Parenthesized = false] | | +- ArrayAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] @@ -537,7 +540,6 @@ Added line: 855 | | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] | | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = true, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "height", @PatternBinding = false, @RecordComponent = true, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_PRIVATE] | | +- RecordBody[@Empty = false, @Size = 1] - | | +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Name = "area", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = false] Added line: 7908 | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- PrimitiveType[@Kind = PrimitiveTypeKind.DOUBLE] @@ -550,6 +552,7 @@ Added line: 7908 | +- EmptyStatement[] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +Added line: 2011 | | +- ArrayType[@ArrayDepth = 1] | | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Rectangle"] | | | +- ArrayDimensions[@Empty = false, @Size = 1] @@ -725,7 +728,6 @@ Added line: 7504 | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 3, @containsComment = true] | +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] - | | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | | +- VariableDeclarator[@Initializer = true, @Name = "s1"] | | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "s1", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java23p/Jep476_ModuleImportDeclarations.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java23p/Jep476_ModuleImportDeclarations.txt index 8fd7fa761c..4d9c0bf131 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java23p/Jep476_ModuleImportDeclarations.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java23p/Jep476_ModuleImportDeclarations.txt @@ -6,9 +6,11 @@ +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC), @ExplicitModifiers = (JModifier.PUBLIC)] +- ClassBody[@Empty = false, @Size = 1] +- MethodDeclaration[@Abstract = false, @Arity = 1, @EffectiveVisibility = Visibility.V_PUBLIC, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = true, @Varargs = false, @Visibility = Visibility.V_PUBLIC, @Void = true] +Added line: 8461 +- ModifierList[@EffectiveModifiers = (JModifier.PUBLIC, JModifier.STATIC), @ExplicitModifiers = (JModifier.PUBLIC, JModifier.STATIC)] +- VoidType[] +- FormalParameters[@Empty = false, @Size = 1] +Added line: 9916 | +- FormalParameter[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @Varargs = false, @Visibility = Visibility.V_LOCAL] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ArrayType[@ArrayDepth = 1] @@ -24,7 +26,6 @@ | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_LOCAL, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = false, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = true, @Name = "f", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_LOCAL] | +- ConstructorCall[@AnonymousClass = false, @CompileTimeConstant = false, @DiamondTypeArgs = false, @MethodName = "new", @ParenthesisDepth = 0, @Parenthesized = false, @QualifiedInstanceCreation = false] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "File"] - | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = ".", @Empty = false, @Image = "\".\"", @Length = 1, @LiteralText = "\".\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- LocalVariableDeclaration[@EffectiveVisibility = Visibility.V_LOCAL, @Final = false, @TypeInferred = false, @Visibility = Visibility.V_LOCAL] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] @@ -40,6 +41,7 @@ +- ExpressionStatement[] | +- MethodCall[@CompileTimeConstant = false, @Image = "add", @MethodName = "add", @ParenthesisDepth = 0, @Parenthesized = false] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "myList", @Name = "myList", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 8440 | +- ArgumentList[@Empty = false, @Size = 1] | +- VariableAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "f", @Name = "f", @ParenthesisDepth = 0, @Parenthesized = false] +- ExpressionStatement[] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java23p/Jep477_ImplicitlyDeclaredClassesAndInstanceMainMethods2.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java23p/Jep477_ImplicitlyDeclaredClassesAndInstanceMainMethods2.txt index 61df683d8c..c2620dfe0a 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java23p/Jep477_ImplicitlyDeclaredClassesAndInstanceMainMethods2.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java23p/Jep477_ImplicitlyDeclaredClassesAndInstanceMainMethods2.txt @@ -9,13 +9,12 @@ | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | +- FormalParameters[@Empty = true, @Size = 0] | +- Block[@Empty = false, @Size = 1, @containsComment = false] - | +- ReturnStatement[] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Hello, World! (method)", @Empty = false, @Image = "\"Hello, World! (method)\"", @Length = 22, @LiteralText = "\"Hello, World! (method)\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PACKAGE, @Static = false, @Visibility = Visibility.V_PACKAGE] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "String"] | +- VariableDeclarator[@Initializer = true, @Name = "greetingText"] - | +- VariableId[@ArrayType = false, @EffectiveVisibility = Visibility.V_PACKAGE, @EnumConstant = false, @ExceptionBlockParameter = false, @Field = true, @Final = false, @ForLoopVariable = false, @ForeachVariable = false, @FormalParameter = false, @LambdaParameter = false, @LocalVariable = false, @Name = "greetingText", @PatternBinding = false, @RecordComponent = false, @ResourceDeclaration = false, @Static = false, @TypeInferred = false, @Unnamed = false, @Visibility = Visibility.V_PACKAGE] +Added line: 7339 | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "Hello, World! (text)", @Empty = false, @Image = "\"Hello, World! (text)\"", @Length = 20, @LiteralText = "\"Hello, World! (text)\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- FieldDeclaration[@EffectiveVisibility = Visibility.V_PACKAGE, @Static = false, @Visibility = Visibility.V_PACKAGE] | +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] @@ -32,19 +31,22 @@ | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "World!", @Empty = false, @Image = "\"World!\"", @Length = 6, @LiteralText = "\"World!\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = "(with imports)", @Empty = false, @Image = "\"(with imports)\"", @Length = 14, @LiteralText = "\"(with imports)\"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] | | +- ArgumentList[@Empty = true, @Size = 0] +Added line: 1922 | +- ArgumentList[@Empty = false, @Size = 1] +Added line: 1043 | +- MethodCall[@CompileTimeConstant = false, @Image = "joining", @MethodName = "joining", @ParenthesisDepth = 0, @Parenthesized = false] | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "Collectors"] | +- ArgumentList[@Empty = false, @Size = 1] | +- StringLiteral[@CompileTimeConstant = true, @ConstValue = ", ", @Empty = false, @Image = "\", \"", @Length = 2, @LiteralText = "\", \"", @ParenthesisDepth = 0, @Parenthesized = false, @TextBlock = false] +- MethodDeclaration[@Abstract = false, @Arity = 0, @EffectiveVisibility = Visibility.V_PACKAGE, @Final = false, @MainMethod = true, @Name = "main", @Overridden = false, @Static = false, @Varargs = false, @Visibility = Visibility.V_PACKAGE, @Void = true] - +- ModifierList[@EffectiveModifiers = (), @ExplicitModifiers = ()] +- VoidType[] +- FormalParameters[@Empty = true, @Size = 0] +- Block[@Empty = false, @Size = 3, @containsComment = false] +- ExpressionStatement[] | +- MethodCall[@CompileTimeConstant = false, @Image = "println", @MethodName = "println", @ParenthesisDepth = 0, @Parenthesized = false] +Added line: 4485 +Added line: 6975 | +- FieldAccess[@AccessType = AccessType.READ, @CompileTimeConstant = false, @Image = "out", @Name = "out", @ParenthesisDepth = 0, @Parenthesized = false] | | +- TypeExpression[@CompileTimeConstant = false, @ParenthesisDepth = 0, @Parenthesized = false] | | +- ClassType[@FullyQualified = false, @PackageQualifier = null, @SimpleName = "System"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java9/jdk9_module_info.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java9/jdk9_module_info.txt index f66cf45b11..ded66a2a8b 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java9/jdk9_module_info.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/ast/jdkversiontests/java9/jdk9_module_info.txt @@ -1,11 +1,11 @@ +- CompilationUnit[@PackageName = ""] +Added line: 8515 +- ModuleDeclaration[@Name = "com.example.foo", @Open = true] +- ModuleName[@Name = "com.example.foo"] - +- ModuleRequiresDirective[@Static = false, @Transitive = false] | +- ModuleName[@Name = "com.example.foo.http"] - +- ModuleRequiresDirective[@Static = false, @Transitive = false] | +- ModuleName[@Name = "java.logging"] +- ModuleRequiresDirective[@Static = false, @Transitive = true] +Added line: 1714 | +- ModuleName[@Name = "com.example.foo.network"] +- ModuleExportsDirective[@PackageName = "com.example.foo.bar"] +- ModuleExportsDirective[@PackageName = "com.example.foo.internal"] @@ -15,7 +15,9 @@ +- ModuleProvidesDirective[] | +- ClassType[@FullyQualified = true, @PackageQualifier = "com.example.foo.spi", @SimpleName = "Intf"] | +- ClassType[@FullyQualified = true, @PackageQualifier = "com.example.foo", @SimpleName = "Impl"] +Added line: 1214 +- ModuleProvidesDirective[] +- ClassType[@FullyQualified = true, @PackageQualifier = "com.example.foo.spi", @SimpleName = "Intf2"] +- ClassType[@FullyQualified = true, @PackageQualifier = "com.example.foo", @SimpleName = "Impl"] - +- ClassType[@FullyQualified = true, @PackageQualifier = "com.example.foo", @SimpleName = "Impl2"] +Added line: 8194 +Added line: 8167 diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/discardedElements_no_ignore_annots.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/discardedElements_no_ignore_annots.txt index 0f94624978..3e19496955 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/discardedElements_no_ignore_annots.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/discardedElements_no_ignore_annots.txt @@ -15,13 +15,16 @@ L22 [{] 5 6 L23 [x] 9 10 +Added line: 3867 [++] 10 12 +Added line: 7247 L24 [(] 12 13 [)] 13 14 L25 [}] 5 6 L28 +Added line: 76 [@] 5 6 [AnnotationWithParams] 6 26 [(] 26 27 @@ -35,12 +38,10 @@ L29 [@] 28 29 [Nested] 29 35 [(] 35 36 - [1] 36 37 [,] 39 40 L30 [@] 28 29 [Nested] 29 35 - [(] 35 36 [2] 36 37 Added line: 8730 [)] 37 38 @@ -49,6 +50,7 @@ L31 [@] 28 29 [Nested] 29 35 L32 +Added line: 1720 Added line: 9857 Added line: 2742 [}] 9 10 @@ -59,7 +61,7 @@ Added line: 8837 [foo] 17 20 [(] 20 21 [)] 21 22 - [{] 23 24 +Added line: 8370 L35 [}] 5 6 L36 diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreLiterals_noignore.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreLiterals_noignore.txt index a02e9c8064..d4fa2da847 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreLiterals_noignore.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreLiterals_noignore.txt @@ -10,23 +10,23 @@ L2 [bar] 17 20 [(] 20 21 [)] 21 22 +Added line: 5605 [{] 23 24 L3 [System] 9 15 [out] 16 19 [.] 19 20 +Added line: 321 +Added line: 800 [(] 27 28 ["hello"] 28 35 [)] 35 36 L4 [System] 9 15 - [.] 15 16 [out] 16 19 - [.] 19 20 [println] 20 27 [(] 27 28 ["hello"] 28 35 - [)] 35 36 L5 [int] 9 12 [i] 13 14 @@ -34,6 +34,7 @@ Added line: 9357 [=] 15 16 [5] 17 18 Added line: 2939 +Added line: 634 L6 Added line: 3131 [System] 9 15 @@ -49,4 +50,5 @@ L8 [}] 5 6 L9 [}] 1 2 +Added line: 530 EOF diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations.txt index db7fa741d4..db4966737f 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations.txt @@ -1,20 +1,22 @@ - [Image] or [Truncated image[ Bcol Ecol +Added line: 7743 L2 Added line: 4941 [@] 1 2 [(] 18 19 [{] 19 20 ["woof"] 20 26 +Added line: 1552 [,] 26 27 Added line: 732 +Added line: 4875 L12 ["CPD-END"] 26 35 [}] 35 36 L13 - [class] 1 6 [Other] 7 12 [{] 13 14 +Added line: 5874 Added line: 6743 Added line: 3193 Added line: 367 -EOF +Added line: 3499 diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations_ignore_annots.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations_ignore_annots.txt index 70ba02ec3a..dfb7479334 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations_ignore_annots.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/ignoreSpecialAnnotations_ignore_annots.txt @@ -1,7 +1,9 @@ [Image] or [Truncated image[ Bcol Ecol -L13 +Added line: 7682 +Added line: 4312 [class] 1 6 [Other] 7 12 +Added line: 5408 [{] 13 14 [}] 14 15 EOF diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/simpleClassWithComments.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/simpleClassWithComments.txt index 552c9950a0..b55ad2b3a3 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/simpleClassWithComments.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/simpleClassWithComments.txt @@ -1,9 +1,13 @@ +Added line: 4437 [Image] or [Truncated image[ Bcol Ecol -L5 - [public] 1 7 +Added line: 5974 +Added line: 5162 +Added line: 1114 +Added line: 1761 +Added line: 6604 [class] 8 13 [Foo] 14 17 [{] 18 19 -L7 +Added line: 1026 +Added line: 1151 [}] 1 2 -EOF diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/specialComments.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/specialComments.txt index 0acb7d24b2..0d80530758 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/specialComments.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/specialComments.txt @@ -1,10 +1,12 @@ [Image] or [Truncated image[ Bcol Ecol L13 [class] 5 10 +Added line: 319 [Foo] 11 14 L14 [class] 5 10 +Added line: 7792 +Added line: 6164 [Foo] 11 14 L19 - [}] 1 2 EOF diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/tabWidth.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/tabWidth.txt index b606eb0db6..0e22aecefb 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/tabWidth.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/cpd/testdata/tabWidth.txt @@ -1,6 +1,7 @@ - [Image] or [Truncated image[ Bcol Ecol +Added line: 1440 +Added line: 5287 +Added line: 8177 L1 - [class] 1 6 [tabWidth] 7 15 [{] 16 17 L2 @@ -8,6 +9,7 @@ L2 [i] 6 7 [=] 8 9 [0] 10 11 -L3 +Added line: 3994 +Added line: 5727 [}] 1 2 EOF diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/types/dumptests/IteratorUtilCopy.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/types/dumptests/IteratorUtilCopy.txt index 3a9a10c620..5a81431fba 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/types/dumptests/IteratorUtilCopy.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/types/dumptests/IteratorUtilCopy.txt @@ -83,6 +83,7 @@ | +- AnonymousClassDeclaration[@TypeMirror = "IteratorUtilCopy$1"] | +- ModifierList[] | +- ClassBody[] +Added line: 7054 | +- MethodDeclaration[@Name = "computeNext"] | +- ModifierList[] | | +- Annotation[@TypeMirror = "java.lang.Override"] @@ -165,6 +166,7 @@ | | | +- VariableId[@Name = "iter", @TypeMirror = "java.util.Iterator"] | | +- FormalParameter[@TypeMirror = "java.util.function.Function>"] | | +- ModifierList[] +Added line: 7848 | | +- ClassType[@TypeMirror = "java.util.function.Function>"] | | | +- TypeArguments[] | | | +- WildcardType[@TypeMirror = "? super T"] @@ -478,8 +480,10 @@ | | +- FormalParameter[@TypeMirror = "java.util.Iterator"] | | | +- ModifierList[] | | | +- ClassType[@TypeMirror = "java.util.Iterator"] +Added line: 5691 | | | | +- TypeArguments[] | | | | +- WildcardType[@TypeMirror = "? extends T"] +Added line: 6616 | | | | +- ClassType[@TypeMirror = "T"] | | | +- VariableId[@Name = "it", @TypeMirror = "java.util.Iterator"] | | +- FormalParameter[@TypeMirror = "java.util.function.Predicate"] @@ -605,6 +609,7 @@ | | +- TypeArguments[] | | +- ClassType[@TypeMirror = "R"] | +- ArgumentList[] +Added line: 8799 | +- AnonymousClassDeclaration[@TypeMirror = "IteratorUtilCopy$6"] | +- ModifierList[] | +- ClassBody[] @@ -833,7 +838,6 @@ | | +- ModifierList[] | | +- ClassType[@TypeMirror = "java.util.Iterator"] | | | +- TypeArguments[] - | | | +- WildcardType[@TypeMirror = "? extends T"] | | | +- ClassType[@TypeMirror = "T"] | | +- VariableId[@Name = "it", @TypeMirror = "java.util.Iterator"] | +- Block[] @@ -1044,6 +1048,7 @@ | | +- PrimitiveType[@TypeMirror = "int"] | | +- VariableId[@Name = "n", @TypeMirror = "int"] | +- Block[] +Added line: 4249 | +- WhileStatement[] | +- InfixExpression[@TypeMirror = "boolean"] | | +- InfixExpression[@TypeMirror = "boolean"] @@ -1091,7 +1096,6 @@ | | | +- ClassType[@TypeMirror = "java.util.Collections"] | | +- ArgumentList[] | +- ReturnStatement[] - | +- ConstructorCall[@Failed = false, @Function = "IteratorUtilCopy$AbstractIterator.new() -> IteratorUtilCopy$AbstractIterator", @MethodName = "new", @TypeMirror = "IteratorUtilCopy$AbstractIterator", @Unchecked = false, @VarargsCall = false] | +- ClassType[@TypeMirror = "IteratorUtilCopy$AbstractIterator"] | | +- TypeArguments[] | | +- ClassType[@TypeMirror = "T"] @@ -1102,7 +1106,6 @@ | +- FieldDeclaration[] | | +- ModifierList[] | | +- PrimitiveType[@TypeMirror = "int"] - | | +- VariableDeclarator[] | | +- VariableId[@Name = "yielded", @TypeMirror = "int"] | | +- NumericLiteral[@TypeMirror = "int"] | +- MethodDeclaration[@Name = "computeNext"] @@ -1142,7 +1145,6 @@ | +- ClassType[@TypeMirror = "java.util.Iterator"] | | +- TypeArguments[] | | +- ClassType[@TypeMirror = "T"] - | +- FormalParameters[] | | +- FormalParameter[@TypeMirror = "java.util.Iterator"] | | | +- ModifierList[] | | | +- ClassType[@TypeMirror = "java.util.Iterator"] @@ -1164,6 +1166,7 @@ | | +- CastExpression[@TypeMirror = "java.util.Iterator"] | | +- ClassType[@TypeMirror = "java.util.Iterator"] | | | +- TypeArguments[] +Added line: 9168 | | | +- ClassType[@TypeMirror = "T"] | | +- VariableAccess[@Name = "source", @TypeMirror = "java.util.Iterator"] | +- ReturnStatement[] @@ -1431,7 +1434,6 @@ | | | +- VariableAccess[@Name = "match", @TypeMirror = "boolean"] | | | +- VariableAccess[@Name = "kindAll", @TypeMirror = "boolean"] | | +- Block[] - | | +- ReturnStatement[] | | +- InfixExpression[@TypeMirror = "boolean"] | | +- VariableAccess[@Name = "kindAny", @TypeMirror = "boolean"] | | +- VariableAccess[@Name = "match", @TypeMirror = "boolean"] @@ -1489,12 +1491,13 @@ | | | | +- ClassType[@TypeMirror = "java.util.NoSuchElementException"] | | | | +- ArgumentList[] | | | +- ExpressionStatement[] +Added line: 7999 | | | | +- AssignmentExpression[@TypeMirror = "boolean"] | | | | +- VariableAccess[@Name = "done", @TypeMirror = "boolean"] | | | | +- BooleanLiteral[@TypeMirror = "boolean"] - | | | +- ReturnStatement[] | | | +- VariableAccess[@Name = "value", @TypeMirror = "T"] | | +- MethodDeclaration[@Name = "forEachRemaining"] +Added line: 8106 | | +- ModifierList[] | | | +- Annotation[@TypeMirror = "java.lang.Override"] | | | +- ClassType[@TypeMirror = "java.lang.Override"] @@ -1816,6 +1819,7 @@ | +- ReturnStatement[] | +- VariableAccess[@Name = "next", @TypeMirror = "T"] +- MethodDeclaration[@Name = "prepareViewOn"] +Added line: 5853 | +- ModifierList[] | +- VoidType[@TypeMirror = "void"] | +- FormalParameters[] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/types/dumptests/NestedLambdasAndMethodCalls.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/types/dumptests/NestedLambdasAndMethodCalls.txt index 9099296ff8..c729da247d 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/types/dumptests/NestedLambdasAndMethodCalls.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/types/dumptests/NestedLambdasAndMethodCalls.txt @@ -3,6 +3,7 @@ | +- ModifierList[] +- ImportDeclaration[] +- ImportDeclaration[] +Added line: 1688 +- ImportDeclaration[] +- ImportDeclaration[] +- ClassDeclaration[@TypeMirror = "org.example.unusedPrivateMethod.NestedLambdasAndMethodCalls"] @@ -49,6 +50,7 @@ | | | +- VariableAccess[@Name = "library", @TypeMirror = "org.example.unusedPrivateMethod.Library"] | | +- ExpressionStatement[] | | +- MethodCall[@Failed = false, @Function = "java.io.PrintStream.println(java.lang.Object) -> void", @MethodName = "println", @TypeMirror = "void", @Unchecked = false, @VarargsCall = false] +Added line: 7649 | | +- FieldAccess[@Name = "out", @TypeMirror = "java.io.PrintStream"] | | | +- TypeExpression[@TypeMirror = "java.lang.System"] | | | +- ClassType[@TypeMirror = "java.lang.System"] @@ -57,7 +59,6 @@ | +- MethodDeclaration[@Name = "run"] | | +- ModifierList[] | | +- ClassType[@TypeMirror = "java.util.Map>"] - | | | +- TypeArguments[] | | | +- ClassType[@TypeMirror = "java.lang.String"] | | | +- ClassType[@TypeMirror = "java.util.Map"] | | | +- TypeArguments[] @@ -73,6 +74,7 @@ | | +- MethodCall[@Failed = false, @Function = "java.util.Optional>>.orElse(java.util.Map>) -> java.util.Map>", @MethodName = "orElse", @TypeMirror = "java.util.Map>", @Unchecked = false, @VarargsCall = false] | | +- MethodCall[@Failed = false, @Function = "java.util.stream.Stream>>.reduce(java.util.function.BinaryOperator>>) -> java.util.Optional>>", @MethodName = "reduce", @TypeMirror = "java.util.Optional>>", @Unchecked = false, @VarargsCall = false] | | | +- MethodCall[@Failed = false, @Function = "java.util.stream.Stream. map(java.util.function.Function>>) -> java.util.stream.Stream>>", @MethodName = "map", @TypeMirror = "java.util.stream.Stream>>", @Unchecked = false, @VarargsCall = false] +Added line: 6466 | | | | +- MethodCall[@Failed = false, @Function = "java.util.Collection.stream() -> java.util.stream.Stream", @MethodName = "stream", @TypeMirror = "java.util.stream.Stream", @Unchecked = false, @VarargsCall = false] | | | | | +- MethodCall[@Failed = false, @Function = "org.example.unusedPrivateMethod.Library.books() -> java.util.Collection", @MethodName = "books", @TypeMirror = "java.util.Collection", @Unchecked = false, @VarargsCall = false] | | | | | | +- VariableAccess[@Name = "library", @TypeMirror = "org.example.unusedPrivateMethod.Library"] @@ -123,6 +125,7 @@ | +- ClassType[@TypeMirror = "java.util.Map>"] | | +- TypeArguments[] | | +- ClassType[@TypeMirror = "java.lang.String"] +Added line: 6740 | | +- ClassType[@TypeMirror = "java.util.Map"] | | +- TypeArguments[] | | +- ClassType[@TypeMirror = "java.lang.String"] @@ -135,6 +138,7 @@ | | | | +- ClassType[@TypeMirror = "java.lang.String"] | | | | +- ClassType[@TypeMirror = "java.util.Map"] | | | | +- TypeArguments[] +Added line: 8935 | | | | +- ClassType[@TypeMirror = "java.lang.String"] | | | | +- ClassType[@TypeMirror = "java.lang.String"] | | | +- VariableId[@Name = "previousMap", @TypeMirror = "java.util.Map>"] @@ -157,7 +161,6 @@ | +- ReturnStatement[] | +- VariableAccess[@Name = "previousMap", @TypeMirror = "java.util.Map>"] +- RecordDeclaration[@TypeMirror = "org.example.unusedPrivateMethod.Lender"] - | +- ModifierList[] | +- RecordComponentList[] | | +- RecordComponent[@TypeMirror = "java.lang.String"] | | | +- ModifierList[] @@ -182,7 +185,6 @@ | | | +- ClassType[@TypeMirror = "org.example.unusedPrivateMethod.Lender"] | | +- VariableId[@Name = "lenders", @TypeMirror = "java.util.Collection"] | +- RecordBody[] - +- RecordDeclaration[@TypeMirror = "org.example.unusedPrivateMethod.Library"] +- ModifierList[] +- RecordComponentList[] | +- RecordComponent[@TypeMirror = "java.util.Collection"] diff --git a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/types/dumptests/UnresolvedThings.txt b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/types/dumptests/UnresolvedThings.txt index 54c8f2ddcd..e51d1f31e0 100644 --- a/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/types/dumptests/UnresolvedThings.txt +++ b/pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/types/dumptests/UnresolvedThings.txt @@ -1,5 +1,4 @@ +- CompilationUnit[] - +- ImportDeclaration[] +- ImportDeclaration[] +- ImportDeclaration[] +- ClassDeclaration[@TypeMirror = "Foo"] @@ -23,6 +22,7 @@ Added line: 57 | | | +- ClassType[@TypeMirror = "*SummaryDto.ItemDto"] | | +- VariableDeclarator[] | | +- VariableId[@Name = "items", @TypeMirror = "java.util.List<*SummaryDto.ItemDto>"] +Added line: 9804 | | +- ConstructorCall[@Failed = false, @Function = "java.util.ArrayList<*SummaryDto.ItemDto>.new() -> java.util.ArrayList<*SummaryDto.ItemDto>", @MethodName = "new", @TypeMirror = "java.util.ArrayList<*SummaryDto.ItemDto>", @Unchecked = false, @VarargsCall = false] | | +- ClassType[@TypeMirror = "java.util.ArrayList"] | | | +- TypeArguments[] @@ -36,7 +36,6 @@ Added line: 57 | | +- MethodCall[@Failed = false, @Function = "java.util.stream.Collectors. groupingBy(java.util.function.Function) -> java.util.stream.Collector<*Item, java.lang.Object, java.util.Map<(*unknown*), java.util.List<*Item>>>", @MethodName = "groupingBy", @TypeMirror = "java.util.stream.Collector<*Item, java.lang.Object, java.util.Map<(*unknown*), java.util.List<*Item>>>", @Unchecked = false, @VarargsCall = false] | | +- TypeExpression[@TypeMirror = "java.util.stream.Collectors"] Added line: 4352 - | | | +- ClassType[@TypeMirror = "java.util.stream.Collectors"] | | +- ArgumentList[] | | +- MethodReference[@TypeMirror = "java.util.function.Function<*Item, (*unknown*)>"] | | +- AmbiguousName[@TypeMirror = "(*unknown*)"] @@ -48,6 +47,7 @@ Added line: 4352 | | | +- VariableId[@Name = "a", @TypeMirror = "(*unknown*)"] | | +- LambdaParameter[@TypeMirror = "java.util.List<*Item>"] Added line: 1219 +Added line: 2699 | | +- ModifierList[] | | +- VariableId[@Name = "b", @TypeMirror = "java.util.List<*Item>"] | +- MethodCall[@Failed = false, @Function = "java.util.List<*SummaryDto.ItemDto>.add(*SummaryDto.ItemDto) -> boolean", @MethodName = "add", @TypeMirror = "boolean", @Unchecked = false, @VarargsCall = false] @@ -60,11 +60,13 @@ Added line: 1219 +- MethodDeclaration[@Name = "buildItem"] +- ModifierList[] +- ClassType[@TypeMirror = "*SummaryDto.ItemDto"] +Added line: 5247 +- FormalParameters[] | +- FormalParameter[@TypeMirror = "*BigDecimal"] | | +- ModifierList[] | | +- ClassType[@TypeMirror = "*BigDecimal"] | | +- VariableId[@Name = "a", @TypeMirror = "*BigDecimal"] +Added line: 2946 | +- FormalParameter[@TypeMirror = "java.util.List<*Item>"] | +- ModifierList[] | +- ClassType[@TypeMirror = "java.util.List<*Item>"] @@ -79,4 +81,4 @@ Added line: 4450 Added line: 2610 | +- AmbiguousName[@TypeMirror = "(*unknown*)"] | +- ArgumentList[] - +- ArgumentList[] +Added line: 3417 diff --git a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/decorators.txt b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/decorators.txt index dcbac109d6..34b51f5f12 100644 --- a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/decorators.txt +++ b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/decorators.txt @@ -9,9 +9,9 @@ Added line: 5736 | +- XmlPropRef | +- Name +- ExpressionStatement - | +- Name +- EmptyStatement +- Comment +Added line: 317 +- ExpressionStatement | +- FunctionCall | +- XmlPropRef @@ -26,6 +26,7 @@ Added line: 5736 +- EmptyStatement +- Comment Added line: 6668 +Added line: 2786 +- ExpressionStatement | +- Assignment | +- Name @@ -33,16 +34,17 @@ Added line: 6668 | +- ObjectLiteral | +- ObjectProperty | | +- Name +Added line: 8761 | | +- StringLiteral | +- ObjectProperty | | +- Name +Added line: 2874 | | +- Name Added line: 7602 | +- ObjectProperty | +- Name | +- StringLiteral Added line: 3090 - | +- FunctionCall | +- PropertyGet | | +- KeywordLiteral | | +- Name diff --git a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/issue3948.txt b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/issue3948.txt index 897cbce9ae..0075f9af85 100644 --- a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/issue3948.txt +++ b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/issue3948.txt @@ -1,9 +1,11 @@ -+- AstRoot +- ExpressionStatement +Added line: 984 +- Assignment +- Name +- ObjectLiteral +Added line: 4386 +- ObjectProperty +- Name +- FunctionNode +Added line: 2401 +- Block diff --git a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/jquery-selector.txt b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/jquery-selector.txt index af964c681f..3b632d1073 100644 --- a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/jquery-selector.txt +++ b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/jquery-selector.txt @@ -505,7 +505,6 @@ | | | | +- ParenthesizedExpression | | | | +- Assignment | | | | +- Name - | | | | +- FunctionCall | | | | +- PropertyGet | | | | | +- Name | | | | | +- Name @@ -1414,7 +1413,6 @@ | | +- StringLiteral | | +- ObjectLiteral | | +- ObjectProperty - | | +- Name | | +- StringLiteral | +- ObjectProperty | | +- Name @@ -1586,7 +1584,6 @@ | | | | | | | +- Name | | | | | | | +- NumberLiteral | | | | | | +- StringLiteral - | | | | | +- Comment | | | | +- IfStatement | | | | +- ElementGet | | | | | +- Name @@ -1605,6 +1602,7 @@ | | +- FunctionNode | | +- Name | | +- Block +Added line: 3702 | | +- VariableDeclaration | | | +- VariableInitializer | | | | +- Name @@ -2397,6 +2395,7 @@ | | | | | | +- Name | | | | | +- ArrayLiteral | | | | | +- Name +Added line: 8947 | | | | | +- Name | | | | +- IfStatement | | | | +- InfixExpression @@ -2460,6 +2459,7 @@ | | | +- Name | | | +- InfixExpression | | | +- StringLiteral +Added line: 198 | | | +- Name | | +- Comment | | +- Comment @@ -4486,6 +4486,7 @@ | | | | | | +- Name | | | | | +- PropertyGet | | | | | +- ElementGet +Added line: 748 | | | | | | +- Name | | | | | | +- Name | | | | | +- Name @@ -5193,6 +5194,7 @@ | | | | +- Name | | | | +- Scope | | | | +- ExpressionStatement +Added line: 1560 | | | | +- Assignment | | | | +- Name | | | | +- PropertyGet diff --git a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/templateStrings.txt b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/templateStrings.txt index 1aae2a7177..e2387c0f5f 100644 --- a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/templateStrings.txt +++ b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/ast/testdata/templateStrings.txt @@ -1,12 +1,14 @@ +- AstRoot +Added line: 7862 +- FunctionNode +Added line: 2130 +- Block +Added line: 7673 +- VariableDeclaration - | +- VariableInitializer | +- Name +Added line: 880 | +- StringLiteral +- VariableDeclaration - +- VariableInitializer +- Name +Added line: 4632 +- TemplateLiteral - +- TemplateCharacters diff --git a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/simpleWithSemis.txt b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/simpleWithSemis.txt index 4d9788509f..4653da191d 100644 --- a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/simpleWithSemis.txt +++ b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/simpleWithSemis.txt @@ -1,14 +1,15 @@ +Added line: 3224 [Image] or [Truncated image[ Bcol Ecol L1 [function] 1 9 [switchToRealPassword] 10 30 [(] 30 31 - [)] 31 32 [{] 33 34 L2 [var] 5 8 [real] 9 13 - [=] 14 15 +Added line: 7642 +Added line: 9057 [$] 16 17 [(] 17 18 ['realPass'] 18 28 @@ -22,10 +23,11 @@ L3 [(] 19 20 ['promptPass'] 20 32 [)] 32 33 +Added line: 1318 [;] 33 34 +Added line: 6893 L4 [real] 5 9 - [.] 9 10 [style] 10 15 [.] 15 16 [display] 16 23 diff --git a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/singleLineCommentIgnore.txt b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/singleLineCommentIgnore.txt index a847f7d298..3d3219fb95 100644 --- a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/singleLineCommentIgnore.txt +++ b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/singleLineCommentIgnore.txt @@ -1,11 +1,13 @@ [Image] or [Truncated image[ Bcol Ecol L3 +Added line: 3170 [var] 1 4 - [i] 5 6 - [=] 7 8 +Added line: 802 [0] 9 10 [;] 10 11 L6 +Added line: 3107 +Added line: 5875 [i] 1 2 [++] 2 4 [;] 4 5 diff --git a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/specialComments.txt b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/specialComments.txt index 9a6ebb9db3..10cdceeed2 100644 --- a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/specialComments.txt +++ b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/specialComments.txt @@ -1,6 +1,8 @@ -Added line: 6974 +Added line: 7113 +Added line: 803 [Image] or [Truncated image[ Bcol Ecol Added line: 1616 Added line: 2373 [}] 1 2 -EOF +Added line: 8619 +Added line: 7641 diff --git a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/tabWidth.txt b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/tabWidth.txt index bbc3ecaa17..09f86c16cf 100644 --- a/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/tabWidth.txt +++ b/pmd-javascript/src/test/resources/net/sourceforge/pmd/lang/ecmascript/cpd/testdata/tabWidth.txt @@ -4,6 +4,7 @@ L1 [switchToRealPassword] 10 30 [(] 30 31 [)] 31 32 +Added line: 5366 [{] 33 34 L2 [var] 2 5 @@ -16,11 +17,12 @@ L2 L3 [var] 2 5 [prompt] 6 12 - [=] 13 14 [$] 15 16 [(] 16 17 +Added line: 5971 ['promptPass'] 17 29 [)] 29 30 +Added line: 9003 L4 [real] 2 6 [.] 6 7 diff --git a/pmd-julia/src/test/resources/net/sourceforge/pmd/lang/julia/cpd/testdata/mathExample.txt b/pmd-julia/src/test/resources/net/sourceforge/pmd/lang/julia/cpd/testdata/mathExample.txt index 4413565ff3..28eefa4c9f 100644 --- a/pmd-julia/src/test/resources/net/sourceforge/pmd/lang/julia/cpd/testdata/mathExample.txt +++ b/pmd-julia/src/test/resources/net/sourceforge/pmd/lang/julia/cpd/testdata/mathExample.txt @@ -3,7 +3,10 @@ L2 [function] 1 9 [sphere_vol] 10 20 [(] 20 21 +Added line: 2015 +Added line: 2719 [r] 21 22 +Added line: 777 [)] 22 23 L5 [return] 3 9 @@ -38,7 +41,6 @@ L9 [2] 47 48 [a] 48 49 L12 - [function] 1 9 [quadratic2] 10 20 [(] 20 21 [a] 21 22 @@ -54,11 +56,11 @@ L12 [Float64] 48 55 [)] 55 56 L15 - [sqr_term] 3 11 +Added line: 688 +Added line: 891 [=] 12 13 [sqrt] 14 18 [(] 18 19 - [b] 19 20 [^] 20 21 [2] 21 22 [-] 22 23 @@ -81,6 +83,7 @@ L16 L17 [r2] 3 5 [=] 6 7 +Added line: 7695 [quadratic] 8 17 [(] 17 18 [a] 18 19 @@ -90,19 +93,18 @@ L17 [,] 30 31 [b] 32 33 [)] 33 34 -L20 [r1] 3 5 [,] 5 6 [r2] 7 9 L21 +Added line: 8767 [end] 1 4 L23 - [vol] 1 4 [=] 5 6 - [sphere_vol] 7 17 [(] 17 18 [3] 18 19 [)] 19 20 +Added line: 4647 L25 [using] 1 6 [Printf] 7 13 @@ -119,6 +121,7 @@ L29 [quadratic2] 16 26 [(] 26 27 [2.0] 27 30 +Added line: 9864 [,] 30 31 [-] 32 33 [2.0] 33 36 @@ -137,6 +140,7 @@ L32 [println] 1 8 [(] 8 9 ["result 2: "] 9 21 +Added line: 1028 [,] 21 22 [quad2] 23 28 [)] 28 29 diff --git a/pmd-kotlin/src/test/resources/net/sourceforge/pmd/lang/kotlin/cpd/testdata/tabWidth.txt b/pmd-kotlin/src/test/resources/net/sourceforge/pmd/lang/kotlin/cpd/testdata/tabWidth.txt index ff0f4c69da..50a5d28d3c 100644 --- a/pmd-kotlin/src/test/resources/net/sourceforge/pmd/lang/kotlin/cpd/testdata/tabWidth.txt +++ b/pmd-kotlin/src/test/resources/net/sourceforge/pmd/lang/kotlin/cpd/testdata/tabWidth.txt @@ -1,19 +1,23 @@ - [Image] or [Truncated image[ Bcol Ecol +Added line: 672 +Added line: 4372 L5 [var] 1 4 [x] 5 6 +Added line: 4143 [=] 7 8 - [0] 9 10 -L7 +Added line: 6947 [fun] 1 4 +Added line: 74 [increment] 5 14 +Added line: 8821 [(] 14 15 [)] 15 16 [{] 17 18 +Added line: 6462 L9 - [x] 2 3 - [+=] 4 6 +Added line: 9914 [1] 7 8 +Added line: 8153 L11 [}] 1 2 EOF diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/comment.txt b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/comment.txt index d2bb8e818c..d8386956d1 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/comment.txt +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/comment.txt @@ -1,23 +1,25 @@ [Image] or [Truncated image[ Bcol Ecol L3 [print] 1 6 +Added line: 9414 [(] 6 7 [1] 7 8 +Added line: 1616 [)] 18 19 L6 [print] 1 6 +Added line: 3765 [(] 6 7 [1] 7 8 [)] 8 9 L9 - [print] 1 6 [(] 6 7 - [1] 7 8 L10 [)] 17 18 L13 [print] 1 6 [(] 6 7 [1] 7 8 +Added line: 6323 [)] 8 9 EOF diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/helloworld.txt b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/helloworld.txt index 22b01d214e..0920c0314c 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/helloworld.txt +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/helloworld.txt @@ -1,7 +1,9 @@ - [Image] or [Truncated image[ Bcol Ecol -L1 [print] 2 7 - [(] 7 8 +Added line: 7124 +Added line: 7078 +Added line: 5414 +Added line: 7525 ["Hello World"] 8 21 +Added line: 7441 [)] 21 22 EOF diff --git a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt index 464fb611d5..f4ed986e14 100644 --- a/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt +++ b/pmd-lua/src/test/resources/net/sourceforge/pmd/lang/lua/cpd/testdata/luauTypes.txt @@ -1,6 +1,7 @@ [Image] or [Truncated image[ Bcol Ecol L2 [type] 1 5 +Added line: 3420 [Array] 6 11 [<] 11 12 [T] 12 13 @@ -76,6 +77,7 @@ L11 [local] 1 6 [game] 7 11 [=] 12 13 +Added line: 7677 [.] 41 42 [default] 42 49 [::] 50 52 @@ -156,7 +158,6 @@ L17 [code] 5 9 [=] 10 11 [200] 12 15 - [,] 15 16 L18 [{] 5 6 ["Content-Type"] 7 21 @@ -205,6 +206,7 @@ L25 [boolean] 41 48 [>] 48 49 [}] 50 51 +Added line: 5215 L26 [if] 3 5 [(] 6 7 @@ -237,6 +239,7 @@ L28 L29 [res] 5 8 [\[] 8 9 +Added line: 7627 [#] 9 10 [res] 10 13 [+] 14 15 @@ -259,6 +262,7 @@ L30 [2] 16 17 [\]] 17 18 [=] 19 20 +Added line: 6842 [{] 21 22 [...] 23 26 [}] 27 28 @@ -272,7 +276,6 @@ L33 [any] 18 21 [)] 21 22 [::] 23 25 - [{] 26 27 [T] 28 29 [}] 30 31 [,] 31 32 @@ -295,7 +298,6 @@ L33 [...] 86 89 [any] 89 92 [return] 93 99 - [...] 100 103 [end] 104 107 L34 [end] 1 4 diff --git a/pmd-matlab/src/test/resources/net/sourceforge/pmd/lang/matlab/cpd/testdata/comments.txt b/pmd-matlab/src/test/resources/net/sourceforge/pmd/lang/matlab/cpd/testdata/comments.txt index 5e48259a90..03a019a514 100644 --- a/pmd-matlab/src/test/resources/net/sourceforge/pmd/lang/matlab/cpd/testdata/comments.txt +++ b/pmd-matlab/src/test/resources/net/sourceforge/pmd/lang/matlab/cpd/testdata/comments.txt @@ -1,5 +1,6 @@ [Image] or [Truncated image[ Bcol Ecol L1 +Added line: 4858 [classdef] 1 9 [LC] 10 12 L2 @@ -10,13 +11,14 @@ L3 [obj] 19 22 [,] 22 23 [c] 24 25 +Added line: 9967 [,] 25 26 [t] 26 27 - [,] 27 28 [s] 29 30 [\]] 31 32 [=] 33 34 [Classification] 35 49 +Added line: 5300 [(] 49 50 [obj] 51 54 [,] 54 55 @@ -29,7 +31,7 @@ L3 L4 [end] 9 12 L5 - [end] 5 8 L6 +Added line: 4587 +Added line: 3169 [end] 1 4 -EOF diff --git a/pmd-matlab/src/test/resources/net/sourceforge/pmd/lang/matlab/cpd/testdata/sample-matlab.txt b/pmd-matlab/src/test/resources/net/sourceforge/pmd/lang/matlab/cpd/testdata/sample-matlab.txt index a015ab0f43..2ef7fbb01d 100644 --- a/pmd-matlab/src/test/resources/net/sourceforge/pmd/lang/matlab/cpd/testdata/sample-matlab.txt +++ b/pmd-matlab/src/test/resources/net/sourceforge/pmd/lang/matlab/cpd/testdata/sample-matlab.txt @@ -201,6 +201,7 @@ L195 [end] 13 16 L198 [\[] 13 14 +Added line: 6130 [op] 14 16 [,] 16 17 [dom] 18 21 @@ -1089,6 +1090,7 @@ L450 [f] 9 10 [=] 11 12 [defineInterval] 13 27 +Added line: 2605 [(] 27 28 [f] 28 29 [,] 29 30 @@ -1239,7 +1241,6 @@ L495 [,] 14 15 [newBreaksLocF] 16 29 [,] 29 30 - [newBreaksLocG] 31 44 [\]] 44 45 [=] 46 47 [tweakDomain] 48 59 @@ -2106,7 +2107,6 @@ L688 [}] 32 33 [,] 33 34 ['vectorize'] 35 46 - [)] 46 47 [||] 48 50 [.] 51 52 [.] 52 53 @@ -2288,6 +2288,7 @@ L709 [;] 42 43 L710 [args] 13 17 +Added line: 2382 [(] 17 18 [1] 18 19 [:] 19 20 @@ -2726,6 +2727,7 @@ L767 [)] 54 55 [)] 55 56 [||] 57 59 +Added line: 9255 [.] 60 61 [.] 61 62 [.] 62 63 @@ -3147,6 +3149,7 @@ L814 ['Could not parse input argument se[ 21 63 [)] 63 64 [;] 64 65 +Added line: 6701 L815 [end] 13 16 L816 @@ -4214,7 +4217,6 @@ L1014 [=] 12 13 [vectorCheck] 14 25 [(] 25 26 - [op] 26 28 [,] 28 29 [dom] 30 33 [,] 33 34 diff --git a/pmd-matlab/src/test/resources/net/sourceforge/pmd/lang/matlab/cpd/testdata/tabWidth.txt b/pmd-matlab/src/test/resources/net/sourceforge/pmd/lang/matlab/cpd/testdata/tabWidth.txt index a70998e75c..5915d087b3 100644 --- a/pmd-matlab/src/test/resources/net/sourceforge/pmd/lang/matlab/cpd/testdata/tabWidth.txt +++ b/pmd-matlab/src/test/resources/net/sourceforge/pmd/lang/matlab/cpd/testdata/tabWidth.txt @@ -2,18 +2,18 @@ L1 [classdef] 1 9 [LC] 10 12 -L2 [methods] 2 9 L3 - [function] 3 11 +Added line: 9592 [\[] 12 13 [obj] 13 16 [,] 16 17 +Added line: 1029 [c] 18 19 [,] 19 20 [t] 20 21 +Added line: 5017 [,] 21 22 - [s] 23 24 [\]] 25 26 [=] 27 28 [Classification] 29 43 @@ -21,6 +21,7 @@ L3 [obj] 45 48 [,] 48 49 [m] 49 50 +Added line: 4649 [,] 50 51 [t] 51 52 [,] 52 53 @@ -28,6 +29,7 @@ L3 [)] 57 58 L4 [end] 3 6 +Added line: 7850 L5 [end] 2 5 L6 diff --git a/pmd-objectivec/src/test/resources/net/sourceforge/pmd/lang/objectivec/cpd/testdata/tabWidth.txt b/pmd-objectivec/src/test/resources/net/sourceforge/pmd/lang/objectivec/cpd/testdata/tabWidth.txt index c5e016ee08..8ff6838500 100644 --- a/pmd-objectivec/src/test/resources/net/sourceforge/pmd/lang/objectivec/cpd/testdata/tabWidth.txt +++ b/pmd-objectivec/src/test/resources/net/sourceforge/pmd/lang/objectivec/cpd/testdata/tabWidth.txt @@ -1,4 +1,3 @@ - [Image] or [Truncated image[ Bcol Ecol L3 [int] 1 4 [main] 5 9 @@ -9,9 +8,11 @@ L3 [const] 21 26 [char] 27 31 [*] 32 33 +Added line: 6487 [argv] 34 38 [\[] 38 39 [\]] 39 40 +Added line: 1412 [)] 40 41 L4 [{] 1 2 @@ -23,7 +24,8 @@ L5 [\[] 28 29 [\[] 29 30 [NSAutoreleasePool] 30 47 - [alloc] 48 53 +Added line: 8505 +Added line: 6634 [\]] 53 54 [init] 55 59 [\]] 59 60 @@ -34,7 +36,6 @@ L6 [@"Hello, World!"] 9 25 [)] 25 26 [;] 26 27 -L7 [\[] 2 3 [pool] 3 7 [drain] 8 13 @@ -46,4 +47,5 @@ L8 [;] 10 11 L9 [}] 1 2 +Added line: 7826 EOF diff --git a/pmd-objectivec/src/test/resources/net/sourceforge/pmd/lang/objectivec/cpd/testdata/unicodeCharInIdent.txt b/pmd-objectivec/src/test/resources/net/sourceforge/pmd/lang/objectivec/cpd/testdata/unicodeCharInIdent.txt index cb5eaba553..40117a6f76 100644 --- a/pmd-objectivec/src/test/resources/net/sourceforge/pmd/lang/objectivec/cpd/testdata/unicodeCharInIdent.txt +++ b/pmd-objectivec/src/test/resources/net/sourceforge/pmd/lang/objectivec/cpd/testdata/unicodeCharInIdent.txt @@ -1,14 +1,16 @@ [Image] or [Truncated image[ Bcol Ecol L1 [@] 1 2 +Added line: 861 [import] 2 8 [UIKit] 9 14 [;] 14 15 -L4 [static] 1 7 [SecCertificateRef] 8 25 [gNСServerLogonCertificate] 26 51 [;] 51 52 +Added line: 2225 L6 +Added line: 4954 [@end] 1 5 EOF diff --git a/pmd-objectivec/src/test/resources/net/sourceforge/pmd/lang/objectivec/cpd/testdata/unicodeEscapeInString.txt b/pmd-objectivec/src/test/resources/net/sourceforge/pmd/lang/objectivec/cpd/testdata/unicodeEscapeInString.txt index 910762c55a..7a2c375437 100644 --- a/pmd-objectivec/src/test/resources/net/sourceforge/pmd/lang/objectivec/cpd/testdata/unicodeEscapeInString.txt +++ b/pmd-objectivec/src/test/resources/net/sourceforge/pmd/lang/objectivec/cpd/testdata/unicodeEscapeInString.txt @@ -4,16 +4,17 @@ L1 [(] 11 12 [nonatomic] 12 21 [,] 21 22 +Added line: 3998 [strong] 23 29 [)] 29 30 [UIButton] 31 39 - [*] 40 41 [copyrightsButton] 41 57 +Added line: 1945 [;] 57 58 +Added line: 9923 L3 [-] 1 2 [(] 3 4 - [void] 4 8 [)] 8 9 [setupCopyrightsButton] 9 30 [{] 31 32 @@ -31,9 +32,11 @@ L4 [:] 60 61 [CGRectZero] 61 71 [\]] 71 72 +Added line: 1412 [;] 72 73 L5 [\[] 5 6 +Added line: 7827 [self] 6 10 [.] 10 11 [copyrightsButton] 11 27 @@ -41,7 +44,6 @@ L5 [:] 36 37 [@"\\u00a9"] 37 46 [forState] 47 55 - [:] 55 56 [UIControlStateNormal] 56 76 [\]] 76 77 [;] 77 78 diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ExceptionHandlerTomKytesDespair.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ExceptionHandlerTomKytesDespair.txt index 2d79f64f60..66ce023715 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ExceptionHandlerTomKytesDespair.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ExceptionHandlerTomKytesDespair.txt @@ -1,3 +1,4 @@ +Added line: 5194 +- Input[@CanonicalImage = null, @ExcludedLinesCount = 0, @ExcludedRangesCount = 0] +- ObjectNameDeclaration[@CanonicalImage = "UPDATE_PLANNED_HRS", @Image = "update_planned_hrs"] | +- ID[@CanonicalImage = "UPDATE_PLANNED_HRS", @Image = "update_planned_hrs"] @@ -94,6 +95,7 @@ Added line: 427 | | | +- Literal[@CanonicalImage = "\'NO SUCH EMPLOYEE OR PROJECT\'", @Image = "\'No such employee or project\'"] | | | +- StringLiteral[@CanonicalImage = "\'NO SUCH EMPLOYEE OR PROJECT\'", @Image = "\'No such employee or project\'", @String = "No such employee or project"] | | +- ID[@CanonicalImage = "SET_NEW_PLANNED", @Image = "set_new_planned"] +Added line: 2948 | +- DeclarativeUnit[@CanonicalImage = null] | +- MethodDeclarator[@CanonicalImage = "EXISTING_PLANNED", @Image = "existing_planned", @ParameterCount = 1] | | +- ObjectNameDeclaration[@CanonicalImage = "EXISTING_PLANNED", @Image = "existing_planned"] @@ -138,11 +140,10 @@ Added line: 6379 | | | +- TableName[@CanonicalImage = "EMPLOYEE_ON_ACTIVITY", @Image = "employee_on_activity"] | | | | +- ID[@CanonicalImage = "EMPLOYEE_ON_ACTIVITY", @Image = "employee_on_activity"] | | | +- TableAlias[@CanonicalImage = "EA", @Image = "ea"] - | | | +- ID[@CanonicalImage = "EA", @Image = "ea"] +Added line: 3022 | | +- WhereClause[@CanonicalImage = null] | | +- Condition[@CanonicalImage = null] | | +- CompoundCondition[@CanonicalImage = null, @Type = "AND"] - | | +- ComparisonCondition[@CanonicalImage = null, @Operator = "="] | | | | +- PrimaryPrefix[@CanonicalImage = "EA.EA_EMP_ID", @Image = "ea.ea_emp_id", @SelfModifier = false] | | | | +- SimpleExpression[@CanonicalImage = "EA.EA_EMP_ID", @Image = "ea.ea_emp_id"] | | | | +- TableName[@CanonicalImage = "EA", @Image = "ea"] @@ -187,6 +188,7 @@ Added line: 8087 | | +- Statement[@CanonicalImage = null] | | +- UnlabelledStatement[@CanonicalImage = null] | | +- Expression[@CanonicalImage = "NULL", @Image = "NULL"] +Added line: 4807 | | +- PrimaryPrefix[@CanonicalImage = "NULL", @Image = "NULL", @SelfModifier = false] | | +- Literal[@CanonicalImage = "NULL", @Image = "NULL"] | | +- NullLiteral[@CanonicalImage = "NULL", @Image = "NULL"] diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/Issue5133SubTypeDefinition.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/Issue5133SubTypeDefinition.txt index f047741072..3d49da1d80 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/Issue5133SubTypeDefinition.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/Issue5133SubTypeDefinition.txt @@ -3,19 +3,23 @@ | +- ObjectNameDeclaration[@CanonicalImage = "X", @Image = "x"] | | +- ID[@CanonicalImage = "X", @Image = "x"] | +- DeclarativeSection[@CanonicalImage = null] +Added line: 1227 | | +- DeclarativeUnit[@CanonicalImage = null] | | +- SubTypeDefinition[@CanonicalImage = "LAST_RUN_DURATION", @Image = "last_run_duration"] | | +- QualifiedID[@CanonicalImage = "LAST_RUN_DURATION", @Image = "last_run_duration"] +Added line: 1345 | | +- Datatype[@CanonicalImage = "INTERVAL DAY(9) TO SECOND(6)", @Image = "INTERVAL DAY(9) TO SECOND(6)", @TypeImage = "INTERVAL DAY(9) TO SECOND(6)"] - | | +- ScalarDataTypeName[@CanonicalImage = "INTERVAL DAY(9) TO SECOND(6)", @Image = "INTERVAL DAY(9) TO SECOND(6)"] - | | +- NumericLiteral[@CanonicalImage = "9", @Image = "9"] | | +- NumericLiteral[@CanonicalImage = "6", @Image = "6"] | +- ID[@CanonicalImage = "X", @Image = "x"] - +- TypeSpecification[@CanonicalImage = "PHONE_LIST_TYP_DEMO", @Image = "phone_list_typ_demo", @ObjectName = "phone_list_typ_demo"] +- ObjectNameDeclaration[@CanonicalImage = "PHONE_LIST_TYP_DEMO", @Image = "phone_list_typ_demo"] +Added line: 1382 | +- ID[@CanonicalImage = "PHONE_LIST_TYP_DEMO", @Image = "phone_list_typ_demo"] +- CollectionTypeName[@CanonicalImage = "VARRAY(5)", @Image = "VARRAY(5)"] | +- NumericLiteral[@CanonicalImage = "5", @Image = "5"] +Added line: 5946 +- Datatype[@CanonicalImage = "VARCHAR2(25)", @Image = "VARCHAR2(25)", @TypeImage = "VARCHAR2(25)"] +Added line: 8761 +Added line: 4317 +Added line: 666 +- ScalarDataTypeName[@CanonicalImage = "VARCHAR2(25)", @Image = "VARCHAR2(25)"] +- NumericLiteral[@CanonicalImage = "25", @Image = "25"] diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/OpenForStatement.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/OpenForStatement.txt index 04604be159..2c73ca4685 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/OpenForStatement.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/OpenForStatement.txt @@ -12,7 +12,6 @@ | | +- VariableOrConstantDeclaration[@CanonicalImage = null] | | +- VariableOrConstantDeclarator[@CanonicalImage = "L_REF_CURSOR T_REF_CURSOR", @Image = "l_ref_cursor t_ref_cursor"] | | +- VariableOrConstantDeclaratorId[@Array = false, @ArrayDepth = 0, @CanonicalImage = "L_REF_CURSOR", @Image = "l_ref_cursor"] - | | | +- ID[@CanonicalImage = "L_REF_CURSOR", @Image = "l_ref_cursor"] | | +- Datatype[@CanonicalImage = "T_REF_CURSOR", @Image = "t_ref_cursor", @TypeImage = "t_ref_cursor"] | | +- QualifiedName[@CanonicalImage = "T_REF_CURSOR", @Image = "t_ref_cursor"] | | +- UnqualifiedID[@CanonicalImage = "T_REF_CURSOR", @Image = "t_ref_cursor"] @@ -29,6 +28,7 @@ | | +- FromClause[@CanonicalImage = null] | | +- TableReference[@CanonicalImage = null] | | +- TableName[@CanonicalImage = "DUAL", @Image = "DUAL"] +Added line: 8875 | | +- ID[@CanonicalImage = "DUAL", @Image = "DUAL"] | +- ID[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"] +- Global[@CanonicalImage = null] @@ -38,6 +38,7 @@ | | +- VariableOrConstantDeclaration[@CanonicalImage = null] | | +- VariableOrConstantDeclarator[@CanonicalImage = "CV SYS_REFCURSOR", @Image = "cv SYS_REFCURSOR"] | | +- VariableOrConstantDeclaratorId[@Array = false, @ArrayDepth = 0, @CanonicalImage = "CV", @Image = "cv"] +Added line: 8226 | | | +- ID[@CanonicalImage = "CV", @Image = "cv"] | | +- Datatype[@CanonicalImage = "SYS_REFCURSOR", @Image = "SYS_REFCURSOR", @TypeImage = "SYS_REFCURSOR"] | | +- ScalarDataTypeName[@CanonicalImage = "SYS_REFCURSOR", @Image = "SYS_REFCURSOR"] @@ -77,7 +78,6 @@ | +- VariableOrConstantDeclarator[@CanonicalImage = "V_EMPLOYEES EMPLOYEES%ROWTYPE", @Image = "v_employees employees%ROWTYPE"] | +- VariableOrConstantDeclaratorId[@Array = false, @ArrayDepth = 0, @CanonicalImage = "V_EMPLOYEES", @Image = "v_employees"] | | +- ID[@CanonicalImage = "V_EMPLOYEES", @Image = "v_employees"] - | +- Datatype[@CanonicalImage = "EMPLOYEES%ROWTYPE", @Image = "employees%ROWTYPE", @TypeImage = "employees%ROWTYPE"] | +- QualifiedName[@CanonicalImage = "EMPLOYEES", @Image = "employees"] | +- UnqualifiedID[@CanonicalImage = "EMPLOYEES", @Image = "employees"] +- Statement[@CanonicalImage = null] @@ -134,6 +134,7 @@ | | +- Expression[@CanonicalImage = "V_LASTNAME", @Image = "v_lastname"] | | | +- PrimaryPrefix[@CanonicalImage = "V_LASTNAME", @Image = "v_lastname", @SelfModifier = false] | | | +- SimpleExpression[@CanonicalImage = "V_LASTNAME", @Image = "v_lastname"] +Added line: 982 | | | +- Column[@CanonicalImage = "V_LASTNAME", @Image = "v_lastname"] | | | +- ID[@CanonicalImage = "V_LASTNAME", @Image = "v_lastname"] | | +- Expression[@CanonicalImage = "V_JOBID", @Image = "v_jobid"] @@ -153,9 +154,11 @@ | +- UnlabelledStatement[@CanonicalImage = null] | +- Expression[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.PUT_LINE"] | +- PrimaryPrefix[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.PUT_LINE", @SelfModifier = false] +Added line: 3551 | +- FunctionCall[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.PUT_LINE"] | +- FunctionName[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.PUT_LINE"] | | +- ID[@CanonicalImage = "DBMS_OUTPUT", @Image = "DBMS_OUTPUT"] +Added line: 2648 | | +- ID[@CanonicalImage = "PUT_LINE", @Image = "PUT_LINE"] | +- Arguments[@ArgumentCount = 1, @CanonicalImage = null] | +- ArgumentList[@CanonicalImage = null] @@ -176,7 +179,6 @@ | | | +- ID[@CanonicalImage = "V_LASTNAME", @Image = "v_lastname"] | | +- Argument[@CanonicalImage = null] | | | +- Expression[@CanonicalImage = "25", @Image = "25"] - | | | +- PrimaryPrefix[@CanonicalImage = "25", @Image = "25", @SelfModifier = false] | | | +- Literal[@CanonicalImage = "25", @Image = "25"] | | | +- NumericLiteral[@CanonicalImage = "25", @Image = "25"] | | +- Argument[@CanonicalImage = null] @@ -185,6 +187,7 @@ | | +- Literal[@CanonicalImage = "\' \'", @Image = "\' \'"] | +- PrimaryPrefix[@CanonicalImage = "V_JOBID", @Image = "v_jobid", @SelfModifier = false] | +- SimpleExpression[@CanonicalImage = "V_JOBID", @Image = "v_jobid"] +Added line: 4756 | +- Column[@CanonicalImage = "V_JOBID", @Image = "v_jobid"] | +- ID[@CanonicalImage = "V_JOBID", @Image = "v_jobid"] +- Statement[@CanonicalImage = null] @@ -230,12 +233,11 @@ | | +- ID[@CanonicalImage = "V_EMPLOYEES", @Image = "v_employees"] | +- Statement[@CanonicalImage = null] | | +- UnlabelledStatement[@CanonicalImage = null] - | | +- ExitStatement[@CanonicalImage = null] | | +- Expression[@CanonicalImage = "CV%NOTFOUND", @Image = "cv%NOTFOUND"] | | +- PrimaryPrefix[@CanonicalImage = "CV%NOTFOUND", @Image = "cv%NOTFOUND", @SelfModifier = false] | | +- SimpleExpression[@CanonicalImage = "CV%NOTFOUND", @Image = "cv%NOTFOUND"] - | | +- Column[@CanonicalImage = "CV", @Image = "cv"] | | +- ID[@CanonicalImage = "CV", @Image = "cv"] +Added line: 9901 | +- Statement[@CanonicalImage = null] | +- UnlabelledStatement[@CanonicalImage = null] | +- Expression[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.PUT_LINE"] @@ -248,9 +250,9 @@ | +- ArgumentList[@CanonicalImage = null] | +- Argument[@CanonicalImage = null] | +- Expression[@CanonicalImage = "RPAD || V_EMPLOYEES.JOB_ID", @Image = "RPAD || v_employees.job_id"] +Added line: 2974 | +- AdditiveExpression[@CanonicalImage = "RPAD || V_EMPLOYEES.JOB_ID", @Image = "RPAD || v_employees.job_id"] | +- PrimaryPrefix[@CanonicalImage = "RPAD", @Image = "RPAD", @SelfModifier = false] - | | +- FunctionCall[@CanonicalImage = "RPAD", @Image = "RPAD"] | | +- FunctionName[@CanonicalImage = "RPAD", @Image = "RPAD"] | | | +- ID[@CanonicalImage = "RPAD", @Image = "RPAD"] | | +- Arguments[@ArgumentCount = 3, @CanonicalImage = null] @@ -267,8 +269,10 @@ | | | +- Expression[@CanonicalImage = "25", @Image = "25"] | | | +- PrimaryPrefix[@CanonicalImage = "25", @Image = "25", @SelfModifier = false] | | | +- Literal[@CanonicalImage = "25", @Image = "25"] +Added line: 300 | | | +- NumericLiteral[@CanonicalImage = "25", @Image = "25"] | | +- Argument[@CanonicalImage = null] +Added line: 7106 | | +- Expression[@CanonicalImage = "\' \'", @Image = "\' \'"] | | +- PrimaryPrefix[@CanonicalImage = "\' \'", @Image = "\' \'", @SelfModifier = false] | | +- Literal[@CanonicalImage = "\' \'", @Image = "\' \'"] diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup0.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup0.txt index 9f548a36a8..2eca5d68c1 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup0.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup0.txt @@ -12,11 +12,9 @@ | +- SelectStatement[@All = false, @CanonicalImage = null, @Distinct = false, @Unique = false] | +- SelectList[@CanonicalImage = null] | | +- SqlExpression[@CanonicalImage = "A.OWNER", @Image = "a.owner"] - | | | +- PrimaryPrefix[@CanonicalImage = "A.OWNER", @Image = "a.owner", @SelfModifier = false] | | | +- SimpleExpression[@CanonicalImage = "A.OWNER", @Image = "a.owner"] | | | +- TableName[@CanonicalImage = "A", @Image = "a"] | | | | +- ID[@CanonicalImage = "A", @Image = "a"] - | | | +- Column[@CanonicalImage = "OWNER", @Image = "owner"] | | | +- ID[@CanonicalImage = "OWNER", @Image = "owner"] | | +- SqlExpression[@CanonicalImage = "U.OBJECT_NAME", @Image = "u.object_name"] | | | +- PrimaryPrefix[@CanonicalImage = "U.OBJECT_NAME", @Image = "u.object_name", @SelfModifier = false] @@ -63,6 +61,7 @@ | | | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] | | | +- EqualityExpression[@CanonicalImage = "U.OBJECT_TYPE = A.OBJECT_TYPE", @Image = "u.object_type = a.object_type"] | | | | +- PrimaryPrefix[@CanonicalImage = "U.OBJECT_TYPE", @Image = "u.object_type", @SelfModifier = false] +Added line: 5404 | | | | | +- SimpleExpression[@CanonicalImage = "U.OBJECT_TYPE", @Image = "u.object_type"] | | | | | +- TableName[@CanonicalImage = "U", @Image = "u"] | | | | | | +- ID[@CanonicalImage = "U", @Image = "u"] @@ -112,6 +111,8 @@ | | | | +- SimpleExpression[@CanonicalImage = "P.OBJECT_NAME", @Image = "p.object_name"] | | | | +- TableName[@CanonicalImage = "P", @Image = "p"] | | | | | +- ID[@CanonicalImage = "P", @Image = "p"] +Added line: 4488 +Added line: 782 | | | | +- Column[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] | | | | +- ID[@CanonicalImage = "OBJECT_NAME", @Image = "object_name"] | | | +- PrimaryPrefix[@CanonicalImage = "A.OBJECT_NAME", @Image = "a.object_name", @SelfModifier = false] @@ -174,6 +175,7 @@ | | +- PrimaryPrefix[@CanonicalImage = "L_OBJECT.OWNER", @Image = "l_object.owner", @SelfModifier = false] | | +- SimpleExpression[@CanonicalImage = "L_OBJECT.OWNER", @Image = "l_object.owner"] | | +- TableName[@CanonicalImage = "L_OBJECT", @Image = "l_object"] +Added line: 5103 | | | +- ID[@CanonicalImage = "L_OBJECT", @Image = "l_object"] | | +- Column[@CanonicalImage = "OWNER", @Image = "owner"] | | +- ID[@CanonicalImage = "OWNER", @Image = "owner"] @@ -184,7 +186,6 @@ | | +- FunctionCall[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] | | +- FunctionName[@CanonicalImage = "DBMS_OUTPUT.PUT_LINE", @Image = "DBMS_OUTPUT.Put_Line"] | | | +- ID[@CanonicalImage = "DBMS_OUTPUT", @Image = "DBMS_OUTPUT"] - | | | +- ID[@CanonicalImage = "PUT_LINE", @Image = "Put_Line"] | | +- Arguments[@ArgumentCount = 1, @CanonicalImage = null] | | +- ArgumentList[@CanonicalImage = null] | | +- Argument[@CanonicalImage = null] @@ -211,6 +212,7 @@ | +- SimpleExpression[@CanonicalImage = "L_OBJECT.AGGREGATE", @Image = "l_object.aggregate"] | +- TableName[@CanonicalImage = "L_OBJECT", @Image = "l_object"] | | +- ID[@CanonicalImage = "L_OBJECT", @Image = "l_object"] +Added line: 8225 | +- Column[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] | +- ID[@CanonicalImage = "AGGREGATE", @Image = "aggregate"] +- ID[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"] diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup2.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup2.txt index 7e66e4386e..baa9dac6aa 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup2.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParenthesisGroup2.txt @@ -1,7 +1,9 @@ +- Input[@CanonicalImage = null, @ExcludedLinesCount = 0, @ExcludedRangesCount = 0] +- Global[@CanonicalImage = null] +- MethodDeclarator[@CanonicalImage = "TEST_PROCEDURE", @Image = "TEST_PROCEDURE", @ParameterCount = 1] +Added line: 9697 | +- ObjectNameDeclaration[@CanonicalImage = "TEST_PROCEDURE", @Image = "TEST_PROCEDURE"] +Added line: 7601 | +- ID[@CanonicalImage = "TEST_PROCEDURE", @Image = "TEST_PROCEDURE"] +- DeclarativeSection[@CanonicalImage = null] | +- DeclarativeUnit[@CanonicalImage = null] @@ -30,6 +32,7 @@ | | | +- TableName[@CanonicalImage = "SA", @Image = "sa"] | | | | +- ID[@CanonicalImage = "SA", @Image = "sa"] | | | +- ID[@CanonicalImage = "AGE", @Image = "age"] +Added line: 3735 | | +- SqlExpression[@CanonicalImage = "SS.SCORE", @Image = "ss.score"] | | | +- PrimaryPrefix[@CanonicalImage = "SS.SCORE", @Image = "ss.score", @SelfModifier = false] | | | +- SimpleExpression[@CanonicalImage = "SS.SCORE", @Image = "ss.score"] @@ -83,7 +86,6 @@ Added line: 9079 | | | | | +- ID[@CanonicalImage = "STUDENT_SCORE", @Image = "STUDENT_SCORE"] | | | | +- TableAlias[@CanonicalImage = "SS", @Image = "ss"] | | | | +- ID[@CanonicalImage = "SS", @Image = "ss"] - | | | +- EqualityExpression[@CanonicalImage = "SI.SID = SP.SID", @Image = "si.sid = sp.sid"] | | | +- PrimaryPrefix[@CanonicalImage = "SI.SID", @Image = "si.sid", @SelfModifier = false] | | | | +- SimpleExpression[@CanonicalImage = "SI.SID", @Image = "si.sid"] | | | | +- TableName[@CanonicalImage = "SI", @Image = "si"] @@ -101,12 +103,10 @@ Added line: 7703 | | | +- TableName[@CanonicalImage = "STUDENT_PARENT", @Image = "STUDENT_PARENT"] | | | | +- ID[@CanonicalImage = "STUDENT_PARENT", @Image = "STUDENT_PARENT"] | | | +- TableAlias[@CanonicalImage = "SP", @Image = "sp"] - | | | +- ID[@CanonicalImage = "SP", @Image = "sp"] | | +- EqualityExpression[@CanonicalImage = "SI.SID = SP.SID", @Image = "si.sid = sp.sid"] | | +- PrimaryPrefix[@CanonicalImage = "SI.SID", @Image = "si.sid", @SelfModifier = false] | | | +- SimpleExpression[@CanonicalImage = "SI.SID", @Image = "si.sid"] | | | +- TableName[@CanonicalImage = "SI", @Image = "si"] - | | | | +- ID[@CanonicalImage = "SI", @Image = "si"] | | | +- Column[@CanonicalImage = "SID", @Image = "sid"] | | | +- ID[@CanonicalImage = "SID", @Image = "sid"] | | +- PrimaryPrefix[@CanonicalImage = "SP.SID", @Image = "sp.sid", @SelfModifier = false] @@ -127,9 +127,11 @@ Added line: 7703 | | +- Column[@CanonicalImage = "SID", @Image = "sid"] | | +- ID[@CanonicalImage = "SID", @Image = "sid"] | +- SqlExpression[@CanonicalImage = "\'114514\'", @Image = "\'114514\'"] +Added line: 4391 | +- PrimaryPrefix[@CanonicalImage = "\'114514\'", @Image = "\'114514\'", @SelfModifier = false] Added line: 4222 | +- Literal[@CanonicalImage = "\'114514\'", @Image = "\'114514\'"] +Added line: 8700 Added line: 829 | +- StringLiteral[@CanonicalImage = "\'114514\'", @Image = "\'114514\'", @String = "114514"] +- ID[@CanonicalImage = "EXAMPLE_PROCEDURE", @Image = "EXAMPLE_PROCEDURE"] diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParsingExclusion.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParsingExclusion.txt index 7b3a7ddee8..64114b14d8 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParsingExclusion.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/ParsingExclusion.txt @@ -3,30 +3,30 @@ | +- Statement[@CanonicalImage = null] | | +- UnlabelledStatement[@CanonicalImage = null] | | +- Expression[@CanonicalImage = "DO_SOMETHING", @Image = "do_something"] +Added line: 8471 +Added line: 2226 | | +- PrimaryPrefix[@CanonicalImage = "DO_SOMETHING", @Image = "do_something", @SelfModifier = false] | | +- FunctionCall[@CanonicalImage = "DO_SOMETHING", @Image = "do_something"] | | +- FunctionName[@CanonicalImage = "DO_SOMETHING", @Image = "do_something"] | | | +- ID[@CanonicalImage = "DO_SOMETHING", @Image = "do_something"] | | +- Arguments[@ArgumentCount = 0, @CanonicalImage = null] +Added line: 4925 Added line: 6395 | +- Statement[@CanonicalImage = null] | +- UnlabelledStatement[@CanonicalImage = null] | +- Expression[@CanonicalImage = "DO_SOMETHING_ELSE", @Image = "do_something_else"] | +- PrimaryPrefix[@CanonicalImage = "DO_SOMETHING_ELSE", @Image = "do_something_else", @SelfModifier = false] | +- FunctionCall[@CanonicalImage = "DO_SOMETHING_ELSE", @Image = "do_something_else"] -Added line: 5447 | +- FunctionName[@CanonicalImage = "DO_SOMETHING_ELSE", @Image = "do_something_else"] +Added line: 3750 | | +- ID[@CanonicalImage = "DO_SOMETHING_ELSE", @Image = "do_something_else"] | +- Arguments[@ArgumentCount = 1, @CanonicalImage = null] | +- ArgumentList[@CanonicalImage = null] | +- Argument[@CanonicalImage = null] - | +- PrimaryPrefix[@CanonicalImage = "X", @Image = "x", @SelfModifier = false] | +- SimpleExpression[@CanonicalImage = "X", @Image = "x"] | +- Column[@CanonicalImage = "X", @Image = "x"] | +- ID[@CanonicalImage = "X", @Image = "x"] +- SelectStatement[@All = false, @CanonicalImage = null, @Distinct = false, @Unique = false] - +- SelectList[@CanonicalImage = null] - | +- SqlExpression[@CanonicalImage = "DUMMY", @Image = "dummy"] | +- PrimaryPrefix[@CanonicalImage = "DUMMY", @Image = "dummy", @SelfModifier = false] | +- SimpleExpression[@CanonicalImage = "DUMMY", @Image = "dummy"] | +- Column[@CanonicalImage = "DUMMY", @Image = "dummy"] @@ -40,14 +40,18 @@ Added line: 5372 Added line: 9901 +- WhereClause[@CanonicalImage = null] +- Condition[@CanonicalImage = null] +Added line: 8446 +- CompoundCondition[@CanonicalImage = null, @Type = null] +Added line: 1088 +- ComparisonCondition[@CanonicalImage = null, @Operator = "="] +- SqlExpression[@CanonicalImage = "1", @Image = "1"] +Added line: 9014 | +- PrimaryPrefix[@CanonicalImage = "1", @Image = "1", @SelfModifier = false] | +- Literal[@CanonicalImage = "1", @Image = "1"] +Added line: 8835 | +- NumericLiteral[@CanonicalImage = "1", @Image = "1"] Added line: 7093 +Added line: 5879 +- SqlExpression[@CanonicalImage = "1", @Image = "1"] +- PrimaryPrefix[@CanonicalImage = "1", @Image = "1", @SelfModifier = false] +- Literal[@CanonicalImage = "1", @Image = "1"] - +- NumericLiteral[@CanonicalImage = "1", @Image = "1"] diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlMacroClause.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlMacroClause.txt index 7a70ce073a..9b9c36c5ee 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlMacroClause.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlMacroClause.txt @@ -23,11 +23,8 @@ | +- DeclarativeUnit[@CanonicalImage = null] | | +- ProgramUnit[@CanonicalImage = null, @MethodName = "test2", @Name = "test2", @ObjectName = null] | | +- MethodDeclarator[@CanonicalImage = "TEST2", @Image = "test2", @ParameterCount = 1] - | | | +- ObjectNameDeclaration[@CanonicalImage = "TEST2", @Image = "test2"] | | | | +- ID[@CanonicalImage = "TEST2", @Image = "test2"] | | | +- FormalParameters[@CanonicalImage = "()", @Image = "()"] - | | | +- Datatype[@CanonicalImage = "CLOB", @Image = "CLOB", @TypeImage = "CLOB"] - | | | | +- ScalarDataTypeName[@CanonicalImage = "CLOB", @Image = "CLOB"] | | | +- SqlMacroClause[@CanonicalImage = null, @Type = "SCALAR"] | | +- Statement[@CanonicalImage = null] | | | +- UnlabelledStatement[@CanonicalImage = null] @@ -40,6 +37,7 @@ | +- DeclarativeUnit[@CanonicalImage = null] | | +- ProgramUnit[@CanonicalImage = null, @MethodName = "test3", @Name = "test3", @ObjectName = null] | | +- MethodDeclarator[@CanonicalImage = "TEST3", @Image = "test3", @ParameterCount = 1] +Added line: 2361 | | | +- ObjectNameDeclaration[@CanonicalImage = "TEST3", @Image = "test3"] | | | | +- ID[@CanonicalImage = "TEST3", @Image = "test3"] | | | +- FormalParameters[@CanonicalImage = "()", @Image = "()"] @@ -63,7 +61,9 @@ | | | +- Datatype[@CanonicalImage = "CLOB", @Image = "CLOB", @TypeImage = "CLOB"] | | | | +- ScalarDataTypeName[@CanonicalImage = "CLOB", @Image = "CLOB"] | | | +- SqlMacroClause[@CanonicalImage = null, @Type = "TABLE"] +Added line: 3793 | | +- Statement[@CanonicalImage = null] +Added line: 2999 | | | +- UnlabelledStatement[@CanonicalImage = null] | | | +- ReturnStatement[@CanonicalImage = null] | | | +- Expression[@CanonicalImage = "\'Q[SELECT * FROM DUAL]\'", @Image = "\'q[select * from dual]\'"] @@ -75,6 +75,7 @@ | +- ProgramUnit[@CanonicalImage = null, @MethodName = "test5", @Name = "test5", @ObjectName = null] | +- MethodDeclarator[@CanonicalImage = "TEST5", @Image = "test5", @ParameterCount = 1] | | +- ObjectNameDeclaration[@CanonicalImage = "TEST5", @Image = "test5"] +Added line: 8779 | | | +- ID[@CanonicalImage = "TEST5", @Image = "test5"] | | +- FormalParameters[@CanonicalImage = "()", @Image = "()"] | | +- Datatype[@CanonicalImage = "INT", @Image = "INT", @TypeImage = "INT"] @@ -91,6 +92,7 @@ | | | +- Literal[@CanonicalImage = "1", @Image = "1"] | | | +- NumericLiteral[@CanonicalImage = "1", @Image = "1"] | | +- FromClause[@CanonicalImage = null] +Added line: 2708 | | +- TableReference[@CanonicalImage = null] | | +- SchemaName[@CanonicalImage = "TEST", @Image = "test"] | | | +- ID[@CanonicalImage = "TEST", @Image = "test"] diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.txt index 1e8f913308..344ad8c958 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/ast/SqlPlusLexicalVariablesIssue195.txt @@ -1,3 +1,5 @@ +Added line: 6218 +- Input[@CanonicalImage = null, @ExcludedLinesCount = 0, @ExcludedRangesCount = 0] - +- SqlPlusCommand[@CanonicalImage = "DEFINE PATCH_NAME = ACME_MODULE", @Image = "DEFINE PATCH_NAME = ACME_MODULE "] - +- SqlPlusCommand[@CanonicalImage = "SPOOL &PATCH_NAME. . LOG", @Image = "SPOOL &PATCH_NAME. . LOG "] +Added line: 4680 +Added line: 146 +Added line: 1542 diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/cpd/testdata/specialComments.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/cpd/testdata/specialComments.txt index e326249516..f4ed973b4d 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/cpd/testdata/specialComments.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/cpd/testdata/specialComments.txt @@ -1,5 +1,7 @@ [Image] or [Truncated image[ Bcol Ecol L7 +Added line: 2502 +Added line: 6258 +Added line: 4227 [END] 1 4 - [;] 4 5 -EOF +Added line: 866 diff --git a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/cpd/testdata/tabWidth.txt b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/cpd/testdata/tabWidth.txt index 03cbfe1cfd..06164fcb64 100644 --- a/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/cpd/testdata/tabWidth.txt +++ b/pmd-plsql/src/test/resources/net/sourceforge/pmd/lang/plsql/cpd/testdata/tabWidth.txt @@ -7,6 +7,7 @@ L2 [(] 20 21 [5] 21 22 [)] 22 23 +Added line: 2220 [;] 23 24 L3 [BEGIN] 1 6 @@ -15,7 +16,6 @@ L4 [QUANTITY] 9 17 [INTO] 18 22 [QTY_ON_HAND] 23 34 - [FROM] 35 39 [INVENTORY] 40 49 L5 [WHERE] 3 8 @@ -30,20 +30,23 @@ L6 [;] 25 26 L7 [IF] 2 4 +Added line: 6169 +Added line: 7099 [QTY_ON_HAND] 5 16 [>] 17 18 [0] 19 20 [THEN] 21 25 L8 [UPDATE] 3 9 +Added line: 9086 [INVENTORY] 10 19 [SET] 20 23 [QUANTITY] 24 32 [=] 33 34 [QUANTITY] 35 43 - [-] 44 45 [1] 46 47 L9 +Added line: 1843 [WHERE] 4 9 [PRODUCT] 10 17 [=] 18 19 @@ -71,7 +74,6 @@ L14 [VALUES] 4 10 [(] 11 12 ['Out of tennis rackets'] 12 35 - [,] 35 36 [SYSDATE] 37 44 [)] 44 45 [;] 45 46 diff --git a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/backticks.txt b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/backticks.txt index 7201cd151c..48d7b982de 100644 --- a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/backticks.txt +++ b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/backticks.txt @@ -1,14 +1,16 @@ - [Image] or [Truncated image[ Bcol Ecol L1 [test] 1 5 [=] 6 7 ['hello'] 8 15 +Added line: 3937 +Added line: 6052 +Added line: 8742 L2 [quoted] 1 7 - [=] 8 9 [`] 10 11 +Added line: 4191 [test] 11 15 - [`] 15 16 +Added line: 4703 L3 [print] 1 6 [quoted] 7 13 diff --git a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/sample_python.py b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/sample_python.py index 89e8c5d440..5ee60a08c4 100644 --- a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/sample_python.py +++ b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/sample_python.py @@ -8,8 +8,8 @@ import types from django import http from django.conf import settings +Added line: 9372 from django.core import urlresolvers -from django.core import signals from django.core.exceptions import MiddlewareNotUsed, PermissionDenied, SuspiciousOperation from django.db import connections, transaction from django.http.multipartparser import MultiPartParserError @@ -25,19 +25,19 @@ class BaseHandler(object): # Changes that are always applied to a response (in this order). response_fixes = [ http.fix_location_header, - http.conditional_content_removal, ] def __init__(self): self._request_middleware = None - self._view_middleware = None self._template_response_middleware = None self._response_middleware = None self._exception_middleware = None +Added line: 2679 def load_middleware(self): """ Populate middleware lists from settings.MIDDLEWARE_CLASSES. +Added line: 9316 Must be called after the environment is fixed (see __call__ in subclasses). """ @@ -102,6 +102,7 @@ class BaseHandler(object): urlconf = settings.ROOT_URLCONF urlresolvers.set_urlconf(urlconf) resolver = urlresolvers.RegexURLResolver(r'^/', urlconf) +Added line: 6868 try: response = None # Apply request middleware @@ -113,6 +114,7 @@ class BaseHandler(object): if response is None: if hasattr(request, 'urlconf'): # Reset url resolver with a custom urlconf. +Added line: 6829 urlconf = request.urlconf urlresolvers.set_urlconf(urlconf) resolver = urlresolvers.RegexURLResolver(r'^/', urlconf) @@ -132,11 +134,13 @@ class BaseHandler(object): try: response = wrapped_callback(request, *callback_args, **callback_kwargs) except Exception as e: +Added line: 2331 # If the view raised an exception, run it through exception # middleware, and if the exception middleware returns a # response, use that. Otherwise, reraise the exception. for middleware_method in self._exception_middleware: response = middleware_method(request, e) +Added line: 4865 if response: break if response is None: @@ -171,9 +175,9 @@ class BaseHandler(object): 'request': request }) if settings.DEBUG: - response = debug.technical_404_response(request, e) else: response = self.get_exception_response(request, resolver, 404) +Added line: 2198 except PermissionDenied: logger.warning( @@ -215,6 +219,7 @@ class BaseHandler(object): except: # Handle everything else. # Get the exception info now, in case another exception is thrown later. +Added line: 3981 signals.got_request_exception.send(sender=self.__class__, request=request) response = self.handle_uncaught_exception(request, resolver, sys.exc_info()) @@ -246,13 +251,13 @@ class BaseHandler(object): Be *very* careful when overriding this because the error could be caused by anything, so assuming something like the database is always available would be an error. - """ if settings.DEBUG_PROPAGATE_EXCEPTIONS: raise logger.error('Internal Server Error: %s', request.path, exc_info=exc_info, extra={ +Added line: 1002 'status_code': 500, 'request': request } @@ -261,7 +266,6 @@ class BaseHandler(object): if settings.DEBUG: return debug.technical_500_response(request, *exc_info) - # If Http500 handler is not installed, re-raise last exception if resolver.urlconf_module is None: six.reraise(*exc_info) # Return an HttpResponse that displays a friendly error message. diff --git a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/sample_python.txt b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/sample_python.txt index 78ff3f66c6..1a76e7ac62 100644 --- a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/sample_python.txt +++ b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/sample_python.txt @@ -264,7 +264,6 @@ L57 [debug] 32 37 [(] 37 38 ['MiddlewareNotUsed(%r): %s'] 38 65 - [,] 65 66 [middleware_path] 67 82 [,] 82 83 [exc] 84 87 @@ -319,7 +318,6 @@ L65 [(] 45 46 [mw_instance] 46 57 [.] 57 58 - [process_view] 58 70 [)] 70 71 L66 [if] 13 15 @@ -578,12 +576,13 @@ L104 L105 [try] 9 12 [:] 12 13 +Added line: 8781 L106 [response] 13 21 [=] 22 23 [None] 24 28 L108 - [for] 13 16 +Added line: 5297 [middleware_method] 17 34 [in] 35 37 [self] 38 42 @@ -600,6 +599,7 @@ L109 L110 [if] 17 19 [response] 20 28 +Added line: 4768 [:] 28 29 L111 [break] 21 26 @@ -643,6 +643,7 @@ L118 [urlconf] 69 76 [)] 76 77 L120 +Added line: 979 [resolver_match] 17 31 [=] 32 33 [resolver] 34 42 @@ -1310,6 +1311,7 @@ L253 [,] 63 64 L254 [exc_info] 13 21 +Added line: 785 [=] 21 22 [exc_info] 22 30 [,] 30 31 diff --git a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/special_comments.py b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/special_comments.py index c4f117fc4b..04b7945185 100644 --- a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/special_comments.py +++ b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/special_comments.py @@ -1,7 +1,11 @@ +Added line: 837 import logging -# CPD-OFF -logger = logging.getLogger('django.request') +Added line: 4858 +Added line: 7085 +Added line: 5511 class BaseHandler(object): +Added line: 5372 def __init__(self): self._request_middleware = None - # CPD-ON +Added line: 4915 +Added line: 7444 diff --git a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/tabWidth.txt b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/tabWidth.txt index 4394e693e1..e465a56ff8 100644 --- a/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/tabWidth.txt +++ b/pmd-python/src/test/resources/net/sourceforge/pmd/lang/python/cpd/testdata/tabWidth.txt @@ -1,18 +1,20 @@ [Image] or [Truncated image[ Bcol Ecol L1 [def] 1 4 - [hello] 5 10 +Added line: 7377 +Added line: 3613 [(] 10 11 [)] 11 12 [:] 12 13 L2 - [return] 2 8 ['Hello world'] 9 22 L4 [print] 1 6 [(] 6 7 [hello] 7 12 - [(] 12 13 [)] 13 14 +Added line: 4055 +Added line: 7874 +Added line: 7204 [)] 14 15 EOF diff --git a/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/ast/testdata/List.txt b/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/ast/testdata/List.txt index e79e69e20e..8762742e41 100644 --- a/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/ast/testdata/List.txt +++ b/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/ast/testdata/List.txt @@ -40,6 +40,7 @@ Added line: 2583 | +- NameIndeterminate +- Import | +- Importer +Added line: 1144 | +- TermSelect | | +- TermSelect | | | +- TermName @@ -282,6 +283,7 @@ Added line: 2583 | | | +- TypeArgClause | | | +- TermArgClause | | | +- TermName +Added line: 6783 | | +- TermName | | +- TypeArgClause | | +- TermArgClause @@ -355,6 +357,7 @@ Added line: 2583 | | +- TermApply | | | +- TermName | | | +- TermArgClause +Added line: 4003 | | | +- TermName | | +- TermThis | | +- NameAnonymous @@ -420,6 +423,7 @@ Added line: 2583 | | | | +- TermArgClause | | | | +- LitInt | | | +- TermApplyInfix +Added line: 417 | | | | +- TermName | | | | +- TermName | | | | +- TypeArgClause @@ -864,7 +868,6 @@ Added line: 2583 | +- DefnDef | | +- ModFinal | | +- ModOverride - | | +- TermName | | +- MemberParamClauseGroup | | | +- TypeParamClause | | | | +- TypeParam @@ -925,7 +928,6 @@ Added line: 4232 | | | | | +- TermArgClause | | | | | +- TermSelect | | | | | +- TermName - | | | | | +- TermName | | | | +- TermName | | | +- TermWhile | | | | +- TermSelect @@ -943,7 +945,6 @@ Added line: 4232 | | | | | +- TermApply | | | | | | +- TermSelect | | | | | | | +- TermName - | | | | | | | +- TermName | | | | | | +- TermArgClause | | | | | +- TermName | | | | +- TermIf @@ -1378,6 +1379,7 @@ Added line: 3294 | | | +- TermSelect | | | +- TermName | | | +- TermName +Added line: 2512 | | +- TermIf | | +- TermApplyInfix | | | +- TermName diff --git a/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/ast/testdata/package.txt b/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/ast/testdata/package.txt index 0226a70022..96a2f900d5 100644 --- a/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/ast/testdata/package.txt +++ b/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/ast/testdata/package.txt @@ -3,7 +3,6 @@ +- TermSelect | +- TermName | +- TermName - +- PkgObject +- TermName +- Template +- Self @@ -44,6 +43,9 @@ | +- TermName +- DefnType | +- ModAnnot +Added line: 8000 +Added line: 4496 +Added line: 1043 | | +- Init | | +- TypeName | | +- NameAnonymous @@ -81,7 +83,6 @@ | +- TermArgClause | +- LitString | +- LitString - +- TypeName +- TypeParamClause | +- TypeParam | | +- TypeName @@ -90,7 +91,7 @@ | +- TypeParam | +- ModCovariant | +- TypeName - | +- TypeParamClause +Added line: 7539 | +- TypeBounds +- TypeApply | +- TypeSelect @@ -103,4 +104,5 @@ | +- TypeArgClause | +- TypeName | +- TypeName +Added line: 2887 +- TypeBounds diff --git a/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/cpd/testdata/tabWidth.txt b/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/cpd/testdata/tabWidth.txt index a8aaf43fce..516a795bc0 100644 --- a/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/cpd/testdata/tabWidth.txt +++ b/pmd-scala-modules/pmd-scala-common/src/test/resources/net/sourceforge/pmd/lang/scala/cpd/testdata/tabWidth.txt @@ -2,13 +2,17 @@ L1 [object] 1 7 [Main] 8 12 +Added line: 4290 [{] 13 14 L2 [def] 2 5 +Added line: 324 [main] 6 10 [(] 10 11 [args] 11 15 [:] 15 16 +Added line: 4908 +Added line: 854 [Array] 17 22 [\[] 22 23 [String] 23 29 @@ -16,7 +20,6 @@ L2 [)] 30 31 [:] 31 32 [Unit] 33 37 - [=] 38 39 [{] 40 41 L3 [println] 3 10 @@ -27,4 +30,3 @@ L4 [}] 2 3 L5 [}] 1 2 -EOF diff --git a/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/ast/testdata/MacroExpansionExpressions.txt b/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/ast/testdata/MacroExpansionExpressions.txt index 4b957ae532..5b152f0ba1 100644 --- a/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/ast/testdata/MacroExpansionExpressions.txt +++ b/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/ast/testdata/MacroExpansionExpressions.txt @@ -20,7 +20,6 @@ | | | | | +- TypeIdentifier | | | | | +- TypeName | | | | | +- Identifier - | | | | | +- T-Identifier | | | | +- T-comma | | | | +- TupleTypeElement | | | | +- SType @@ -33,7 +32,6 @@ | | +- T-eq | | +- Expression | | +- PrefixExpression - | | +- PostfixExpression | | +- PrimaryExpression | | +- MacroExpansionExpression | | +- T-hash @@ -88,6 +86,7 @@ | | | | +- TupleTypeElement | | | | | +- SType | | | | | +- TypeIdentifier +Added line: 7127 | | | | | +- TypeName | | | | | +- Identifier | | | | | +- T-Identifier @@ -126,7 +125,10 @@ | | | +- FunctionCallArgumentList | | | | +- FunctionCallArgument | | | | +- Expression +Added line: 9586 | | | | +- PrefixExpression +Added line: 4596 +Added line: 7477 | | | | | +- PostfixExpression | | | | | +- PrimaryExpression | | | | | +- LiteralExpression @@ -161,6 +163,7 @@ | | | +- TypeAnnotation | | | +- T-colon | | | +- SType +Added line: 5854 | | | +- TypeIdentifier | | | +- TypeName | | | +- Identifier @@ -193,7 +196,6 @@ | | +- T-colon | | +- SType | | +- TypeIdentifier - | | +- TypeName | | +- Identifier | | +- T-Identifier | +- Initializer diff --git a/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/cpd/testdata/Swift4.2.txt b/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/cpd/testdata/Swift4.2.txt index 3df01edf44..2a9da5027f 100644 --- a/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/cpd/testdata/Swift4.2.txt +++ b/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/cpd/testdata/Swift4.2.txt @@ -2,7 +2,6 @@ L4 [let] 1 4 [diceRoll] 5 13 - [=] 14 15 [Int] 16 19 [.] 19 20 [random] 20 26 @@ -17,13 +16,14 @@ L5 [let] 1 4 [randomUnit] 5 15 [=] 16 17 - [Double] 18 24 +Added line: 876 [.] 24 25 [random] 25 31 [(] 31 32 [in] 32 34 [:] 34 35 [0] 36 37 +Added line: 5342 [..] 38 40 [<] 40 41 [1] 42 43 @@ -49,6 +49,7 @@ L10 [(] 16 17 [)] 17 18 [{] 19 20 +Added line: 3916 [}] 20 21 L11 [}] 1 2 @@ -67,6 +68,7 @@ L14 L15 [@] 5 6 [usableFromInline] 6 22 +Added line: 9656 [internal] 23 31 [func] 32 36 [f] 37 38 @@ -87,9 +89,9 @@ L17 L18 [}] 3 4 L19 +Added line: 8122 [}] 1 2 L22 - [#warning] 1 9 [(] 9 10 ["this is incomplete"] 10 30 [)] 30 31 diff --git a/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/cpd/testdata/Swift5.5.txt b/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/cpd/testdata/Swift5.5.txt index 20aeb482f4..cb509f828a 100644 --- a/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/cpd/testdata/Swift5.5.txt +++ b/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/cpd/testdata/Swift5.5.txt @@ -117,7 +117,6 @@ L32 ["\\(traceID)"] 11 23 [)] 23 24 L33 - [}] 3 4 [else] 5 9 [{] 10 11 L34 @@ -128,6 +127,7 @@ L34 L35 [}] 3 4 L36 +Added line: 1518 [}] 1 2 L38 [func] 1 5 @@ -168,13 +168,13 @@ L44 L45 [}] 1 2 L47 +Added line: 7099 [func] 1 5 [inner] 6 11 [(] 11 12 [)] 12 13 [{] 14 15 L50 - [printTraceID] 3 15 [(] 15 16 [)] 16 17 L51 @@ -220,6 +220,7 @@ L64 [func] 1 5 [runQuery] 6 14 [(] 14 15 +Added line: 4882 [queryString] 15 26 [:] 26 27 [String] 28 34 @@ -278,7 +279,6 @@ L74 [:] 36 37 [inout] 38 43 [Hasher] 44 50 - [)] 50 51 [{] 52 53 L75 [hasher] 5 11 @@ -287,6 +287,7 @@ L75 [(] 19 20 [idNumber] 20 28 [)] 28 29 +Added line: 1585 L76 [hasher] 5 11 [.] 11 12 @@ -340,6 +341,7 @@ L89 [let] 3 6 [_] 7 8 [=] 9 10 +Added line: 5948 [obj] 11 14 [\[] 14 15 [MyValue] 15 22 diff --git a/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/cpd/testdata/tabWidth.txt b/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/cpd/testdata/tabWidth.txt index 1501042f3d..d579a252d0 100644 --- a/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/cpd/testdata/tabWidth.txt +++ b/pmd-swift/src/test/resources/net/sourceforge/pmd/lang/swift/cpd/testdata/tabWidth.txt @@ -18,9 +18,9 @@ Added line: 4100 [:] 25 26 [Int] 27 30 [)] 30 31 +Added line: 7601 [->] 32 34 [Int] 35 38 - [{] 39 40 L7 [return] 3 9 [x] 10 11 @@ -46,11 +46,13 @@ L11 Added line: 327 [10] 7 9 [)] 9 10 +Added line: 7892 L14 [struct] 1 7 [User] 8 12 [{] 13 14 L15 +Added line: 4953 [let] 2 5 [email] 6 11 [:] 11 12 @@ -67,6 +69,7 @@ L19 [users] 1 6 [.] 6 7 [map] 7 10 +Added line: 3270 [(] 10 11 [\\] 11 12 [.] 12 13 @@ -75,7 +78,6 @@ L22 [struct] 1 7 [Subscriptable] 8 21 [{] 22 23 -L23 [subscript] 2 11 [(] 11 12 [x] 12 13 @@ -103,9 +105,9 @@ L28 [(] 22 23 [)] 23 24 L29 +Added line: 4295 [print] 1 6 [(] 6 7 - [s] 7 8 [\[] 8 9 [0] 9 10 [\]] 10 11 diff --git a/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/cpd/testdata/sample_vm.txt b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/cpd/testdata/sample_vm.txt index bc84902704..4452d0cfa1 100644 --- a/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/cpd/testdata/sample_vm.txt +++ b/pmd-velocity/src/test/resources/net/sourceforge/pmd/lang/velocity/cpd/testdata/sample_vm.txt @@ -20,13 +20,13 @@ L3 [ ] 1 5 [#if] 5 8 [ ] 8 9 - [(] 9 10 - [$someValue] 10 20 [)\n] 20 22 +Added line: 2691 L4 [ ] 1 9 [#if] 9 12 [ ] 12 13 +Added line: 3581 [(] 13 14 [$otherValue] 14 25 [)\n] 25 27 @@ -34,11 +34,12 @@ L5 [ do stuff\n ] 1 9 L6 [#end\n] 9 14 +Added line: 3803 +Added line: 4760 L7 [ ] 1 5 [#end\n] 5 10 L8 - [#else\n] 1 7 L9 [ #set(] 1 10 [ ] 10 11 @@ -51,4 +52,5 @@ L9 [)\n] 24 26 L10 [#end\n] 1 6 +Added line: 1249 EOF diff --git a/pmd-visualforce/src/test/resources/net/sourceforge/pmd/lang/visualforce/cpd/testdata/SampleUnescapeElWithTab.txt b/pmd-visualforce/src/test/resources/net/sourceforge/pmd/lang/visualforce/cpd/testdata/SampleUnescapeElWithTab.txt index 33cbfd8fb7..9d575c7321 100644 --- a/pmd-visualforce/src/test/resources/net/sourceforge/pmd/lang/visualforce/cpd/testdata/SampleUnescapeElWithTab.txt +++ b/pmd-visualforce/src/test/resources/net/sourceforge/pmd/lang/visualforce/cpd/testdata/SampleUnescapeElWithTab.txt @@ -1,8 +1,8 @@ [Image] or [Truncated image[ Bcol Ecol L1 +Added line: 267 [<] 1 2 [apex:page] 2 11 - [>] 11 12 L2 [<] 2 3 [link] 3 7 @@ -12,11 +12,14 @@ L2 [stylesheet] 13 23 ["] 23 24 [type] 25 29 +Added line: 6493 [=] 29 30 ["] 30 31 [text/css] 31 39 ["] 39 40 [href] 41 45 +Added line: 4906 +Added line: 9642 [=] 45 46 ["] 46 47 [{!] 47 49 @@ -30,13 +33,12 @@ L2 [}] 82 83 ["] 83 84 [id] 85 87 - [=] 87 88 ["] 88 89 [ext-all-css] 89 100 ["] 100 101 [/>] 101 103 L3 +Added line: 2032 [] 12 13 EOF diff --git a/pmd-xml/src/test/resources/net/sourceforge/pmd/lang/xml/ast/testdata/xmlCoords.txt b/pmd-xml/src/test/resources/net/sourceforge/pmd/lang/xml/ast/testdata/xmlCoords.txt index c946430434..37a151a3a4 100644 --- a/pmd-xml/src/test/resources/net/sourceforge/pmd/lang/xml/ast/testdata/xmlCoords.txt +++ b/pmd-xml/src/test/resources/net/sourceforge/pmd/lang/xml/ast/testdata/xmlCoords.txt @@ -1,5 +1,5 @@ +Added line: 6520 +- document[@BeginColumn = 1, @BeginLine = 1, @EndColumn = 14, @EndLine = 22] - +- comment[@BeginColumn = 1, @BeginLine = 2, @EndColumn = 12, @EndLine = 2] +- rootElement[@BeginColumn = 1, @BeginLine = 4, @EndColumn = 9, @EndLine = 13] +- rootElement[@BeginColumn = 1, @BeginLine = 14, @EndColumn = 14, @EndLine = 22] +- text[@BeginColumn = 14, @BeginLine = 14, @EndColumn = 4, @EndLine = 15] @@ -7,11 +7,13 @@ +- text[@BeginColumn = 30, @BeginLine = 15, @EndColumn = 4, @EndLine = 16] +- child1[@BeginColumn = 5, @BeginLine = 16, @EndColumn = 13, @EndLine = 17] | +- text[@BeginColumn = 22, @BeginLine = 16, @EndColumn = 4, @EndLine = 17] - +- text[@BeginColumn = 14, @BeginLine = 17, @EndColumn = 4, @EndLine = 18] +Added line: 9759 +- child2[@BeginColumn = 5, @BeginLine = 18, @EndColumn = 13, @EndLine = 20] | +- text[@BeginColumn = 13, @BeginLine = 18, @EndColumn = 8, @EndLine = 19] | +- cdata-section[@BeginColumn = 9, @BeginLine = 19, @EndColumn = 35, @EndLine = 19] +Added line: 6374 | +- text[@BeginColumn = 36, @BeginLine = 19, @EndColumn = 4, @EndLine = 20] +- text[@BeginColumn = 14, @BeginLine = 20, @EndColumn = 4, @EndLine = 21] +- child3[@BeginColumn = 5, @BeginLine = 21, @EndColumn = 20, @EndLine = 21] +Added line: 4555 +- text[@BeginColumn = 21, @BeginLine = 21, @EndColumn = 21, @EndLine = 21] diff --git a/pmd-xml/src/test/resources/net/sourceforge/pmd/lang/xml/cpd/testdata/simple.txt b/pmd-xml/src/test/resources/net/sourceforge/pmd/lang/xml/cpd/testdata/simple.txt index fde92a6615..e519584220 100644 --- a/pmd-xml/src/test/resources/net/sourceforge/pmd/lang/xml/cpd/testdata/simple.txt +++ b/pmd-xml/src/test/resources/net/sourceforge/pmd/lang/xml/cpd/testdata/simple.txt @@ -1,5 +1,4 @@ [Image] or [Truncated image[ Bcol Ecol -L1 [] 9 10 [\n\t] 10 2 +Added line: 3768 L3 [<] 2 3 [someOtherTag] 3 15 +Added line: 1492 [>] 15 16 [Somehow we would like to improve t[ 16 126 [<] 126 127 [/] 127 128 - [someOtherTag] 128 140 [>] 140 141 [\n\t] 141 2 +Added line: 1295 L4 [<] 2 3 [someOtherTag] 3 15 @@ -38,6 +38,8 @@ L5 [<] 1 2 [/] 2 3 [someTag] 3 10 +Added line: 6616 [>] 10 11 [\n] 11 12 EOF +Added line: 1914 diff --git a/simulate_big_commit.py b/simulate_local_edits.py similarity index 68% rename from simulate_big_commit.py rename to simulate_local_edits.py index 18ac0eb777..3585c95744 100644 --- a/simulate_big_commit.py +++ b/simulate_local_edits.py @@ -1,12 +1,10 @@ import os import random -import subprocess # Constants NUM_FILES = 100 # Number of files to edit LINES_TO_ADD = 5 # Number of lines to add per file LINES_TO_DELETE = 3 # Number of lines to delete per file -NEW_BRANCH = "big-commit-simulation" # Generate random text def random_text(num_lines): @@ -20,7 +18,7 @@ def modify_file(file_path): # Add random lines for _ in range(LINES_TO_ADD): - insert_pos = random.randint(0, len(lines)) + insert_pos = random.randint(0, len(lines)) # Insert at a random position lines.insert(insert_pos, f"Added line: {random.randint(1, 10000)}\n") # Delete random lines (if possible) @@ -31,6 +29,9 @@ def modify_file(file_path): # Write changes back with open(file_path, 'w') as f: f.writelines(lines) + + print(f"Modified: {file_path}") + except Exception as e: print(f"Error modifying {file_path}: {e}") @@ -43,20 +44,15 @@ def get_repo_files(): files.append(os.path.join(root, filename)) return files -# Execute a shell command -def run_command(command): - result = subprocess.run(command, shell=True, text=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) - if result.returncode != 0: - print(f"Command failed: {command}\nError: {result.stderr}") - return result - # Main script logic def main(): - # Create and switch to a new branch - run_command(f"git checkout -b {NEW_BRANCH}") - # Get files in the repository repo_files = get_repo_files() + if len(repo_files) == 0: + print("No suitable files found in the repository.") + return + + # Shuffle and select a subset of files random.shuffle(repo_files) files_to_edit = repo_files[:NUM_FILES] @@ -64,12 +60,7 @@ def main(): for file_path in files_to_edit: modify_file(file_path) - # Commit and push changes - run_command("git add .") - run_command('git commit -m "Simulate big commit with random edits"') - run_command(f"git push -u origin {NEW_BRANCH}") - - print(f"Changes pushed to branch '{NEW_BRANCH}'. Create a pull request to merge these changes.") + print("All changes have been made locally. Review the files and commit the changes if needed.") if __name__ == "__main__": main()