Compare commits

...
247 Commits
Author SHA1 Message Date
Andreas Dangel 4f766035a4 [java] Fix #5263 - UnnecessaryFullyQualifiedName FP with forward references (#5353)
Merge pull request #5353 from oowekyala:issue5263-ufqn-forward-ref
2024-11-22 09:48:25 +01:00
Andreas Dangel 9da17877ac [doc] Update release notes (#5263, #5353) 2024-11-22 09:47:53 +01:00
Andreas Dangel 3e9e128aa7 [java] UnnecessaryFullyQualifiedName - improve test case 2024-11-22 09:46:35 +01:00
Clément Fournier 918684c154 Fix static methods being whitelisted 2024-11-21 16:51:24 +01:00
Clément Fournier e63edf358e [java] Fix #5263 - UnnecessaryFullyQualifiedName FP with forward reference. 2024-11-21 15:26:54 +01:00
Clément Fournier 0d11f151bd [java] Add more details to parse failures in signatures 2024-11-21 14:55:51 +01:00
Juan Martín Sotuyo Dodero 28b4139cd4 Bump rouge from 4.5.0 to 4.5.1 in the all-gems group across 1 directory (#5348) 2024-11-18 15:44:10 -03:00
Juan Martín Sotuyo Dodero d61f691559 Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0 (#5350) 2024-11-18 15:43:55 -03:00
Clément Fournier 12f7f98803 Fix junit 5 warning
return type of factory method must be a collection
or array or stream
2024-11-18 11:43:51 +01:00
dependabot[bot] 2e4f16d516 Bump org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0
Bumps org.apache.commons:commons-lang3 from 3.14.0 to 3.17.0.

---
updated-dependencies:
- dependency-name: org.apache.commons:commons-lang3
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 04:05:13 +00:00
dependabot[bot] 46ef55c9a9 Bump rouge from 4.5.0 to 4.5.1 in the all-gems group across 1 directory
Bumps the all-gems group with 1 update in the / directory: [rouge](https://github.com/rouge-ruby/rouge).


Updates `rouge` from 4.5.0 to 4.5.1
- [Release notes](https://github.com/rouge-ruby/rouge/releases)
- [Changelog](https://github.com/rouge-ruby/rouge/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rouge-ruby/rouge/compare/v4.5.0...v4.5.1)

---
updated-dependencies:
- dependency-name: rouge
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: all-gems
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-18 03:46:56 +00:00
Andreas Dangel 79c0ce0415 [julia] Ignore generated code in Julia module (#5342)
Merge pull request #5342 from Monits:fix-generated-code-julia
2024-11-17 16:16:51 +01:00
Andreas Dangel 8fdfd369b0 [doc] Update release notes (#5342) 2024-11-17 16:15:55 +01:00
Andreas Dangel 80b8bc47df [gherkin] Remove generated gherkin code from coverage report (#5336)
Merge pull request #5336 from Monits:fix-generated-code-gherkin
2024-11-17 16:13:13 +01:00
Andreas Dangel a9b6c946b4 [doc] Update release notes (#5336) 2024-11-17 16:12:46 +01:00
Andreas Dangel 2910ab0403 [kotlin] Prevent auxiliary grammars from generating lexers (#5335)
Merge pull request #5335 from Monits:fix-generated-code-kotlin
2024-11-17 15:58:54 +01:00
Andreas Dangel 5a0220da2e [doc] Update release notes (#5335) 2024-11-17 15:58:05 +01:00
Andreas Dangel bc4a49deac [doc] Update docs/pages/pmd/projectdocs/credits.md [skip ci] 2024-11-17 15:49:32 +01:00
Andreas Dangel a40c30c8c1 [apex] New Rule: Queueable Should Attach Finalizer (#5303)
Merge pull request #5303 from mitchspano:Require_Finalizer
2024-11-17 15:46:05 +01:00
Andreas Dangel 44c15aae6d [doc] Update release notes (#5303, #5302) 2024-11-17 15:30:59 +01:00
Andreas Dangel 85aeebbab0 Merge branch 'main' into pr-5303 2024-11-17 15:25:24 +01:00
Andreas Dangel a5925eb5ea [doc] Fix typo in release notes 2024-11-17 15:24:49 +01:00
mitchspano c456396931 Reset credits.md to pmd main HEAD. 2024-11-15 22:14:20 +00:00
mitchspano 1ee0f53608 Update @mitchspano as a contributor 2024-11-15 22:07:44 +00:00
Juan Martín Sotuyo Dodero e60f460e02 Merge branch 'pr-5340' 2024-11-15 18:40:37 -03:00
Juan Martín Sotuyo Dodero ee1ab976bc update changelog, refs #5097 2024-11-15 18:39:39 -03:00
Juan Martín Sotuyo Dodero 15cab177d2 Remove added test 2024-11-15 18:30:03 -03:00
Juan Martín Sotuyo Dodero b6f45ed618 Ensure types don't match 2024-11-15 17:55:07 -03:00
Juan Martín Sotuyo Dodero 1ceae38880 [java] TooFewBranchesForSwitch - allow list of case constants (#5289) 2024-11-15 13:48:50 -06:00
Juan Martín Sotuyo Dodero f7de8d3e7e Merge branch 'pr-5331' 2024-11-15 16:47:09 -03:00
Juan Martín Sotuyo Dodero 59864a7c6c Merge branch 'pr-5341' 2024-11-15 16:15:19 -03:00
Juan Martín Sotuyo Dodero a6746fcffa Update changelog, refs #5083 2024-11-15 16:14:53 -03:00
Juan Martín Sotuyo Dodero aad8e93a2f Add test case ensuring we don't incur in FNs 2024-11-15 16:13:44 -03:00
Juan Martín Sotuyo Dodero 3bb943e0e5 Add deprecated code for backwards compatibility 2024-11-15 16:01:45 -03:00
Juan Martín Sotuyo Dodero 3356dd949d Ignore generated code in Julia module 2024-11-15 15:42:35 -03:00
Clément Fournier b264fa14e1 Fix #5083 - mref without target type but with exact method
has compile time decl
2024-11-15 16:36:52 +01:00
Clément Fournier c1aa4e0381 Merge branch 'main' into typeres-problem-with-unchecked-conversion 2024-11-15 16:18:22 +01:00
Clément Fournier a72ac5845b Add test for #5113 2024-11-15 16:16:08 +01:00
Juan Martín Sotuyo Dodero 4e1f4be009 Merge branch 'main' into issue-5287 2024-11-15 08:51:52 -06:00
Juan Martín Sotuyo Dodero c73e5cb8b1 [html] Test for a closing tag when determining node positions (#5328) 2024-11-15 08:50:53 -06:00
Clément Fournier 5931b6601c [java] Fix #5097 - problem with unchecked conversion 2024-11-15 15:27:55 +01:00
Juan Martín Sotuyo Dodero 9d15c900db Pass linters in generated code 2024-11-15 11:27:07 -03:00
mitchspano 69a24126f7 Fix formatting and static code analysis findings. 2024-11-14 23:29:44 +00:00
Juan Martín Sotuyo Dodero ef3a4cc15e Remove generated gherkin code from coverage report
- Take the chance to remove / deprecate autogenerated classes that are
   not needed and were not used.
2024-11-14 18:10:59 -03:00
Juan Martín Sotuyo Dodero 4ef8fb21a9 Merge branch 'main' into issue-5322 2024-11-14 14:38:45 -06:00
Juan Martín Sotuyo Dodero f803aa36dc [java] InsufficientStringBufferDeclaration: Fix CCE for Character (#5332) 2024-11-14 13:57:49 -06:00
Juan Martín Sotuyo Dodero 0cf8f2c18b Suppress style warnings on generated file 2024-11-14 16:55:55 -03:00
Juan Martín Sotuyo Dodero 178f9541e2 Add since to deprecation notice 2024-11-14 16:51:04 -03:00
Juan Martín Sotuyo Dodero 79026f98c9 Add licence header 2024-11-14 16:49:45 -03:00
Juan Martín Sotuyo Dodero 0e0f347f51 Rename parser before annotating to ensure files are found 2024-11-14 16:47:20 -03:00
Juan Martín Sotuyo Dodero 0d606a7122 Prevent auxiliary grammars from generating lexers
- A misconfiguration of Antlr4 produced an auxiliary gramma
   (UnicodeClasses), that was imported into the main kotlin grammar,
   to produce it's own Lexer, which was never used.
 - We no longer produce that Lexer, properly moving imports to the
   standard directory for that.
 - We manually copy a generated version for API compatibility, flagging
   it as both Generated and Deprecated for removal in PMD 8
2024-11-14 16:39:09 -03:00
Andreas Dangel d60b234a47 Merge branch 'main' into issue-5314 2024-11-14 19:47:41 +01:00
Andreas Dangel b050ce353e [java] Propagate unknown type better when mref is unresolved (#5330)
Merge pull request #5330 from oowekyala:typeres-fix-inference-issue-mref
2024-11-14 19:18:43 +01:00
Andreas Dangel 32f55e22e3 [doc] Update release notes (#5329, #5330) 2024-11-14 19:18:11 +01:00
Andreas Dangel 206ed8bbd3 [apex] Use case-insensitive input stream to avoid choking on Unicode escape sequences (#5284)
Merge pull request #5284 from wahajenius:main
2024-11-14 18:23:26 +01:00
Andreas Dangel e1d4f27e19 Add @wahajenius as a contributor 2024-11-14 18:18:06 +01:00
Andreas Dangel 093683bc59 [doc] Update release notes (#5284, #5333) 2024-11-14 18:17:49 +01:00
Andreas Dangel 509452577d [apex] Add test case for #5333 2024-11-14 18:16:06 +01:00
Andreas Dangel 991bc2c41d [apex] Report LexException when extracting comments 2024-11-14 18:12:13 +01:00
Andreas Dangel 8c58a0b3f5 Merge branch 'main' into pr-5284 2024-11-14 18:01:56 +01:00
Andreas Dangel 01b8ca765b Add @chenguangqi as a contributor 2024-11-14 17:48:26 +01:00
Andreas Dangel 3fdbf7d6cb [java] InsufficientStringBufferDeclaration: Fix CCE for Character
Fixes #5314
2024-11-14 17:48:08 +01:00
Andreas Dangel bb729e02f4 Add @VitaliiIevtushenko as a contributor 2024-11-14 17:39:32 +01:00
Clément Fournier bf388d7fd0 Propagate unknown type better when mref is unresolved 2024-11-14 17:39:31 +01:00
Andreas Dangel 61eb116833 [java] PreserveStackTrace - consider instance type patterns
Fixes #5318
2024-11-14 17:39:07 +01:00
Andreas Dangel 634a525286 [html] Test for a closing tag when determining node positions
Fixes #5322
2024-11-14 17:07:37 +01:00
Clément Fournier 2df68ed168 Disable type inf logging by default 2024-11-14 16:32:09 +01:00
Clément Fournier 04dfb782f0 Merge branch 'typeres-fix-inference-issue' 2024-11-14 16:14:50 +01:00
Clément Fournier a79d3e6557 Add unit tests 2024-11-14 16:13:30 +01:00
Andreas Dangel bb2782241e [java] Fix inference dependency issue with nested lambdas (#5325)
Merge pull request #5325 from oowekyala:typeres-fix-inference-issue
2024-11-14 15:51:08 +01:00
Andreas Dangel 2340168421 [doc] Update release notes (#5324) 2024-11-14 15:50:35 +01:00
Andreas Dangel e5a1236981 Update pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/bestpractices/xml/UnusedPrivateMethod.xml 2024-11-14 15:48:47 +01:00
dependabot[bot] ed5e862aa3 Bump rouge from 4.4.0 to 4.5.0 in the all-gems group across 1 directory (#5316)
Bumps the all-gems group with 1 update in the / directory: [rouge](https://github.com/rouge-ruby/rouge).


Updates `rouge` from 4.4.0 to 4.5.0
- [Release notes](https://github.com/rouge-ruby/rouge/releases)
- [Changelog](https://github.com/rouge-ruby/rouge/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rouge-ruby/rouge/compare/v4.4.0...v4.5.0)

---
updated-dependencies:
- dependency-name: rouge
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: all-gems
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-14 15:14:44 +01:00
Clément Fournier 529693c916 [java] fix inference dependency issue
Reported in #5324

I improved the verbose logging output a bit so
some of the changes are not directly relevant.
2024-11-13 22:39:34 +01:00
mitchspano 1a9e721fb6 Implements the RuleChain within the QueueableWithoutFinalizerRule.
Implements the [`RuleChain`](https://docs.pmd-code.org/latest/pmd_userdocs_extending_writing_java_rules.html#economic-traversal-the-rulechain) to traverse all classes within the file.
2024-11-12 21:59:02 +00:00
mitchspano 4e4ca6bb70 Incorporate code review feedback.
- Renames the rule to `QueueableWithoutFinalizer` to be more neutral.
- Provides a more robust description.
- Provides a more succinct error message.
- Provides a positive sample for the documentation .
2024-11-12 19:46:58 +00:00
Juan Martín Sotuyo Dodero 3659a2cb7d Bump org.apache.commons:commons-compress from 1.26.0 to 1.27.1 (#5317) 2024-11-10 22:55:15 -06:00
dependabot[bot] 07de5559bc Bump org.apache.commons:commons-compress from 1.26.0 to 1.27.1
Bumps org.apache.commons:commons-compress from 1.26.0 to 1.27.1.

---
updated-dependencies:
- dependency-name: org.apache.commons:commons-compress
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-11 03:35:46 +00:00
Andreas Dangel b05b8240a7 Merge branch 'main' into issue-5287 2024-11-07 19:51:00 +01:00
Andreas Dangel ee7d6fed3e [java] TooFewBranchesForSwitch - add test case from comment on #5311 2024-11-07 19:50:29 +01:00
Juan Martín Sotuyo Dodero fe88498ee8 [java] Fix #5293: Parse number of type parameters eagerly (#5309) 2024-11-07 06:19:16 -06:00
Juan Martín Sotuyo Dodero 944e1e8f7a Bump maven-pmd-plugin from 3.24.0 to 3.26.0 (#5312) 2024-11-07 06:17:30 -06:00
Andreas Dangel ca208d2241 Bump maven-pmd-plugin from 3.24.0 to 3.26.0 2024-11-07 12:40:18 +01:00
Andreas Dangel 9dcb697f13 Improve DeadlockTest 2024-11-07 12:38:11 +01:00
Andreas Dangel 733ac4bba0 [doc] Update release notes (#5293) 2024-11-04 11:23:49 +01:00
Andreas Dangel 1ee6494429 [java] Fix #5293: Parse number of type parameters eagerly
When creating a LazyClassSignature or LazyMethodType, make sure
to parse the number of type parameters eagerly, so that AstDisambiguationPass
can get this number without triggering additional parsing.
2024-11-04 11:23:49 +01:00
Andreas Dangel a1996554d8 [java] Add DeadlockTest for verifying #5293
- Improve logging for Parselock

Refs #5293
2024-11-04 11:23:48 +01:00
dependabot[bot] e15c05721e Bump webrick from 1.8.2 to 1.9.0 in /docs in the all-gems group across 1 directory (#5308)
Bump webrick in /docs in the all-gems group across 1 directory

Bumps the all-gems group with 1 update in the /docs directory: [webrick](https://github.com/ruby/webrick).


Updates `webrick` from 1.8.2 to 1.9.0
- [Release notes](https://github.com/ruby/webrick/releases)
- [Commits](https://github.com/ruby/webrick/compare/v1.8.2...v1.9.0)

---
updated-dependencies:
- dependency-name: webrick
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: all-gems
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-11-04 09:23:58 +01:00
Juan Martín Sotuyo Dodero f0daed5874 Bump org.apache.maven.plugins:maven-clean-plugin from 3.3.2 to 3.4.0 (#5307) 2024-11-03 21:54:00 -06:00
dependabot[bot] 36dfcf8211 Bump org.apache.maven.plugins:maven-clean-plugin from 3.3.2 to 3.4.0
Bumps [org.apache.maven.plugins:maven-clean-plugin](https://github.com/apache/maven-clean-plugin) from 3.3.2 to 3.4.0.
- [Release notes](https://github.com/apache/maven-clean-plugin/releases)
- [Commits](https://github.com/apache/maven-clean-plugin/compare/maven-clean-plugin-3.3.2...maven-clean-plugin-3.4.0)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-clean-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-11-04 03:08:41 +00:00
mitchspano 83d8ca0169 Fix bestPractices.xml formatting and priority definition. 2024-11-01 21:59:13 +00:00
mitchspano be3c34fe1a Add priority definition. 2024-11-01 21:29:30 +00:00
mitchspano 52fb6c814b Queueable Should Attach Finalizer 2024-11-01 21:17:53 +00:00
mitchspano 93929deef6 Update @mitchspano as a contributor 2024-11-01 17:09:51 +00:00
Andreas Dangel 3ed370f61d Bump gems and bundler (#5301)
- Bump bundler from 2.5.3 to 2.5.22
- Bump activesupport from 7.2.1 to 7.2.2
- Bump execjs from 2.9.1 to 2.10.0
- Bump faraday from 2.11.0 to 2.12.0
- Bump i18n from 1.14.5 to 1.14.6
- Bump json from 2.7.2 to 2.7.5
- Bump logger from 1.6.0 to 1.6.1
- Bump rexml from 3.3.6/3.3.8 to 3.3.9
- Bump rufus-scheduler from 3.9.2 to 3.9.2

- Fixes https://github.com/pmd/pmd/security/dependabot/69
- Fixes https://github.com/pmd/pmd/security/dependabot/70
2024-10-31 15:07:25 +01:00
Andreas Dangel 5eaefd2841 [doc] Update release notes (#1860) 2024-10-31 15:06:32 +01:00
Andreas Dangel a709be1dcb [xml] Have pmd-xml Lexer in line with other antlr grammars (#5296)
Merge pull request #5296 from Monits:align-xml-antlr
2024-10-31 12:27:11 +01:00
Andreas Dangel c079d8c544 [doc] Update release notes (#5296) 2024-10-31 12:25:59 +01:00
Andreas Dangel 7bfa581511 Merge branch 'main' into pr-5296 2024-10-31 12:17:57 +01:00
Andreas Dangel 6ae7404941 [xml] XMLLexer - Update deprecation notice 2024-10-31 12:17:27 +01:00
Juan Martín Sotuyo Dodero 94095df872 Fix style issues 2024-10-29 17:21:24 -03:00
Juan Martín Sotuyo Dodero 7119424d96 Add license header 2024-10-29 16:56:30 -03:00
Juan Martín Sotuyo Dodero 69a92de52d Have pmd-xml Lexer in line with other antlr grammars
- The package is no longer antlr4, but ast, as is in all other modules
 - We keep a deprecated proxy for backwards compatibility
 - We annotate the generated classes as such to ignore them from
   coverage reports
2024-10-28 22:10:21 -03:00
Juan Martín Sotuyo Dodero 73dbc7a67f Bump org.apache.maven.plugins:maven-assembly-plugin from 3.6.0 to 3.7.1 (#5290) 2024-10-28 14:06:52 -03:00
dependabot[bot] c81cd1d520 Bump org.apache.maven.plugins:maven-assembly-plugin from 3.6.0 to 3.7.1
Bumps [org.apache.maven.plugins:maven-assembly-plugin](https://github.com/apache/maven-assembly-plugin) from 3.6.0 to 3.7.1.
- [Release notes](https://github.com/apache/maven-assembly-plugin/releases)
- [Commits](https://github.com/apache/maven-assembly-plugin/compare/maven-assembly-plugin-3.6.0...maven-assembly-plugin-3.7.1)

---
updated-dependencies:
- dependency-name: org.apache.maven.plugins:maven-assembly-plugin
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-28 03:31:36 +00:00
Juan Martín Sotuyo Dodero 4473aa6667 [ant] Formatter: avoid reflective access to determine console encoding (#5286) 2024-10-27 15:40:04 -03:00
Juan Martín Sotuyo Dodero 97d68e331c Bump asm from 9.7 to 9.7.1 (#5288) 2024-10-27 12:38:42 -03:00
Andreas Dangel 16eafc89c2 [java] TooFewBranchesForSwitch - allow list of case constants
Fixes #5287
2024-10-27 16:24:05 +01:00
Andreas Dangel d68d6c57ef Bump asm from 9.7 to 9.7.1
This enables support for Java 24
Refs #5154
2024-10-27 15:53:00 +01:00
Andreas Dangel 9c098b2531 Bump pmd from 7.5.0 to 7.7.0 (#5285)
* Bump pmd from 7.5.0 to 7.7.0

* Bump build-tools from 27 to 28-SNAPSHOT

Needed to remove deprecation warnings
about old rule names
2024-10-27 15:20:28 +01:00
Andreas Dangel 3f697aff35 [ant] Formatter: avoid reflective access to determine console encoding
- for java 17+, there is public API to get the console encoding
  -> no problem
- for older java versions, try to use system property
  sun.jnu.encoding if it exists
- only then use the fall-backs with illegal reflective access
  to private fields/methods on java.io.Console
- Also avoid using reflection utils from apache commons, instead
  use reflection directly. The illegal access warnings are then
  properly reported against our class
  net.sourceforge.pmd.ant.Formatter.

Fixes #1860
2024-10-25 18:33:36 +02:00
Andreas Dangel 74ec6f45ee [doc] Fix release notes for 7.7.0
Old rule name was actually DefaultLabelNotLastInSwitchStmt
2024-10-25 10:35:02 +02:00
Andreas Dangel c179834288 [release] Prepare next development version [skip ci] 2024-10-25 09:28:54 +02:00
Andreas Dangel 7739f2b840 [release] prepare release pmd_releases/7.7.0 2024-10-25 09:07:54 +02:00
Andreas Dangel 919e73f6b0 Prepare pmd release 7.7.0 2024-10-25 08:47:38 +02:00
Andreas Dangel e2d59c0e64 Fix #5244: [java] UselessOperationOnImmutable: consider java.time.* types (#5279)
Merge pull request #5279 from adangel:issue-5244
2024-10-24 14:24:16 +02:00
Andreas Dangel 8f2d47dfb7 Fix #5270: [apex] AvoidNonRestrictiveQueries: Fix regex for detecting LIMIT clause (#5273)
Merge pull request #5273 from adangel:issue-5270
2024-10-24 14:22:25 +02:00
Andreas Dangel e6097d6090 [java] Rename rule SwitchStmtsShouldHaveDefault to NonExhaustiveSwitch (#5267)
Merge pull request #5267 from adangel:issue-4286
2024-10-24 14:21:04 +02:00
Andreas Dangel 5e83246469 [doc] Update release notes (#5267) 2024-10-24 14:16:43 +02:00
Andreas Dangel 62c2858f70 Fix #5257: [java] NonCaseLabelInSwitch - support switch expressions (#5256)
Merge pull request #5256 from adangel:rename-nocaselabelswitch
2024-10-24 14:15:06 +02:00
Andreas Dangel 0d8878d58e [java] Rename rule DefaultLabelNotLastInSwitch (#5255)
Merge pull request #5255 from adangel:rename-defaultlabelswitch
2024-10-24 14:10:16 +02:00
Andreas Dangel 4b23718aac Fix #4813: [java] SwitchStmtsShouldHaveDefault false positive with pattern matching (#5252)
Merge pull request #5252 from adangel:issue-4813
2024-10-24 14:08:12 +02:00
Andreas Dangel 3a501a0f6b Fix #5249 and #5250: [java] TooFewBranchesForSwitch ignore pattern matching and support switch expressions (#5251)
Merge pull request #5251 from adangel:issue-5249-5250
2024-10-24 14:06:03 +02:00
Andreas Dangel 36654ed52e [java] UselessOperationOnImmutable: false positive on void results 2024-10-24 13:08:09 +02:00
Andreas Dangel 45b1217485 [java] TooFewBranchesForSwitch: don't report empty switch
Empty switch statements are already reported
by EmptyControlStatement
2024-10-24 12:51:42 +02:00
Andreas Dangel 662759755d [java] SwitchStmtsShouldHaveDefault.xml: don't report empty switch
Empty switch statements are already reported
by EmptyControlStatement
2024-10-24 12:47:53 +02:00
Andreas Dangel d9d6b57f2a [java] TooFewBranchesForSwitch: report empty switch
This fixes a false negative
2024-10-24 12:38:45 +02:00
Andreas Dangel 6c35c73919 [java] SwitchStmtsShouldHaveDefault: use new PatternLabel attribute 2024-10-24 11:29:40 +02:00
Andreas Dangel e37f82b62d Merge branch 'main' into issue-4813 2024-10-24 11:24:17 +02:00
Andreas Dangel 6f5af6e585 [java] TooFewBranchesForSwitch: use new PatternLabel attribute 2024-10-24 11:22:47 +02:00
Andreas Dangel 66d879f707 Merge branch 'main' into issue-5249-5250 2024-10-24 11:20:39 +02:00
Andreas Dangel 93f6279ea7 Fix #3362: [java] ImplicitSwitchFallThrough should consider switch expressions (#5248) 2024-10-24 10:46:59 +02:00
Andreas Dangel 156f293ef3 Fix #5030: [java] SwitchDensity false positive with pattern matching (#5247) 2024-10-24 10:45:56 +02:00
Andreas Dangel 40ed4590be [java] Improve UnitTestShouldUse{After,Before}Annotation rules to support JUnit5 and TestNG (#5245) 2024-10-24 10:43:48 +02:00
Andreas Dangel 7358289bbe [cpp] Ignore literals and ignore identifiers capability to C++ CPD (#5040)
Merge pull request #5040 from jdupak:master
2024-10-24 10:18:39 +02:00
Andreas Dangel a180258033 [doc] Update release notes (#5040) 2024-10-24 10:17:51 +02:00
Andreas Dangel 63675eaa18 [doc] Update release notes (#5279) 2024-10-22 21:03:22 +02:00
Andreas Dangel 49f2c15b83 [doc] Update release notes (#5273) 2024-10-22 21:01:42 +02:00
Andreas Dangel 15520211b5 Merge branch 'main' into issue-5270 2024-10-22 21:01:00 +02:00
Andreas Dangel c4b8f18a36 [doc] Update release notes (#5252) 2024-10-22 20:58:37 +02:00
Andreas Dangel c95817a75d Merge branch 'main' into issue-4813 2024-10-22 20:55:38 +02:00
Andreas DangelandClément Fournier 09b0864eff Apply suggestions from code review
Co-authored-by: Clément Fournier <clement.fournier@tu-dresden.de>
2024-10-22 20:50:10 +02:00
dependabot[bot] 1517a18956 Bump org.scala-lang:scala-reflect from 2.13.13 to 2.13.15 (#5281)
Bumps [org.scala-lang:scala-reflect](https://github.com/scala/scala) from 2.13.13 to 2.13.15.
- [Release notes](https://github.com/scala/scala/releases)
- [Commits](https://github.com/scala/scala/compare/v2.13.13...v2.13.15)

---
updated-dependencies:
- dependency-name: org.scala-lang:scala-reflect
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-22 20:23:50 +02:00
Willem Hajenius 61b1c372cd [apex] Must use case-insensitive input stream to avoid choking on Unicode escape sequences 2024-10-22 12:27:28 +02:00
Juan Martín Sotuyo Dodero 97fe389dcc Bump danger from 9.5.0 to 9.5.1 in the all-gems group across 1 directory (#5280) 2024-10-21 11:28:12 -03:00
dependabot[bot] 7df70ea7c1 Bump danger from 9.5.0 to 9.5.1 in the all-gems group across 1 directory
Bumps the all-gems group with 1 update in the / directory: [danger](https://github.com/danger/danger).


Updates `danger` from 9.5.0 to 9.5.1
- [Release notes](https://github.com/danger/danger/releases)
- [Changelog](https://github.com/danger/danger/blob/master/CHANGELOG.md)
- [Commits](https://github.com/danger/danger/compare/v9.5.0...v9.5.1)

---
updated-dependencies:
- dependency-name: danger
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: all-gems
...

Signed-off-by: dependabot[bot] <support@github.com>
2024-10-21 03:18:38 +00:00
Jakub Dupak 7ad4e0f0fc Add @jdupak as a contributor 2024-10-20 21:57:48 +02:00
Jakub Dupak c47f5a6062 [cpd] Add ignore literals and identifiers capability to C++ 2024-10-20 21:57:48 +02:00
Andreas Dangel 6d55f6f053 [java] UselessOperationOnImmutable: consider java.time.* types
Fixes #5244
2024-10-18 17:42:44 +02:00
dependabot[bot]andAndreas Dangel b60b4d8a68 Bump com.google.protobuf:protobuf-java from 3.25.3 to 4.28.2 (#5234)
* Bump com.google.protobuf:protobuf-java from 3.25.3 to 4.28.2

Bumps [com.google.protobuf:protobuf-java](https://github.com/protocolbuffers/protobuf) from 3.25.3 to 4.28.2.
- [Release notes](https://github.com/protocolbuffers/protobuf/releases)
- [Changelog](https://github.com/protocolbuffers/protobuf/blob/main/protobuf_release.bzl)
- [Commits](https://github.com/protocolbuffers/protobuf/commits)

---
updated-dependencies:
- dependency-name: com.google.protobuf:protobuf-java
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Cleanup comment about protobuf dependency

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Andreas Dangel <andreas.dangel@pmd-code.org>
2024-10-18 16:42:52 +02:00
Andreas Dangel 5df7dccfb6 [doc] Update release notes (#5255) 2024-10-18 16:40:27 +02:00
Andreas Dangel f4941433ce Merge branch 'main' into rename-defaultlabelswitch 2024-10-18 16:39:12 +02:00
Andreas Dangel 665504decc [doc] Update release notes (#5251) 2024-10-18 16:30:41 +02:00
Andreas Dangel ef0db9a166 Merge branch 'main' into issue-5249-5250 2024-10-18 16:30:01 +02:00
Andreas Dangel fd8fcd67d6 [doc] Update release notes (#5248) 2024-10-18 16:23:17 +02:00
Andreas Dangel dafdc964a5 Merge branch 'main' into issue-3362 2024-10-18 16:22:17 +02:00
Andreas Dangel 81429a4628 [doc] Update release notes (#5247) 2024-10-18 16:21:02 +02:00
Andreas Dangel fb94e2493c Merge branch 'main' into issue-5030 2024-10-18 16:20:11 +02:00
Andreas Dangel a0d4b38b53 [doc] Update release notes (#5245) 2024-10-18 16:16:54 +02:00
Andreas Dangel f317e8bee5 Merge branch 'main' into java-unit-test-rules 2024-10-18 16:15:51 +02:00
dependabot[bot] 99f4c9c044 Bump org.checkerframework:checker-qual from 2.11.1 to 3.48.1 (#5276)
Bumps [org.checkerframework:checker-qual](https://github.com/typetools/checker-framework) from 2.11.1 to 3.48.1.
- [Release notes](https://github.com/typetools/checker-framework/releases)
- [Changelog](https://github.com/typetools/checker-framework/blob/master/docs/CHANGELOG.md)
- [Commits](https://github.com/typetools/checker-framework/compare/checker-framework-2.11.1...checker-framework-3.48.1)

---
updated-dependencies:
- dependency-name: org.checkerframework:checker-qual
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-10-18 16:04:35 +02:00
Andreas Dangel 656b9052ad [java] CouplingBetweenObjects: improve violation message (#5278)
Merge pull request #5278 from adangel:coupling-between-objects-message
2024-10-18 15:40:54 +02:00
Andreas Dangel f0375d61dd [doc] Update release notes (#5278) 2024-10-18 15:39:52 +02:00
Andreas Dangel a24c8aa002 [doc] Update release notes 2024-10-18 15:36:28 +02:00
Andreas Dangel 5ffb953191 [java] CouplingBetweenObjects: improve violation message
When we add the actual count to the message,
we can more easily verify that the rule works
as expected.
2024-10-18 10:42:42 +02:00
Juan Martín Sotuyo Dodero d5faa1c74a Merge pull request #5275 from adangel/javacc-wrapper-improvement
Use plugin-classpath to simplify javacc-wrapper.xml
2024-10-13 23:54:54 -03:00
Andreas Dangel 867b142ee4 Use plugin-classpath to simplify javacc-wrapper.xml
javacc is on the antrun plugin's classpath.
The javacc jar file doesn't need to be copied
explicitly.
2024-10-13 12:28:16 +02:00
Andreas Dangel 0ea42b94e0 Ignore generated antlr classes in coverage reports (#5258)
Merge pull request #5258 from Monits:ignore-generated-antlr
2024-10-13 12:27:30 +02:00
Andreas Dangel f834b8744d [doc] Update release notes (#5258) 2024-10-13 12:26:31 +02:00
Juan Martín Sotuyo Dodero ab1976382a Remove ant.contrib.jar property 2024-10-12 17:28:18 -03:00
Andreas Dangel 08bcf29190 [java] Fix #5253: Support Boolean wrapper class for BooleanGetMethodName rule (#5269)
Merge pull request #5269 from Aryant-Tripathi:5253/feature/support-boolean-wrapper-in-get-method-rule
2024-10-12 18:04:14 +02:00
Andreas Dangel 85e0695ca6 Add @Aryant-Tripathi as a contributor 2024-10-12 18:02:07 +02:00
Andreas Dangel 47a59b1810 Add @phansys as a contributor 2024-10-12 18:01:45 +02:00
Andreas Dangel e50234563e [doc] Update release notes (#5253, #5269) 2024-10-12 18:01:21 +02:00
Aryant Tripathi 9a123bff94 Support wrapper class in BooleanGetMethodName rule (#5253)\n \n - Updated XPath rule to include both primitive and wrapper class:\n (PrimitiveType[@Kind = 'boolean'] or ClassType[pmd-java:typeIs('java.lang.Boolean')])\n - Added test cases to ensure that methods returning are also flagged correctly.\n - Ensured the rule enforces consistent method naming for both primitive and wrapper types. 2024-10-11 22:37:01 +05:30
Aryant Tripathi 9077c6a71f Support wrapper class in BooleanGetMethodName rule (#5253)\n \n - Updated XPath rule to include both primitive and wrapper class:\n (PrimitiveType[@Kind = 'boolean'] or ClassType[pmd-java:typeIs('java.lang.Boolean')])\n - Added test cases to ensure that methods returning are also flagged correctly.\n - Ensured the rule enforces consistent method naming for both primitive and wrapper types. 2024-10-11 22:34:07 +05:30
Aryant Tripathi 36f713b4c7 Merge branch 'pmd:main' into 5253/feature/support-boolean-wrapper-in-get-method-rule 2024-10-11 22:30:29 +05:30
Aryant Tripathi ed6312e3ba Support wrapper class in BooleanGetMethodName rule (#5253)\n \n - Updated XPath rule to include both primitive and wrapper class:\n (PrimitiveType[@Kind = 'boolean'] or ClassType[pmd-java:typeIs('java.lang.Boolean')])\n - Added test cases to ensure that methods returning are also flagged correctly.\n - Ensured the rule enforces consistent method naming for both primitive and wrapper types. 2024-10-11 22:29:42 +05:30
Andreas Dangel 8ac55e7ad7 Bump org.junit from 5.8.2 to 5.11.2 (#5274)
Also update junit-platform from 1.10.2 to 1.11.2

- Supersedes and closes #5260
- Supersedes and closes #5259
2024-10-11 16:42:42 +02:00
Andreas Dangel 6bd7a9db8e [java] Fix NPE with empty pattern list (#5264)
Merge pull request #5264 from oowekyala:issue5261-npe-record-empty-components
2024-10-11 12:36:26 +02:00
Andreas Dangel 7655cfc63b Add @gudzpoz as a contributor 2024-10-11 12:35:45 +02:00
Andreas Dangel fbde9b967f [doc] Update release notes (#5261, #5264) 2024-10-11 12:35:19 +02:00
Andreas Dangel 7ae3155325 Add @thesunlover as a contributor 2024-10-11 11:57:39 +02:00
Andreas Dangel c595fea83f [apex] AvoidNonRestrictiveQueries: Fix regex for detecting LIMIT clause
Fixes #5270
2024-10-11 11:57:10 +02:00
Aryant Tripathi 8b2af2db8a Support wrapper class in BooleanGetMethodName rule (#5253)
- Updated XPath rule to include both  primitive and  wrapper class:
                  (PrimitiveType[@Kind = 'boolean'] or ClassType[pmd-java:typeIs('java.lang.Boolean')])
                - Added test cases to ensure that methods returning  are also flagged correctly.
                - Ensured the rule enforces consistent method naming for both primitive and wrapper types.
2024-10-10 20:44:06 +05:30
Aryant Tripathi 54dfabea9b Support Boolean wrapper class for BooleanGetMethodName rule (#5253) 2024-10-09 10:00:02 +05:30
Andreas Dangel 07840cace2 [java] Rename rule SwitchStmtsShouldHaveDefault to NonExhaustiveSwitch
Fixes #4286
2024-10-08 17:33:32 +02:00
Andreas Dangel ff1b9b2cdd [java] SwitchStmtsShouldHaveDefault - test for multiple case constants 2024-10-08 17:15:18 +02:00
Clément Fournier b724b4dd33 Fix DataflowPassTest 2024-10-07 18:18:32 +02:00
Clément Fournier 2c1a7f026e Fix NPE with empty pattern list 2024-10-07 16:51:50 +02:00
Juan Martín Sotuyo Dodero f68130eaf9 Annotate Antlr generated classes for PMD languages 2024-10-06 20:07:47 -03:00
Juan Martín Sotuyo Dodero 31018611c6 Add missing lexer properties 2024-10-06 20:07:37 -03:00
Juan Martín Sotuyo Dodero e3cd599da2 Add @Generated annotations to cpd Antlr languages 2024-10-06 19:58:43 -03:00
Juan Martín Sotuyo Dodero ca71d76553 Include up-to-date-check to Antlr4 cpd
- Prevent unnecessary re-runs
2024-10-06 19:48:30 -03:00
Juan Martín Sotuyo Dodero 93a019765d Fix incorrect properties 2024-10-06 17:24:42 -03:00
Juan Martín Sotuyo Dodero 00bf6fe2f7 Fix @since for @Generated 2024-10-06 17:21:30 -03:00
Andreas Dangel 377670f267 [doc] Update release notes (#5257) 2024-10-06 18:48:47 +02:00
Andreas Dangel 5ecc29245b Fix externalInfoUrl after rename 2024-10-05 11:37:45 +02:00
Andreas Dangel 079eb238b9 [java] NonCaseLabelInSwitch - support switch expressions
Rename rule from NonCaseLabelInSwitchStatement

- as it applies to both switch statements and switch expressions
- extend the test cases to cover new java syntax
2024-10-05 11:19:53 +02:00
Andreas Dangel b3157825d8 [java] Rename rule DefaultLabelNotLastInSwitch
- as it applies to both switch statements and switch expressions
- extend the test cases to cover new java syntax

Note: For patterns in switch, the java compiler already makes sure, that
default is the last case.
2024-10-05 11:00:13 +02:00
Andreas Dangel 6f081e111a Update pmd-java/src/test/resources/net/sourceforge/pmd/lang/java/rule/performance/xml/TooFewBranchesForSwitch.xml 2024-10-05 10:41:10 +02:00
Andreas Dangel 59403fc9e1 [java] SwitchStmtsShouldHaveDefault - also ignore record pattern 2024-10-05 10:39:55 +02:00
Andreas Dangel 13cc79af62 [java] TooFewBranchesForSwitch - also ignore record pattern 2024-10-05 10:36:39 +02:00
Andreas Dangel 1f31f771ad [java] SwitchDensity - more tests with (record) patterns 2024-10-05 10:31:40 +02:00
Andreas Dangel d9db4dbcab [java] Rename TooFewBranchesForSwitch in quickstart.xml 2024-10-05 10:19:03 +02:00
Andreas Dangel 855e5175d4 [java] Renamed rule TooFewBranchesForSwitch
as it consider Switch Expressions now
additionally to Switch Statements.
2024-10-04 17:48:56 +02:00
Andreas Dangel b87944a565 [java] TooFewBranchesForSwitch should consider Switch Expressions
Fixes #5250
2024-10-04 17:48:49 +02:00
Andreas Dangel 90f436fd28 [java] TooFewBranchesForSwitch should ignore Pattern Matching
Fixes #5249
2024-10-04 17:47:21 +02:00
Andreas Dangel 375fb72f3c [java] Fix tree dump test
New SwitchLabel#PatternLabel flag
2024-10-04 17:32:46 +02:00
Andreas Dangel 49deb8d4a0 [java] SwitchDensity false positive with pattern matching
Fixes #5030
2024-10-04 17:12:29 +02:00
Andreas Dangel 312d8e46ae [java] ImplicitSwitchFallThrough should consider switch expressions
Fixes #3362
2024-10-04 16:45:29 +02:00
Andreas Dangel e5ff5532d4 Update @emouty as a contributor 2024-10-04 16:05:46 +02:00
Andreas Dangel 0c858b0a7b [java] SwitchStmtsShouldHaveDefault should ignore patterns
Fixes #4813
2024-10-04 16:05:45 +02:00
Andreas Dangel a0818d5ab2 [doc] Document renamed/old rule names 2024-10-04 15:54:21 +02:00
Andreas Dangel 5ce4d292fa [java] Fix #5067: CloseResource: False positive for FileSystems.getDefault() (#5225)
Merge pull request #5225 from lukasgraef:issue5067
2024-10-04 10:06:18 +02:00
Andreas Dangel d2c42d2426 [doc] Update release notes (#5067, #5225) 2024-10-04 10:05:48 +02:00
Andreas Dangel c6fd064054 Merge branch 'main' into pr-5225 2024-10-04 10:02:40 +02:00
Andreas Dangel 07cd250a74 Fix release_notes.md 2024-10-04 10:00:53 +02:00
Andreas Dangel c0023dd942 [java] Rename UnitTestShouldIncludeAssert again
to make it consistent and always use singular "UnitTest"
Follow-up on #4532 and #4965
2024-10-04 09:32:55 +02:00
Andreas Dangel 9fbaa4fbfb [java] Update quickstart.xml with renamed UnitTest* rules 2024-10-04 09:25:21 +02:00
Juan Martín Sotuyo Dodero 7d4961f303 Update README.md
Point coveralls to main branch
2024-10-03 17:47:01 -03:00
Andreas Dangel 9337e5a7a2 [java] UnitTestShouldUseAfterAnnotation: Consider JUnit 5 and TestNG 2024-10-03 20:55:11 +02:00
Andreas Dangel 33c737718c [java] UnitTestShouldUseBeforeAnnotation: Consider JUnit 5 and TestNG 2024-10-03 20:55:10 +02:00
Andreas Dangel b7c4a5e492 Ignore javacc code in coverage report (#5241)
Merge pull request #5241 from Monits:ignore-javacc-code
2024-10-03 20:30:41 +02:00
Andreas Dangel d77a63da95 [doc] Update release notes (#5241) 2024-10-03 20:29:53 +02:00
Andreas Dangel 463ca964dc [java] Rename JUnit rules with overly restrictive names (#4965)
Merge pull request #4965 from Monits:issue-4532
2024-10-03 20:07:50 +02:00
Andreas Dangel 57497738c1 [doc] Update release notes (#4532, #4965) 2024-10-03 20:06:21 +02:00
Andreas Dangel 525435bd68 [java] Keep bestpractices.xml sorted alphabetically 2024-10-03 19:59:29 +02:00
Andreas Dangel c5246eca46 Renamed JUnit4TestShouldUseAfterAnnotation
- call it UnitTest... to be agnostic to the testing framework
2024-10-03 19:52:56 +02:00
Andreas Dangel 4796da0fb2 Renamed JUnit4TestShouldUseBeforeAnnotation
- call it UnitTest... to be agnostic to the testing framework
2024-10-03 19:51:13 +02:00
lukasgraef 7dcab3f189 Fix static analysis findings 2024-09-30 20:48:20 +02:00
lukasgraef 39b8bdf171 Review Finding: Check for type java.nio.FileSystems 2024-09-30 20:13:01 +02:00
Andreas Dangel 5fe19b2096 [release] Prepare next development version [skip ci] 2024-09-27 11:43:22 +02:00
lukasgraef ddb1eb8dd8 [java] Fix #5067: CloseResource: False positive for FileSystems.getDefault() 2024-09-21 16:03:36 +02:00
Juan Martín Sotuyo Dodero cae71e7a5e Be consistent in how we replace tokens 2024-09-17 17:09:29 -03:00
Juan Martín Sotuyo Dodero 029130a478 Use a custom annotation to ignore javacc generated code 2024-09-17 17:00:42 -03:00
Juan Martín Sotuyo Dodero 0253b9d3cd Ignore generated-sources in coverage reports
- We don't test it directly, nor is it our job
 - A bad grammar won't be processed, or fail in subtle ways only
   detectable in specific tests on the AST (which is included)
2024-09-14 01:33:20 -03:00
Juan Martín Sotuyo Dodero f24635b55c Merge branch 'master' into issue-4532 2024-04-28 05:15:50 +02:00
Juan Martín Sotuyo Dodero 5b42381061 Reintroduce old class names
- Don't break API compatibility, and set everything for removal in PMD 8
2024-04-27 22:11:39 -03:00
Juan Martín Sotuyo Dodero 61a7459247 Update changelog 2024-04-17 17:00:05 -03:00
Juan Martín Sotuyo Dodero bd89f9185b Typo 2024-04-17 16:42:37 -03:00
Juan Martín Sotuyo Dodero 7725897373 Rename JUnit4TestShouldUseTestAnnotation
- The rule is now called UnitTestShouldUseTestAnnotation as it applies
   to both JUnit and TestNG.
 - The doc is further improved to reflect this.
2024-04-17 16:42:37 -03:00
Juan Martín Sotuyo Dodero 9f1ab89d31 Rename JUnitTestsShouldIncludeAssertRule
- It's now called UnitTestsShouldIncludeAssertRule as it applies to
   JUnit and TestNG
 - The doc is updated to reflect this
2024-04-17 16:42:37 -03:00
Juan Martín Sotuyo Dodero ffec30f392 Rename JUnitTestContainsTooManyAssertsRule
- The rule is now called UnitTestContainsTooManyAssertsRule as it
   checks for JUnit and TestNG.
 - This is further cleared up in the documentation.
2024-04-17 16:42:37 -03:00
Juan Martín Sotuyo Dodero 5301a8e852 Rename JUnitAssertionsShouldIncludeMessageRule
- The rule is now called UnitTestAssertionsShouldIncludeMessageRule as
   it applies to JUnit and TestNG.
 - The doc is updated to reflect this.
2024-04-17 16:42:37 -03:00
Juan Martín Sotuyo Dodero 691731cdd4 Rename JUnit4TestShouldUseAfterAnnotation
- Call it JUnitTestShouldUseAfterAnnotation instead as it not only
   applies to JUnit4
 - Improve the doc to further clarify it's usages
2024-04-17 16:42:37 -03:00
Juan Martín Sotuyo Dodero 55686dbef4 Rename JUnit4TestShouldUseBeforeAnnotation
- Call it JUnitTestShouldUseBeforeAnnotation as it applies to JUnit 4
   and 5.
 - Improve the doc to clarify it's intended use.
2024-04-17 16:42:37 -03:00
204 changed files with 11776 additions and 1701 deletions

No files matched your search

+75 -1
View File
@@ -7453,7 +7453,8 @@
"avatar_url": "https://avatars.githubusercontent.com/u/16755668?v=4",
"profile": "https://github.com/emouty",
"contributions": [
"code"
"code",
"bug"
]
},
{
@@ -7516,6 +7517,7 @@
"avatar_url": "https://avatars.githubusercontent.com/u/18402464?v=4",
"profile": "https://github.com/mitchspano",
"contributions": [
"code",
"bug"
]
},
@@ -7819,6 +7821,78 @@
"contributions": [
"bug"
]
},
{
"login": "thesunlover",
"name": "Iskren Stanislavov",
"avatar_url": "https://avatars.githubusercontent.com/u/6734600?v=4",
"profile": "https://interop.io/",
"contributions": [
"bug"
]
},
{
"login": "gudzpoz",
"name": "gudzpoz",
"avatar_url": "https://avatars.githubusercontent.com/u/14026120?v=4",
"profile": "https://kyo.iroiro.party/",
"contributions": [
"bug"
]
},
{
"login": "phansys",
"name": "Javier Spagnoletti",
"avatar_url": "https://avatars.githubusercontent.com/u/1231441?v=4",
"profile": "https://github.com/phansys",
"contributions": [
"bug"
]
},
{
"login": "Aryant-Tripathi",
"name": "Aryant Tripathi",
"avatar_url": "https://avatars.githubusercontent.com/u/60316716?v=4",
"profile": "https://github.com/Aryant-Tripathi",
"contributions": [
"code"
]
},
{
"login": "jdupak",
"name": "Jakub Dupak",
"avatar_url": "https://avatars.githubusercontent.com/u/22683640?v=4",
"profile": "https://github.com/jdupak",
"contributions": [
"code"
]
},
{
"login": "chenguangqi",
"name": "天热吃西瓜",
"avatar_url": "https://avatars.githubusercontent.com/u/6231010?v=4",
"profile": "http://chenguangqi.github.io/",
"contributions": [
"bug"
]
},
{
"login": "wahajenius",
"name": "Willem A. Hajenius",
"avatar_url": "https://avatars.githubusercontent.com/u/7836322?v=4",
"profile": "https://github.com/wahajenius",
"contributions": [
"code"
]
},
{
"login": "VitaliiIevtushenko",
"name": "Vitalii Yevtushenko",
"avatar_url": "https://avatars.githubusercontent.com/u/11145125?v=4",
"profile": "https://github.com/VitaliiIevtushenko",
"contributions": [
"bug"
]
}
],
"contributorsPerLine": 7,
+16 -12
View File
@@ -3,6 +3,7 @@ GEM
specs:
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
base64 (0.2.0)
bigdecimal (3.1.8)
claide (1.1.0)
claide-plugins (0.9.2)
@@ -13,7 +14,8 @@ GEM
concurrent-ruby (1.3.4)
cork (0.3.0)
colored2 (~> 3.1)
danger (9.5.0)
danger (9.5.1)
base64 (~> 0.2)
claide (~> 1.0)
claide-plugins (>= 0.9.2)
colored2 (~> 3.1)
@@ -24,12 +26,14 @@ GEM
kramdown (~> 2.3)
kramdown-parser-gfm (~> 1.0)
octokit (>= 4.0)
pstore (~> 0.1)
terminal-table (>= 1, < 4)
differ (0.1.2)
et-orbi (1.2.11)
tzinfo
faraday (2.11.0)
faraday (2.12.0)
faraday-net_http (>= 2.0, < 3.4)
json
logger
faraday-http-cache (2.5.1)
faraday (>= 0.8)
@@ -41,19 +45,20 @@ GEM
git (1.19.1)
addressable (~> 2.8)
rchardet (~> 1.8)
json (2.7.5)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
kramdown (~> 2.0)
liquid (5.5.1)
logger (1.6.0)
logger (1.6.1)
logger-colors (1.0.0)
nap (1.1.0)
net-http (0.4.1)
uri
nokogiri (1.16.7-x86_64-linux)
racc (~> 1.4)
octokit (9.1.0)
octokit (9.2.0)
faraday (>= 1, < 3)
sawyer (~> 0.9)
open4 (1.3.4)
@@ -64,26 +69,25 @@ GEM
nokogiri (~> 1.13)
rufus-scheduler (~> 3.8)
slop (~> 4.9)
pstore (0.1.3)
public_suffix (6.0.1)
raabro (1.4.0)
racc (1.8.1)
rchardet (1.8.0)
rexml (3.3.6)
strscan
rouge (4.4.0)
rufus-scheduler (3.9.1)
fugit (~> 1.1, >= 1.1.6)
rexml (3.3.9)
rouge (4.5.1)
rufus-scheduler (3.9.2)
fugit (~> 1.1, >= 1.11.1)
safe_yaml (1.0.5)
sawyer (0.9.2)
addressable (>= 2.3.5)
faraday (>= 0.17.3, < 3)
slop (4.10.1)
strscan (3.1.0)
terminal-table (3.0.2)
unicode-display_width (>= 1.1.1, < 3)
tzinfo (2.0.6)
concurrent-ruby (~> 1.0)
unicode-display_width (2.5.0)
unicode-display_width (2.6.0)
uri (0.13.1)
PLATFORMS
@@ -98,4 +102,4 @@ DEPENDENCIES
safe_yaml
BUNDLED WITH
2.5.3
2.5.22
+1 -1
View File
@@ -6,7 +6,7 @@
[![Build Status](https://github.com/pmd/pmd/actions/workflows/build.yml/badge.svg?branch=main)](https://github.com/pmd/pmd/actions)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd/badge.svg)](https://maven-badges.herokuapp.com/maven-central/net.sourceforge.pmd/pmd)
[![Reproducible Builds](https://img.shields.io/badge/Reproducible_Builds-ok-green?labelColor=blue)](https://github.com/jvm-repo-rebuild/reproducible-central/tree/master/content/net/sourceforge/pmd#readme)
[![Coverage Status](https://coveralls.io/repos/github/pmd/pmd/badge.svg)](https://coveralls.io/github/pmd/pmd)
[![Coverage Status](https://coveralls.io/repos/github/pmd/pmd/badge.svg?branch=main)](https://coveralls.io/github/pmd/pmd?branch=main)
[![Codacy Badge](https://app.codacy.com/project/badge/Grade/ea550046a02344ec850553476c4aa2ca)](https://app.codacy.com/organizations/gh/pmd/dashboard)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](code_of_conduct.md)
[![Documentation (latest)](https://img.shields.io/badge/docs-latest-green)](https://docs.pmd-code.org/latest/)
+96 -5
View File
@@ -11,10 +11,11 @@
- root-node-name: name of the root node without prefix (eg "TopLevel"), will be made to implement RootNode
See AntlrGeneratedParserBase
-->
<taskdef resource="net/sf/antcontrib/antcontrib.properties" />
<property name="target-package-dir" value="${antlr4.outputDirectory}/net/sourceforge/pmd/lang/${lang-id}/ast"/>
<property name="stamp-file" value="${project.build.directory}/last-generated-timestamp" />
<property name="lang-ast-package" value="net.sourceforge.pmd.lang.${lang-id}.ast" />
@@ -32,14 +33,100 @@
<property name="base-visitor-file" value="${target-package-dir}/${base-visitor-name}.java"/>
<property name="listener-name" value="${lang-name}Listener"/>
<property name="listener-file" value="${target-package-dir}/${visitor-name}.java"/>
<property name="listener-file" value="${target-package-dir}/${listener-name}.java"/>
<property name="base-listener-name" value="${lang-name}BaseListener"/>
<property name="base-listener-file" value="${target-package-dir}/${base-visitor-name}.java"/>
<property name="base-listener-file" value="${target-package-dir}/${base-listener-name}.java"/>
<property name="node-itf-name" value="${lang-name}Node"/>
<property name="base-class-name" value="Abstract${lang-name}Node"/>
<property name="lexer-name" value="${lang-name}Lexer"/>
<property name="lexer-file" value="${target-package-dir}/${lexer-name}.java"/>
<target name="check-up-to-date"
description="Checks the input files are up to date">
<uptodate property="processing-not-required" targetfile="${stamp-file}">
<srcfiles dir="${target-package-dir}" includes="*.java" />
<srcfiles file="${ant.file}" />
</uptodate>
<echo message="Up-to-date check: processing-not-required=${processing-not-required}" />
</target>
<target name="update-stamp-file" unless="processing-not-required">
<touch file="${stamp-file}" />
</target>
<target name="annotate-classes" description="Adds the @Generated annotation to all classes"
unless="processing-not-required">
<if>
<available file="${parser-file}"/>
<then>
<replace file="${parser-file}"
token="public class ${parser-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public class ${parser-name}'/>
<!-- Parse tree classes for each element -->
<replace file="${parser-file}"
token="public static class "
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public static class '/>
</then>
</if>
<if>
<available file="${visitor-file}"/>
<then>
<replace file="${visitor-file}"
token="public interface ${visitor-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public interface ${visitor-name}'/>
</then>
</if>
<if>
<available file="${base-visitor-file}"/>
<then>
<replace file="${base-visitor-file}"
token="public class ${base-visitor-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public class ${base-visitor-name}'/>
</then>
</if>
<if>
<available file="${listener-file}"/>
<then>
<replace file="${listener-file}"
token="public interface ${listener-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public interface ${listener-name}'/>
</then>
</if>
<if>
<available file="${base-listener-file}"/>
<then>
<replace file="${base-listener-file}"
token="public class ${base-listener-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public class ${base-listener-name}'/>
</then>
</if>
<if>
<available file="${lexer-file}"/>
<then>
<replace file="${lexer-file}"
token="public class ${lexer-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.antlr.v4.Tool")${line.separator}
public class ${lexer-name}'/>
</then>
</if>
</target>
<condition property="rename-parser">
<and>
<not>
@@ -72,7 +159,9 @@
tofile="${parser-file}"/>
</target>
<target name="cpd-language" description="Adapt Antlr sources for CPD-only languages">
<target name="cpd-language" depends="check-up-to-date, annotate-classes, cpd-language-processing, update-stamp-file"/>
<target name="cpd-language-processing" description="Adapt Antlr sources for CPD-only languages"
unless="processing-not-required">
<!-- We only need the Lexer file. -->
<delete file="${parser-file}"/>
<delete>
@@ -83,7 +172,9 @@
</delete>
</target>
<target name="pmd-language" description="Adapt Antlr sources for PMD languages" depends="rename-parser">
<target name="pmd-language" depends="check-up-to-date, rename-parser, annotate-classes, pmd-language-processing, update-stamp-file"/>
<target name="pmd-language-processing" description="Adapt Antlr sources for PMD languages"
unless="processing-not-required">
<!-- Adapt parser. -->
<replace file="${parser-file}">
+12 -10
View File
@@ -1,8 +1,9 @@
GEM
remote: https://rubygems.org/
specs:
activesupport (7.2.1)
activesupport (7.2.2)
base64
benchmark (>= 0.3)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.3.1)
connection_pool (>= 2.2.5)
@@ -15,6 +16,7 @@ GEM
addressable (2.8.7)
public_suffix (>= 2.0.2, < 7.0)
base64 (0.2.0)
benchmark (0.3.0)
bigdecimal (3.1.8)
coffee-script (2.4.1)
coffee-script-source
@@ -34,9 +36,10 @@ GEM
ethon (0.16.0)
ffi (>= 1.15.0)
eventmachine (1.2.7)
execjs (2.9.1)
faraday (2.11.0)
execjs (2.10.0)
faraday (2.12.0)
faraday-net_http (>= 2.0, < 3.4)
json
logger
faraday-net_http (3.3.0)
net-http
@@ -99,7 +102,7 @@ GEM
activesupport (>= 2)
nokogiri (>= 1.4)
http_parser.rb (0.8.0)
i18n (1.14.5)
i18n (1.14.6)
concurrent-ruby (~> 1.0)
jekyll (3.10.0)
addressable (~> 2.4)
@@ -211,6 +214,7 @@ GEM
gemoji (>= 3, < 5)
html-pipeline (~> 2.2)
jekyll (>= 3.0, < 5.0)
json (2.7.5)
kramdown (2.4.0)
rexml
kramdown-parser-gfm (1.1.0)
@@ -219,7 +223,7 @@ GEM
listen (3.9.0)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
logger (1.6.0)
logger (1.6.1)
mercenary (0.3.6)
minima (2.5.1)
jekyll (>= 3.5, < 5.0)
@@ -240,8 +244,7 @@ GEM
rb-fsevent (0.11.2)
rb-inotify (0.11.1)
ffi (~> 1.0)
rexml (3.3.6)
strscan
rexml (3.3.9)
rouge (3.30.0)
rubyzip (2.3.2)
safe_yaml (1.0.5)
@@ -255,7 +258,6 @@ GEM
faraday (>= 0.17.3, < 3)
securerandom (0.3.1)
simpleidn (0.2.3)
strscan (3.1.0)
terminal-table (1.8.0)
unicode-display_width (~> 1.1, >= 1.1.1)
typhoeus (1.4.1)
@@ -264,7 +266,7 @@ GEM
concurrent-ruby (~> 1.0)
unicode-display_width (1.8.0)
uri (0.13.1)
webrick (1.8.2)
webrick (1.9.0)
PLATFORMS
x86_64-linux
@@ -276,4 +278,4 @@ DEPENDENCIES
webrick
BUNDLED WITH
2.5.3
2.5.22
+3 -3
View File
@@ -1,9 +1,9 @@
repository: pmd/pmd
pmd:
version: 7.6.0
previous_version: 7.5.0
date: 2024-09-27
version: 7.8.0-SNAPSHOT
previous_version: 7.7.0
date: 2024-11-29
# release types: major, minor, bugfix
release_type: minor
File diff suppressed because it is too large. Load diff
+2 -2
View File
@@ -163,7 +163,7 @@ exactly identical.
{% include custom/cli_option_row.html options="--ignore-literals"
description="Ignore literal values such as numbers and strings when comparing text.
By default, literals are not ignored."
languages="Java"
languages="Java, C++"
%}
{% include custom/cli_option_row.html options="--ignore-literal-sequences"
description="Ignore sequences of literals such as list initializers.
@@ -173,7 +173,7 @@ exactly identical.
{% include custom/cli_option_row.html options="--ignore-identifiers"
description="Ignore names of classes, methods, variables, constants, etc. when comparing text.
By default, identifier names are not ignored."
languages="Java"
languages="Java, C++"
%}
{% include custom/cli_option_row.html options="--ignore-annotations"
description="Ignore language annotations (Java) or attributes (C#) when comparing text.
+55 -79
View File
@@ -14,94 +14,70 @@ This is a {{ site.pmd.release_type }} release.
### 🚀 New and noteworthy
#### New Git default branch - "main"
### 🌟 New and changed rules
We are joining the Git community and updating "master" to "main". Using the term "master" for the main
development branch can be offensive to some people. Existing versions of Git have been always capable of
working with any branch name and since 2.28.0 (July 2020) the default initial branch is configurable
(`init.defaultBranch`). Since October 2020, the default branch for new repositories on GitHub
is "main". Finally, PMD will also use this new name for the main branch in all our own repositories.
Why "main"? PMD uses a very simple branching model - pull requests with feature branches and one main development
branch, from which releases are created. That's why "main" is currently the best fitting name.
More information:
- <https://sfconservancy.org/news/2020/jun/23/gitbranchname/>
- <https://github.blog/changelog/2020-10-01-the-default-branch-for-newly-created-repositories-is-now-main/>
What changes?
- We change the default branch on GitHub, so that pull requests are automatically created against `main` from
now on.
- If you have already a local clone of PMD's repository, you'll need to rename the old master branch locally:
```
git branch --move master main
git fetch origin
git branch --set-upstream-to=origin/main main
git remote set-head origin --auto
```
More info:
<https://git-scm.com/book/en/v2/Git-Branching-Branch-Management#_changing_master> and
<https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/renaming-a-branch#updating-a-local-clone-after-a-branch-name-changes>
- If you created a fork on GitHub, you'll need to change the default branch in your fork to `main` as
well (Settings > Default Branch).
- Some time after this release, we'll delete the old master branch on GitHub. Then only `main` can be used.
- This change is expanded to the other PMD repositories as well, e.g. pmd-designer and pmd-regression-tester.
#### New Rules
* The new Apex rule {% rule apex/bestpractices/QueueableWithoutFinalizer %} detects when the Queueable interface
is used but a Finalizer is not attached. Without attaching a Finalizer, there is no way of designing error
recovery actions should the Queueable action fail.
### 🐛 Fixed Issues
* ant
* [#1860](https://github.com/pmd/pmd/issues/1860): \[ant] Reflective access warnings on java > 9 and java < 17
* apex
* [#5138](https://github.com/pmd/pmd/issues/5138): \[apex] Various false-negatives since 7.3.0 when using triggers
(ApexCRUDViolation, CognitiveComplexity, OperationWithLimitsInLoop)
* [#5163](https://github.com/pmd/pmd/issues/5163): \[apex] Parser error when using toLabel in SOSL query
* [#5182](https://github.com/pmd/pmd/issues/5182): \[apex] Parser error when using GROUPING in a SOQL query
* [#5218](https://github.com/pmd/pmd/issues/5218): \[apex] Parser error when using nested subqueries in SOQL
* [#5228](https://github.com/pmd/pmd/issues/5228): \[apex] Parser error when using convertCurrency() in SOQL
* core
* [#5059](https://github.com/pmd/pmd/issues/5059): \[core] xml output doesn't escape CDATA inside its own CDATA
* [#5201](https://github.com/pmd/pmd/issues/5201): \[core] PMD sarif schema file points to nonexistent location
* [#5222](https://github.com/pmd/pmd/issues/5222): \[core] RuleReference/RuleSetWriter don't handle changed default property values correctly
* [#5229](https://github.com/pmd/pmd/issues/5229): \[doc] CLI flag `--show-suppressed` needs to mention xml, html, summaryhtml
* [#5302](https://github.com/pmd/pmd/issues/5302): \[apex] New Rule: Queueable Should Attach Finalizer
* [#5333](https://github.com/pmd/pmd/issues/5333): \[apex] Token recognition errors for string containing unicode escape sequence
* html
* [#5322](https://github.com/pmd/pmd/issues/5322): \[html] CPD throws exception on when HTML file is missing closing tag
* java
* [#5190](https://github.com/pmd/pmd/issues/5190): \[java] NPE in type inference
* [#5293](https://github.com/pmd/pmd/issues/5293): \[java] Deadlock when executing PMD in multiple threads
* [#5324](https://github.com/pmd/pmd/issues/5324): \[java] Issue with type inference of nested lambdas
* [#5329](https://github.com/pmd/pmd/issues/5329): \[java] Type inference issue with unknown method ref in call chain
* java-bestpractices
* [#5083](https://github.com/pmd/pmd/issues/5083): \[java] UnusedPrivateMethod false positive when method reference has no target type
* [#5097](https://github.com/pmd/pmd/issues/5097): \[java] UnusedPrivateMethod FP with raw type missing from the classpath
* [#5318](https://github.com/pmd/pmd/issues/5318): \[java] PreserveStackTraceRule: false-positive on Pattern Matching with instanceof
* java-codestyle
* [#5046](https://github.com/pmd/pmd/issues/5046): \[java] LocalVariableCouldBeFinal false positive with try/catch
* java-errorprone
* [#5068](https://github.com/pmd/pmd/issues/5068): \[java] MissingStaticMethodInNonInstantiatableClass: false positive with builder pattern
* [#5207](https://github.com/pmd/pmd/issues/5207): \[java] CheckSkipResult: false positve for a private method `void skip(int)` in a subclass of FilterInputStream
* [#5263](https://github.com/pmd/pmd/issues/5263): \[java] UnnecessaryFullyQualifiedName: false-positive in an enum that uses its own static variables
* java-performance
* [#5287](https://github.com/pmd/pmd/issues/5287): \[java] TooFewBranchesForSwitch false-positive with switch using list of case constants
* [#5314](https://github.com/pmd/pmd/issues/5314): \[java] InsufficientStringBufferDeclarationRule: Lack of handling for char type parameters
### 🚨 API Changes
No changes.
#### Deprecations
* pmd-gherkin
* {%jdoc gherkin::lang.gherkin.ast.GherkinBaseListener %} is deprecated for removal. This class was never intended
to be generated. It will be removed with no replacement.
* {%jdoc gherkin::lang.gherkin.ast.GherkinBaseVisitor %} is deprecated for removal. This class was never intended
to be generated. It will be removed with no replacement.
* {%jdoc gherkin::lang.gherkin.ast.GherkinListener %} is deprecated for removal. This class was never intended
to be generated. It will be removed with no replacement.
* {%jdoc gherkin::lang.gherkin.ast.GherkinParser %} is deprecated for removal. This class was never intended
to be generated. It will be removed with no replacement.
* {%jdoc gherkin::lang.gherkin.ast.GherkinVisitor %} is deprecated for removal. This class was never intended
to be generated. It will be removed with no replacement.
* pmd-julia
* {%jdoc julia::lang.julia.ast.JuliaBaseListener %} is deprecated for removal. This class was never intended to
be generated. It will be removed with no replacement.
* {%jdoc julia::lang.julia.ast.JuliaBaseVisitor %} is deprecated for removal. This class was never intended to
be generated. It will be removed with no replacement.
* {%jdoc julia::lang.julia.ast.JuliaListener %} is deprecated for removal. This class was never intended to
be generated. It will be removed with no replacement.
* {%jdoc julia::lang.julia.ast.JuliaParser %} is deprecated for removal. This class was never intended to
be generated. It will be removed with no replacement.
* {%jdoc julia::lang.julia.ast.JuliaVisitor %} is deprecated for removal. This class was never intended to
be generated. It will be removed with no replacement.
* pmd-kotlin
* {%jdoc kotlin::lang.kotlin.ast.UnicodeClasses %} is deprecated for removal. This class was never intended to
be generated. It will be removed with no replacement.
* pmd-xml
* {%jdoc xml::lang.xml.antlr4.XMLLexer %} is deprecated for removal. Use {%jdoc !!xml::lang.xml.ast.XMLLexer %}
instead (note different package `ast` instead of `antlr4`).
### ✨ Merged pull requests
* [#5186](https://github.com/pmd/pmd/pull/5186): \[java] Cleanup things about implicit classes - [Clément Fournier](https://github.com/oowekyala) (@oowekyala)
* [#5188](https://github.com/pmd/pmd/pull/5188): \[apex] Use new apex-parser 4.2.0 - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5191](https://github.com/pmd/pmd/pull/5191): \[java] Fix #5046 - FPs in LocalVariableCouldBeFinal - [Clément Fournier](https://github.com/oowekyala) (@oowekyala)
* [#5192](https://github.com/pmd/pmd/pull/5192): \[java] Fix #5190 - NPE in type inference caused by null type - [Clément Fournier](https://github.com/oowekyala) (@oowekyala)
* [#5195](https://github.com/pmd/pmd/pull/5195): \[apex] Fix various FNs when using triggers - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5202](https://github.com/pmd/pmd/pull/5202): \[core] Sarif format: refer to schemastore.org - [David Schach](https://github.com/dschach) (@dschach)
* [#5208](https://github.com/pmd/pmd/pull/5208): \[doc] Added Codety to "Tools / Integrations" - [Tony](https://github.com/random1223) (@random1223)
* [#5210](https://github.com/pmd/pmd/pull/5210): \[core] Fix PMD's XMLRenderer to escape CDATA - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5211](https://github.com/pmd/pmd/pull/5211): Change branch master to main - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5212](https://github.com/pmd/pmd/pull/5212): \[java] Adjust signature matching in CheckSkipResultRule - [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod)
* [#5223](https://github.com/pmd/pmd/pull/5223): \[core] Fix RuleReference / RuleSetWriter handling of properties - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5224](https://github.com/pmd/pmd/pull/5224): \[java] Fix #5068: Class incorrectly identified as non-instantiatable - [Lukas Gräf](https://github.com/lukasgraef) (@lukasgraef)
* [#5230](https://github.com/pmd/pmd/pull/5230): \[doc] Documentation update for --show-suppressed flag - [David Schach](https://github.com/dschach) (@dschach)
* [#5237](https://github.com/pmd/pmd/pull/5237): \[apex] Support convertCurrency() in SOQL/SOSL - [Andreas Dangel](https://github.com/adangel) (@adangel)
### 📦 Dependency updates
* [#5185](https://github.com/pmd/pmd/issues/5185): Bump checkstyle from 10.14.0 to 10.18.1
* [#5187](https://github.com/pmd/pmd/issues/5187): Bump org.apache.maven.plugins:maven-install-plugin from 3.1.1 to 3.1.3
* [#5199](https://github.com/pmd/pmd/issues/5199): Bump org.apache.maven.plugins:maven-deploy-plugin from 3.1.1 to 3.1.3
* [#5216](https://github.com/pmd/pmd/issues/5216): Bump com.github.siom79.japicmp:japicmp-maven-plugin from 0.20.0 to 0.23.0
* [#5226](https://github.com/pmd/pmd/issues/5226): Bump rouge from 4.3.0 to 4.4.0 in the all-gems group across 1 directory
* [#5227](https://github.com/pmd/pmd/issues/5227): Bump com.google.code.gson:gson from 2.10.1 to 2.11.0
* [#5232](https://github.com/pmd/pmd/issues/5232): Bump com.google.protobuf:protobuf-java from 3.25.3 to 3.25.5
* [#5233](https://github.com/pmd/pmd/issues/5233): Bump webrick from 1.8.1 to 1.8.2 in /docs
### 📈 Stats
* 60 commits
* 27 closed tickets & PRs
* Days since last release: 27
### ✨ External Contributions
* [#5284](https://github.com/pmd/pmd/pull/5284): \[apex] Use case-insensitive input stream to avoid choking on Unicode escape sequences - [Willem A. Hajenius](https://github.com/wahajenius) (@wahajenius)
* [#5303](https://github.com/pmd/pmd/pull/5303): \[apex] New Rule: Queueable Should Attach Finalizer - [Mitch Spano](https://github.com/mitchspano) (@mitchspano)
{% endtocmaker %}
+234
View File
@@ -5,6 +5,240 @@ permalink: pmd_release_notes_old.html
Previous versions of PMD can be downloaded here: [Releases - pmd/pmd (GitHub)](https://github.com/pmd/pmd/releases)
## 25-October-2024 - 7.7.0
The PMD team is pleased to announce PMD 7.7.0.
This is a minor release.
### Table Of Contents
* [🚀 New and noteworthy](#new-and-noteworthy)
* [CPD can now ignore literals and identifiers in C++ code](#cpd-can-now-ignore-literals-and-identifiers-in-c-code)
* [🌟 Rule Changes](#rule-changes)
* [Changed Rules](#changed-rules)
* [Renamed Rules](#renamed-rules)
* [🐛 Fixed Issues](#fixed-issues)
* [🚨 API Changes](#api-changes)
* [✨ Merged pull requests](#merged-pull-requests)
* [📦 Dependency updates](#dependency-updates)
* [📈 Stats](#stats)
### 🚀 New and noteworthy
#### CPD can now ignore literals and identifiers in C++ code
When searching for duplicated code in C++ differences in literals or identifiers can be
ignored now (like in Java). This can be enabled via the command line options `--ignore-literal`
and `--ignore-identifiers`.
See [PR #5040](https://github.com/pmd/pmd/pull/5040) for details.
### 🌟 Rule Changes
#### Changed Rules
* [`SwitchStmtsShouldHaveDefault`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#switchstmtsshouldhavedefault) (Java Best Practices) doesn't report empty switch statements anymore.
To detect these, use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_codestyle.html#emptycontrolstatement).
* [`UnitTestShouldUseAfterAnnotation`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestshoulduseafterannotation) (Java Best Practices) now also considers JUnit 5 and TestNG tests.
* [`UnitTestShouldUseBeforeAnnotation`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestshouldusebeforeannotation) (Java Best Practices) now also considers JUnit 5 and TestNG tests.
* [`TooFewBranchesForSwitch`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_performance.html#toofewbranchesforswitch) (Java Performance) doesn't report empty switches anymore.
To detect these, use [`EmptyControlStatement`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_codestyle.html#emptycontrolstatement).
#### Renamed Rules
* Several rules for unit testing have been renamed to better reflect their actual scope. Lots of them were called
after JUnit / JUnit 4, even when they applied to JUnit 5 and / or TestNG.
* [`UnitTestAssertionsShouldIncludeMessage`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestassertionsshouldincludemessage) (Java Best Practices) has been renamed from `JUnitAssertionsShouldIncludeMessage`.
* [`UnitTestContainsTooManyAsserts`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestcontainstoomanyasserts) (Java Best Practices) has been renamed from `JUnitTestContainsTooManyAsserts`.
* [`UnitTestShouldIncludeAssert`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestshouldincludeassert) (Java Best Practices) has been renamed from `JUnitTestsShouldIncludeAssert`.
* [`UnitTestShouldUseAfterAnnotation`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestshoulduseafterannotation) (Java Best Practices) has been renamed from `JUnit4TestShouldUseAfterAnnotation`.
* [`UnitTestShouldUseBeforeAnnotation`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestshouldusebeforeannotation) (Java Best Practices) has been renamed from `JUnit4TestShouldUseBeforeAnnotation`.
* [`UnitTestShouldUseTestAnnotation`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestshouldusetestannotation) (Java Best Practices) has been renamed from `JUnit4TestShouldUseTestAnnotation`.
* Several rules about switch statements and switch expression have been renamed, as they apply both to Switch Statements
and to Switch Expressions:
* [`DefaultLabelNotLastInSwitch`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#defaultlabelnotlastinswitch) (Java Best Practices) has been renamed from `DefaultLabelNotLastInSwitchStmt`.
* [`NonCaseLabelInSwitch`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_errorprone.html#noncaselabelinswitch) (Java Error Prone) has been renamed from `NonCaseLabelInSwitchStatement`.
* [`TooFewBranchesForSwitch`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_performance.html#toofewbranchesforswitch) (Java Performance) has been renamed from `TooFewBranchesForASwitchStatement`.
* [`NonExhaustiveSwitch`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#nonexhaustiveswitch) (Java Best Practices) has been renamed from `SwitchStmtsShouldHaveDefault`.
The old rule names still work but are deprecated.
### 🐛 Fixed Issues
* apex-performance
* [#5270](https://github.com/pmd/pmd/issues/5270): \[apex] AvoidNonRestrictiveQueries when LIMIT is followed by bind expression
* java
* [#4532](https://github.com/pmd/pmd/issues/4532): \[java] Rule misnomer for JUnit* rules
* [#5261](https://github.com/pmd/pmd/issues/5261): \[java] Record patterns with empty deconstructor lists lead to NPE
* java-bestpractices
* [#4286](https://github.com/pmd/pmd/issues/4286): \[java] Rename rule SwitchStmtsShouldHaveDefault to NonExhaustiveSwitch
* [#4813](https://github.com/pmd/pmd/issues/4813): \[java] SwitchStmtsShouldHaveDefault false positive with pattern matching
* java-codestyle
* [#5253](https://github.com/pmd/pmd/issues/5253): \[java] BooleanGetMethodName: False-negatives with `Boolean` wrapper
* java-design
* [#5030](https://github.com/pmd/pmd/issues/5030): \[java] SwitchDensity false positive with pattern matching
* java-errorprone
* [#3362](https://github.com/pmd/pmd/issues/3362): \[java] ImplicitSwitchFallThrough should consider switch expressions
* [#5067](https://github.com/pmd/pmd/issues/5067): \[java] CloseResource: False positive for FileSystems.getDefault()
* [#5244](https://github.com/pmd/pmd/issues/5244): \[java] UselessOperationOnImmutable should detect java.time types
* [#5257](https://github.com/pmd/pmd/issues/5257): \[java] NonCaseLabelInSwitch should consider switch expressions
* java-performance
* [#5249](https://github.com/pmd/pmd/issues/5249): \[java] TooFewBranchesForASwitchStatement false positive for Pattern Matching
* [#5250](https://github.com/pmd/pmd/issues/5250): \[java] TooFewBranchesForASwitchStatement should consider Switch Expressions
### 🚨 API Changes
* java-bestpractices
* The old rule name `JUnit4TestShouldUseAfterAnnotation` has been deprecated. Use the new name [`UnitTestShouldUseAfterAnnotation`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestshoulduseafterannotation) instead.
* The old rule name `JUnit4TestShouldUseBeforeAnnotation` has been deprecated. Use the new name [`UnitTestShouldUseBeforeAnnotation`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestshouldusebeforeannotation) instead.
* The old rule name `JUnit4TestShouldUseTestAnnotation` has been deprecated. Use the new name [`UnitTestShouldUseTestAnnotation`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestshouldusetestannotation) instead.
* The old rule name `JUnitAssertionsShouldIncludeMessage` has been deprecated. Use the new name [`UnitTestAssertionsShouldIncludeMessage`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestassertionsshouldincludemessage) instead.
* The old rule name `JUnitTestContainsTooManyAsserts` has been deprecated. Use the new name [`UnitTestContainsTooManyAsserts`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestcontainstoomanyasserts) instead.
* The old rule name `JUnitTestsShouldIncludeAssert` has been deprecated. Use the new name [`UnitTestShouldIncludeAssert`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#unittestshouldincludeassert) instead.
* The old rule name `DefaultLabelNotLastInSwitchStmt` has been deprecated. Use the new name [`DefaultLabelNotLastInSwitch`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#defaultlabelnotlastinswitch) instead.
* The old rule name `SwitchStmtsShouldHaveDefault` has been deprecated. USe the new name [`NonExhaustiveSwitch`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_bestpractices.html#nonexhaustiveswitch) instead.
* java-errorprone
* The old rule name `NonCaseLabelInSwitchStatement` has been deprecated. Use the new name [`NonCaseLabelInSwitch`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_errorprone.html#noncaselabelinswitch) instead.
* java-performance
* The old rule name `TooFewBranchesForASwitchStatement` has been deprecated. Use the new name [`TooFewBranchesForSwitch`](https://docs.pmd-code.org/pmd-doc-7.7.0/pmd_rules_java_performance.html#toofewbranchesforswitch) instead.
### ✨ Merged pull requests
* [#4965](https://github.com/pmd/pmd/pull/4965): Fix #4532: \[java] Rename JUnit rules with overly restrictive names - [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod)
* [#5040](https://github.com/pmd/pmd/pull/5040): \[cpp] Ignore literals and ignore identifiers capability to C++ CPD - [Jakub Dupak](https://github.com/jdupak) (@jdupak)
* [#5225](https://github.com/pmd/pmd/pull/5225): Fix #5067: \[java] CloseResource: False positive for FileSystems.getDefault() - [Lukas Gräf](https://github.com/lukasgraef) (@lukasgraef)
* [#5241](https://github.com/pmd/pmd/pull/5241): Ignore javacc code in coverage report - [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod)
* [#5245](https://github.com/pmd/pmd/pull/5245): \[java] Improve UnitTestShouldUse{After,Before}Annotation rules to support JUnit5 and TestNG - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5247](https://github.com/pmd/pmd/pull/5247): Fix #5030: \[java] SwitchDensity false positive with pattern matching - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5248](https://github.com/pmd/pmd/pull/5248): Fix #3362: \[java] ImplicitSwitchFallThrough should consider switch expressions - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5251](https://github.com/pmd/pmd/pull/5251): Fix #5249 and #5250: \[java] TooFewBranchesForSwitch ignore pattern matching and support switch expressions - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5252](https://github.com/pmd/pmd/pull/5252): Fix #4813: \[java] SwitchStmtsShouldHaveDefault false positive with pattern matching - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5255](https://github.com/pmd/pmd/pull/5255): \[java] Rename rule DefaultLabelNotLastInSwitch - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5256](https://github.com/pmd/pmd/pull/5256): Fix #5257: \[java] NonCaseLabelInSwitch - support switch expressions - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5258](https://github.com/pmd/pmd/pull/5258): Ignore generated antlr classes in coverage reports - [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod)
* [#5264](https://github.com/pmd/pmd/pull/5264): Fix #5261: \[java] Fix NPE with empty pattern list - [Clément Fournier](https://github.com/oowekyala) (@oowekyala)
* [#5267](https://github.com/pmd/pmd/pull/5267): \[java] Rename rule SwitchStmtsShouldHaveDefault to NonExhaustiveSwitch - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5269](https://github.com/pmd/pmd/pull/5269): Fix #5253: \[java] Support Boolean wrapper class for BooleanGetMethodName rule - [Aryant Tripathi](https://github.com/Aryant-Tripathi) (@Aryant-Tripathi)
* [#5273](https://github.com/pmd/pmd/pull/5273): Fix #5270: \[apex] AvoidNonRestrictiveQueries: Fix regex for detecting LIMIT clause - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5275](https://github.com/pmd/pmd/pull/5275): Use plugin-classpath to simplify javacc-wrapper.xml - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5278](https://github.com/pmd/pmd/pull/5278): \[java] CouplingBetweenObjects: improve violation message - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5279](https://github.com/pmd/pmd/pull/5279): Fix #5244: \[java] UselessOperationOnImmutable: consider java.time.* types - [Andreas Dangel](https://github.com/adangel) (@adangel)
### 📦 Dependency updates
* [#5234](https://github.com/pmd/pmd/issues/5234): Bump com.google.protobuf:protobuf-java from 3.25.3 to 4.28.2
* [#5274](https://github.com/pmd/pmd/issues/5274): Bump org.junit from 5.8.2 to 5.11.2
* [#5276](https://github.com/pmd/pmd/issues/5276): Bump org.checkerframework:checker-qual from 2.11.1 to 3.48.1
* [#5280](https://github.com/pmd/pmd/issues/5280): Bump danger from 9.5.0 to 9.5.1 in the all-gems group across 1 directory
* [#5281](https://github.com/pmd/pmd/issues/5281): Bump org.scala-lang:scala-reflect from 2.13.13 to 2.13.15
### 📈 Stats
* 98 commits
* 32 closed tickets & PRs
* Days since last release: 27
## 27-September-2024 - 7.6.0
The PMD team is pleased to announce PMD 7.6.0.
This is a minor release.
### Table Of Contents
* [🚀 New and noteworthy](#new-and-noteworthy)
* [New Git default branch - "main"](#new-git-default-branch---main)
* [🐛 Fixed Issues](#fixed-issues)
* [🚨 API Changes](#api-changes)
* [✨ Merged pull requests](#merged-pull-requests)
* [📦 Dependency updates](#dependency-updates)
* [📈 Stats](#stats)
### 🚀 New and noteworthy
#### New Git default branch - "main"
We are joining the Git community and updating "master" to "main". Using the term "master" for the main
development branch can be offensive to some people. Existing versions of Git have been always capable of
working with any branch name and since 2.28.0 (July 2020) the default initial branch is configurable
(`init.defaultBranch`). Since October 2020, the default branch for new repositories on GitHub
is "main". Finally, PMD will also use this new name for the main branch in all our own repositories.
Why "main"? PMD uses a very simple branching model - pull requests with feature branches and one main development
branch, from which releases are created. That's why "main" is currently the best fitting name.
More information:
- <https://sfconservancy.org/news/2020/jun/23/gitbranchname/>
- <https://github.blog/changelog/2020-10-01-the-default-branch-for-newly-created-repositories-is-now-main/>
What changes?
- We change the default branch on GitHub, so that pull requests are automatically created against `main` from
now on.
- If you have already a local clone of PMD's repository, you'll need to rename the old master branch locally:
```
git branch --move master main
git fetch origin
git branch --set-upstream-to=origin/main main
git remote set-head origin --auto
```
More info:
<https://git-scm.com/book/en/v2/Git-Branching-Branch-Management#_changing_master> and
<https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/managing-branches-in-your-repository/renaming-a-branch#updating-a-local-clone-after-a-branch-name-changes>
- If you created a fork on GitHub, you'll need to change the default branch in your fork to `main` as
well (Settings > Default Branch).
- Some time after this release, we'll delete the old master branch on GitHub. Then only `main` can be used.
- This change is expanded to the other PMD repositories as well, e.g. pmd-designer and pmd-regression-tester.
### 🐛 Fixed Issues
* apex
* [#5138](https://github.com/pmd/pmd/issues/5138): \[apex] Various false-negatives since 7.3.0 when using triggers
(ApexCRUDViolation, CognitiveComplexity, OperationWithLimitsInLoop)
* [#5163](https://github.com/pmd/pmd/issues/5163): \[apex] Parser error when using toLabel in SOSL query
* [#5182](https://github.com/pmd/pmd/issues/5182): \[apex] Parser error when using GROUPING in a SOQL query
* [#5218](https://github.com/pmd/pmd/issues/5218): \[apex] Parser error when using nested subqueries in SOQL
* [#5228](https://github.com/pmd/pmd/issues/5228): \[apex] Parser error when using convertCurrency() in SOQL
* core
* [#5059](https://github.com/pmd/pmd/issues/5059): \[core] xml output doesn't escape CDATA inside its own CDATA
* [#5201](https://github.com/pmd/pmd/issues/5201): \[core] PMD sarif schema file points to nonexistent location
* [#5222](https://github.com/pmd/pmd/issues/5222): \[core] RuleReference/RuleSetWriter don't handle changed default property values correctly
* [#5229](https://github.com/pmd/pmd/issues/5229): \[doc] CLI flag `--show-suppressed` needs to mention xml, html, summaryhtml
* java
* [#5190](https://github.com/pmd/pmd/issues/5190): \[java] NPE in type inference
* java-codestyle
* [#5046](https://github.com/pmd/pmd/issues/5046): \[java] LocalVariableCouldBeFinal false positive with try/catch
* java-errorprone
* [#5068](https://github.com/pmd/pmd/issues/5068): \[java] MissingStaticMethodInNonInstantiatableClass: false positive with builder pattern
* [#5207](https://github.com/pmd/pmd/issues/5207): \[java] CheckSkipResult: false positve for a private method `void skip(int)` in a subclass of FilterInputStream
### 🚨 API Changes
No changes.
### ✨ Merged pull requests
* [#5186](https://github.com/pmd/pmd/pull/5186): \[java] Cleanup things about implicit classes - [Clément Fournier](https://github.com/oowekyala) (@oowekyala)
* [#5188](https://github.com/pmd/pmd/pull/5188): \[apex] Use new apex-parser 4.2.0 - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5191](https://github.com/pmd/pmd/pull/5191): \[java] Fix #5046 - FPs in LocalVariableCouldBeFinal - [Clément Fournier](https://github.com/oowekyala) (@oowekyala)
* [#5192](https://github.com/pmd/pmd/pull/5192): \[java] Fix #5190 - NPE in type inference caused by null type - [Clément Fournier](https://github.com/oowekyala) (@oowekyala)
* [#5195](https://github.com/pmd/pmd/pull/5195): \[apex] Fix various FNs when using triggers - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5202](https://github.com/pmd/pmd/pull/5202): \[core] Sarif format: refer to schemastore.org - [David Schach](https://github.com/dschach) (@dschach)
* [#5208](https://github.com/pmd/pmd/pull/5208): \[doc] Added Codety to "Tools / Integrations" - [Tony](https://github.com/random1223) (@random1223)
* [#5210](https://github.com/pmd/pmd/pull/5210): \[core] Fix PMD's XMLRenderer to escape CDATA - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5211](https://github.com/pmd/pmd/pull/5211): Change branch master to main - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5212](https://github.com/pmd/pmd/pull/5212): \[java] Adjust signature matching in CheckSkipResultRule - [Juan Martín Sotuyo Dodero](https://github.com/jsotuyod) (@jsotuyod)
* [#5223](https://github.com/pmd/pmd/pull/5223): \[core] Fix RuleReference / RuleSetWriter handling of properties - [Andreas Dangel](https://github.com/adangel) (@adangel)
* [#5224](https://github.com/pmd/pmd/pull/5224): \[java] Fix #5068: Class incorrectly identified as non-instantiatable - [Lukas Gräf](https://github.com/lukasgraef) (@lukasgraef)
* [#5230](https://github.com/pmd/pmd/pull/5230): \[doc] Documentation update for --show-suppressed flag - [David Schach](https://github.com/dschach) (@dschach)
* [#5237](https://github.com/pmd/pmd/pull/5237): \[apex] Support convertCurrency() in SOQL/SOSL - [Andreas Dangel](https://github.com/adangel) (@adangel)
### 📦 Dependency updates
* [#5185](https://github.com/pmd/pmd/issues/5185): Bump checkstyle from 10.14.0 to 10.18.1
* [#5187](https://github.com/pmd/pmd/issues/5187): Bump org.apache.maven.plugins:maven-install-plugin from 3.1.1 to 3.1.3
* [#5199](https://github.com/pmd/pmd/issues/5199): Bump org.apache.maven.plugins:maven-deploy-plugin from 3.1.1 to 3.1.3
* [#5216](https://github.com/pmd/pmd/issues/5216): Bump com.github.siom79.japicmp:japicmp-maven-plugin from 0.20.0 to 0.23.0
* [#5226](https://github.com/pmd/pmd/issues/5226): Bump rouge from 4.3.0 to 4.4.0 in the all-gems group across 1 directory
* [#5227](https://github.com/pmd/pmd/issues/5227): Bump com.google.code.gson:gson from 2.10.1 to 2.11.0
* [#5232](https://github.com/pmd/pmd/issues/5232): Bump com.google.protobuf:protobuf-java from 3.25.3 to 3.25.5
* [#5233](https://github.com/pmd/pmd/issues/5233): Bump webrick from 1.8.1 to 1.8.2 in /docs
### 📈 Stats
* 60 commits
* 27 closed tickets & PRs
* Days since last release: 27
## 30-August-2024 - 7.5.0
The PMD team is pleased to announce PMD 7.5.0.
+18 -21
View File
@@ -25,9 +25,9 @@
It also uses the following maven properties:
- javacc.outputDirectory: Directory in which to root the generated package tree
- javacc.jar: JAR of JavaCC in the local maven repository
- plugin-classpath: The classpath of maven-antrun-plugin with javacc.jar dependency
Provided by maven via "<property name="plugin-classpath" refid="maven.plugin.classpath"/>"
- some properties of project.build
-->
<condition property="lang-name-camelcase" value="${lang-name}">
@@ -40,8 +40,6 @@
<property name="target-package-dir" value="${javacc.outputDirectory}/net/sourceforge/pmd/lang/${lang-id}/ast" />
<property name="stamp-file" value="${project.build.directory}/last-generated-timestamp" />
<property name="javacc-home.path" value="${project.build.directory}/lib/javacc" />
<property name="lang-ast-package" value="net.sourceforge.pmd.lang.${lang-id}.ast" />
<property name="ast-api-package" value="net.sourceforge.pmd.lang.ast" />
<property name="ast-impl-package" value="${ast-api-package}.impl.javacc" />
@@ -84,7 +82,7 @@
<target name="alljavacc"
description="Generates JavaCC sources and cleans them up"
depends="checkUpToDate,init,jjtree,jjtree-ersatz,javacc,adapt-generated,default-visitor,cleanup" />
depends="checkUpToDate,init,jjtree,jjtree-ersatz,javacc,adapt-generated,default-visitor" />
<target name="checkUpToDate"
description="Checks the input files are up to date">
@@ -104,9 +102,6 @@
<target name="init" unless="javaccBuildNotRequired" description="Initialize build">
<mkdir dir="${javacc-home.path}" />
<copy file="${javacc.jar}" tofile="${javacc-home.path}/javacc.jar" />
<mkdir dir="${javacc.outputDirectory}" />
<touch file="${stamp-file}" />
<delete dir="${target-package-dir}" />
@@ -117,11 +112,6 @@
</condition>
</target>
<target name="cleanup" unless="javaccBuildNotRequired">
<delete dir="${javacc-home.path}" />
</target>
<target name="jjtree" unless="jjtreeBuildNotRequired" description="Runs JJTree">
<!--
@@ -130,7 +120,7 @@
-->
<java fork="true"
classname="jjtree"
classpath="${javacc-home.path}/javacc.jar">
classpath="${plugin-classpath}">
<sysproperty key="file.encoding" value="UTF-8" />
<arg value="-OUTPUT_DIRECTORY:${target-package-dir}" />
<arg value="-NODE_USES_PARSER:false" />
@@ -148,7 +138,7 @@
<target name="javacc" depends="jjtree" unless="javaccBuildNotRequired">
<java fork="true"
classname="javacc"
classpath="${javacc-home.path}/javacc.jar">
classpath="${plugin-classpath}">
<sysproperty key="file.encoding" value="UTF-8" />
<arg value="-STATIC:false" />
<arg value="-USER_CHAR_STREAM:true" />
@@ -224,6 +214,9 @@
<target name="cleanup-parser" unless="jjtreeBuildNotRequired">
<replace token="class ${parser-name}" value='@net.sourceforge.pmd.annotation.Generated("org.javacc.javacc")${line.separator}class ${parser-name}'>
<file name="${parser-file}" />
</replace>
<replace token="new Token()" value="token_source.input_stream.getTokenDocument().open()">
<file name="${parser-file}" />
@@ -262,7 +255,8 @@
<replaceregexp>
<regexp pattern="public interface"/>
<substitution expression="interface"/>
<substitution expression='@net.sourceforge.pmd.annotation.Generated("org.javacc.javacc")${line.separator}
interface'/>
<file name="${target-package-dir}/${parser-name}TreeConstants.java" />
</replaceregexp>
@@ -272,7 +266,8 @@
<replaceregexp>
<regexp pattern='(public )?class ${tokenmgr-name}' />
<substitution expression='class ${tokenmgr-name} extends ${base-tokenmgr}' />
<substitution expression='@net.sourceforge.pmd.annotation.Generated("org.javacc.javacc")${line.separator}
class ${tokenmgr-name} extends ${base-tokenmgr}' />
<file name="${tokenmgr-file}" />
</replaceregexp>
@@ -385,11 +380,12 @@
<replaceregexp>
<regexp pattern="(public )?interface ${constants-itf-name} \{" />
<substitution expression="/** Token kinds ({@link ${ast-impl-package}.JavaccToken#kind}) for this language. */${line.separator}
<substitution expression='/** Token kinds ({@link ${ast-impl-package}.JavaccToken#kind}) for this language. */${line.separator}
@net.sourceforge.pmd.annotation.InternalApi${line.separator}
@net.sourceforge.pmd.annotation.Generated("org.javacc.javacc")${line.separator}
public final class ${token-constants-name} \{${line.separator}
private ${token-constants-name}() { /* Utility class */ }${line.separator}
"/>
'/>
<file name="${token-constants-file}" />
</replaceregexp>
@@ -534,8 +530,9 @@ public final class ${token-constants-name} \{${line.separator}
<target name="default-visitor" depends="jjtree" unless="jjtreeBuildNotRequired">
<move file="${target-package-dir}/${gen-visitor-name}.java" tofile="${generic-visitor-interface-file}" />
<replace file="${generic-visitor-interface-file}">
<replacefilter token="${gen-visitor-name}"
value="${generic-visitor-interface-name}&lt;P, R> extends ${ast-api-package}.AstVisitor&lt;P, R>" />
<replacefilter token="public interface ${gen-visitor-name}"
value='@net.sourceforge.pmd.annotation.Generated("org.javacc.javacc")${line.separator}
public interface ${generic-visitor-interface-name}&lt;P, R> extends ${ast-api-package}.AstVisitor&lt;P, R>' />
<replacefilter token="SimpleNode" value="${node-name}" />
<!-- Root method, eg visitJavaNode -->
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<artifactId>pmd</artifactId>
<groupId>net.sourceforge.pmd</groupId>
<version>7.6.0</version>
<version>7.8.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
@@ -11,6 +11,7 @@ import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.nio.charset.Charset;
@@ -21,8 +22,6 @@ import java.util.List;
import java.util.Properties;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.reflect.FieldUtils;
import org.apache.commons.lang3.reflect.MethodUtils;
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.Parameter;
@@ -200,10 +199,12 @@ public class Formatter {
if (console != null) {
// Since Java 22, this returns a console even for redirected streams.
// In that case, we need to check Console.isTerminal()
// https://docs.oracle.com/en/java/javase/22/docs/api/java.base/java/io/Console.html#isTerminal()
// See: JLine As The Default Console Provider (JDK-8308591)
try {
Boolean isTerminal = (Boolean) MethodUtils.invokeMethod(console, "isTerminal");
if (!isTerminal) {
Method method = Console.class.getMethod("isTerminal");
Object isTerminal = method.invoke(console);
if (isTerminal instanceof Boolean && !(Boolean) isTerminal) {
// stop here, we don't have an interactive console.
return null;
}
@@ -211,39 +212,58 @@ public class Formatter {
// fall-through - we use a Java Runtime < 22.
}
// Maybe this is Java17+? Then there will be a public method charset()
// https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/Console.html#charset()
try {
Object res = FieldUtils.readDeclaredField(console, "cs", true);
if (res instanceof Charset) {
return ((Charset) res).name();
Method method = Console.class.getMethod("charset");
Object charset = method.invoke(console);
if (charset instanceof Charset) {
return ((Charset) charset).name();
}
} catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException ignored) {
// fall-through
}
{
// try to use the system property "sun.jnu.encoding", which is the platform encoding.
// this property is not specified and might not always be available, but it is for
// openjdk 11: https://github.com/openjdk/jdk11u/blob/cee8535a9d3de8558b4b5028d68e397e508bef71/src/java.base/share/native/libjava/System.c#L384
// if it exists, we use it - this avoids illegal reflective access below.
String jnuEncoding = System.getProperty("sun.jnu.encoding");
if (jnuEncoding != null) {
return jnuEncoding;
}
}
// the following parts are accessing private/protected fields via reflection
// this should work with Java 8 and 11. With Java 11, you'll see warnings abouts
// illegal reflective access, see #1860. However, the access still works.
// Fall-Back 1: private field "cs" in java.io.Console
try {
Field field = Console.class.getDeclaredField("cs");
field.setAccessible(true);
Object csField = field.get(console);
if (csField instanceof Charset) {
return ((Charset) csField).name();
}
} catch (IllegalArgumentException | ReflectiveOperationException ignored) {
// fall-through
}
// Maybe this is Java17+? Then there will be
// https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/Console.html#charset()
// instead of the field "cs".
// Fall-Back 2: private native method "encoding()" in java.io.Console
try {
Method charsetMethod = Console.class.getDeclaredMethod("charset");
Charset charset = (Charset) charsetMethod.invoke(console);
return charset.name();
} catch (IllegalArgumentException | ReflectiveOperationException ignored) {
Method method = Console.class.getDeclaredMethod("encoding");
method.setAccessible(true);
Object encoding = method.invoke(console);
if (encoding instanceof String) {
return (String) encoding;
}
} catch (InvocationTargetException | NoSuchMethodException | IllegalAccessException ignored) {
// fall-through
}
return getNativeConsoleEncoding();
}
return null;
}
private static String getNativeConsoleEncoding() {
try {
Object res = MethodUtils.invokeStaticMethod(Console.class, "encoding");
if (res instanceof String) {
return (String) res;
}
} catch (IllegalArgumentException | ReflectiveOperationException ignored) {
// fall-through
}
// we couldn't determine the correct platform console encoding
return null;
}
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>7.6.0</version>
<version>7.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -14,14 +14,19 @@ import java.util.List;
import java.util.Map;
import java.util.RandomAccess;
import org.antlr.v4.runtime.BaseErrorListener;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Recognizer;
import org.antlr.v4.runtime.Token;
import net.sourceforge.pmd.annotation.InternalApi;
import net.sourceforge.pmd.lang.ast.LexException;
import net.sourceforge.pmd.lang.document.TextDocument;
import net.sourceforge.pmd.lang.document.TextRegion;
import io.github.apexdevtools.apexparser.ApexLexer;
import io.github.apexdevtools.apexparser.CaseInsensitiveInputStream;
@InternalApi
final class ApexCommentBuilder {
@@ -103,7 +108,15 @@ final class ApexCommentBuilder {
}
private static CommentInformation extractInformationFromComments(TextDocument sourceCode, String suppressMarker) {
ApexLexer lexer = new ApexLexer(CharStreams.fromString(sourceCode.getText().toString()));
String source = sourceCode.getText().toString();
ApexLexer lexer = new ApexLexer(new CaseInsensitiveInputStream(CharStreams.fromString(source)));
lexer.removeErrorListeners();
lexer.addErrorListener(new BaseErrorListener() {
@Override
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line, int charPositionInLine, String msg, RecognitionException e) {
throw new LexException(line, charPositionInLine, sourceCode.getFileId(), msg, e);
}
});
List<Token> allCommentTokens = new ArrayList<>();
Map<Integer, String> suppressMap = new HashMap<>();
@@ -0,0 +1,92 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.apex.rule.bestpractices;
import java.util.List;
import org.checkerframework.checker.nullness.qual.NonNull;
import net.sourceforge.pmd.lang.apex.ast.ASTMethod;
import net.sourceforge.pmd.lang.apex.ast.ASTMethodCallExpression;
import net.sourceforge.pmd.lang.apex.ast.ASTParameter;
import net.sourceforge.pmd.lang.apex.ast.ASTUserClass;
import net.sourceforge.pmd.lang.apex.rule.AbstractApexRule;
import net.sourceforge.pmd.lang.rule.RuleTargetSelector;
/**
* Scans classes which implement the `Queueable` interface. If the `public void
* execute(QueueableContext context)` method does not call the
* `System.attachFinalizer(Finalizer f)` method, then a violation will be added
* to the `execute` method.
*
* @author mitchspano
*/
public class QueueableWithoutFinalizerRule extends AbstractApexRule {
private static final String EXECUTE = "execute";
private static final String QUEUEABLE = "queueable";
private static final String QUEUEABLE_CONTEXT = "queueablecontext";
private static final String SYSTEM_ATTACH_FINALIZER = "system.attachfinalizer";
@Override
protected @NonNull RuleTargetSelector buildTargetSelector() {
return RuleTargetSelector.forTypes(ASTUserClass.class);
}
/**
* If the class implements the `Queueable` interface and the
* `execute(QueueableContext context)` does not call the
* `System.attachFinalizer(Finalizer f)` method, then add a violation.
*/
@Override
public Object visit(ASTUserClass theClass, Object data) {
if (!implementsTheQueueableInterface(theClass)) {
return data;
}
for (ASTMethod theMethod : theClass.descendants(ASTMethod.class).toList()) {
if (isTheExecuteMethodOfTheQueueableInterface(theMethod)
&& !callsTheSystemAttachFinalizerMethod(theMethod)) {
asCtx(data).addViolation(theMethod);
}
}
return data;
}
/** Determines if the class implements the Queueable interface. */
private boolean implementsTheQueueableInterface(ASTUserClass theClass) {
for (String interfaceName : theClass.getInterfaceNames()) {
if (QUEUEABLE.equalsIgnoreCase(interfaceName)) {
return true;
}
}
return false;
}
/**
* Determines if the method is the `execute(QueueableContext context)`
* method. Parameter count is checked to account for method overloading.
*/
private boolean isTheExecuteMethodOfTheQueueableInterface(ASTMethod theMethod) {
if (!EXECUTE.equalsIgnoreCase(theMethod.getCanonicalName())) {
return false;
}
List<ASTParameter> parameters = theMethod.descendants(ASTParameter.class).toList();
return parameters.size() == 1 && QUEUEABLE_CONTEXT.equalsIgnoreCase(parameters.get(0).getType());
}
/**
* Determines if the method calls the `System.attachFinalizer(Finalizer f)`
* method.
*/
private boolean callsTheSystemAttachFinalizerMethod(ASTMethod theMethod) {
for (ASTMethodCallExpression methodCallExpression : theMethod.descendants(ASTMethodCallExpression.class)
.toList()) {
if (SYSTEM_ATTACH_FINALIZER.equalsIgnoreCase(methodCallExpression.getFullMethodName())) {
return true;
}
}
return false;
}
}
@@ -24,7 +24,7 @@ import net.sourceforge.pmd.lang.rule.RuleTargetSelector;
import net.sourceforge.pmd.reporting.RuleContext;
public class AvoidNonRestrictiveQueriesRule extends AbstractApexRule {
private static final Pattern RESTRICTIVE_PATTERN = Pattern.compile("(where\\s+)|(limit\\s+)", Pattern.CASE_INSENSITIVE);
private static final Pattern RESTRICTIVE_PATTERN = Pattern.compile("\\b(where|limit)\\b", Pattern.CASE_INSENSITIVE);
private static final Pattern SELECT_OR_FIND_PATTERN = Pattern.compile("(select\\s+|find\\s+)", Pattern.CASE_INSENSITIVE);
private static final Pattern SUB_QUERY_PATTERN = Pattern.compile("(?i)\\(\\s*select\\s+[^)]+\\)");
@@ -285,4 +285,56 @@ Detects when a local variable is declared and/or assigned but not used.
</example>
</rule>
<rule name="QueueableWithoutFinalizer"
since="7.8.0"
language="apex"
message="This Queueable doesn't attach a Finalizer"
class="net.sourceforge.pmd.lang.apex.rule.bestpractices.QueueableWithoutFinalizerRule"
externalInfoUrl="${pmd.website.baseurl}/pmd_rules_apex_bestpractices.html#queueablewithoutfinalizer">
<description>
Detects when the Queueable interface is used but a Finalizer is not attached.
It is best practice to call the `System.attachFinalizer(Finalizer f)` method within the `execute` method of a class which implements the `Queueable` interface.
Without attaching a Finalizer, there is no way of designing error recovery actions should the Queueable action fail.
</description>
<priority>5</priority>
<example>
<![CDATA[
// Incorrect code, does not attach a finalizer.
public class UserUpdater implements Queueable {
public List<User> usersToUpdate;
public UserUpdater(List<User> usersToUpdate) {
this.usersToUpdate = usersToUpdate;
}
public void execute(QueueableContext context) { // no Finalizer is attached
update usersToUpdate;
}
}
// Proper code, attaches a finalizer.
public class UserUpdater implements Queueable, Finalizer {
public List<User> usersToUpdate;
public UserUpdater(List<User> usersToUpdate) {
this.usersToUpdate = usersToUpdate;
}
public void execute(QueueableContext context) {
System.attachFinalizer(this);
update usersToUpdate;
}
public void execute(FinalizerContext ctx) {
if (ctx.getResult() == ParentJobResult.SUCCESS) {
// Handle success
} else {
// Handle failure
}
}
}
]]>
</example>
</rule>
</ruleset>
@@ -209,6 +209,7 @@
<priority>3</priority>
</rule>
<!-- <rule ref="category/apex/bestpractices.xml/UnusedLocalVariable"/> -->
<!-- <rule ref="category/apex/bestpractices.xml/QueueableWithoutFinalizer"/> -->
<!-- <rule ref="category/apex/errorprone.xml/OverrideBothEqualsAndHashcode" /> -->
<!-- <rule ref="category/apex/errorprone.xml/InaccessibleAuraEnabledGetter" /> -->
@@ -66,4 +66,12 @@ class ApexCommentTest extends ApexParserTestBase {
ASTFormalComment comment = file.descendants(ASTUserClass.class).children(ASTFormalComment.class).first();
assertEquals(FORMAL_COMMENT_CONTENT, comment.getImage());
}
@Test
void fileWithUnicodeEscapes() {
ASTApexFile file = apex.parse(FORMAL_COMMENT_CONTENT + "\n"
+ "class MyClass { String s = 'Fran\\u00E7ois'; }");
ASTFormalComment comment = file.descendants(ASTUserClass.class).children(ASTFormalComment.class).first();
assertEquals(FORMAL_COMMENT_CONTENT, comment.getImage());
}
}
@@ -8,14 +8,18 @@ package net.sourceforge.pmd.lang.apex.ast;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import org.antlr.v4.runtime.BaseErrorListener;
import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.RecognitionException;
import org.antlr.v4.runtime.Recognizer;
import org.antlr.v4.runtime.Token;
import org.junit.jupiter.api.Test;
import io.github.apexdevtools.apexparser.ApexLexer;
import io.github.apexdevtools.apexparser.ApexParser;
import io.github.apexdevtools.apexparser.CaseInsensitiveInputStream;
/**
* This is an exploration test for {@link ApexLexer}.
@@ -49,4 +53,36 @@ class ApexLexerTest {
ApexParser.CompilationUnitContext compilationUnit = parser.compilationUnit();
assertNotNull(compilationUnit);
}
@Test
void testLexerUnicodeEscapes() {
String s = "'Fran\\u00E7ois'";
// note: with apex-parser 4.3.1, no errors are reported anymore
assertEquals(2, getLexingErrors(CharStreams.fromString(s)));
assertEquals(0, getLexingErrors(new CaseInsensitiveInputStream(CharStreams.fromString(s))));
}
private int getLexingErrors(CharStream stream) {
ApexLexer lexer = new ApexLexer(stream);
ErrorListener errorListener = new ErrorListener();
lexer.removeErrorListeners(); // Avoid distracting "token recognition error" stderr output
lexer.addErrorListener(errorListener);
CommonTokenStream tokens = new CommonTokenStream(lexer);
tokens.fill();
return errorListener.getErrorCount();
}
private static class ErrorListener extends BaseErrorListener {
private int errorCount = 0;
@Override
public void syntaxError(Recognizer<?, ?> recognizer, Object offendingSymbol, int line,
int charPositionInLine, String msg, RecognitionException e) {
++errorCount;
}
public int getErrorCount() {
return errorCount;
}
}
}
@@ -0,0 +1,11 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.lang.apex.rule.bestpractices;
import net.sourceforge.pmd.test.PmdRuleTst;
class QueueableWithoutFinalizerTest extends PmdRuleTst {
// no additional unit tests
}
@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<test-data
xmlns="http://pmd.sourceforge.net/rule-tests"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://pmd.sourceforge.net/rule-tests http://pmd.sourceforge.net/rule-tests_1_0_0.xsd">
<test-code>
<description>[apex] Queueable Without Finalizer - positive test case #5302</description>
<expected-problems>1</expected-problems>
<expected-linenumbers>8</expected-linenumbers>
<code><![CDATA[
public class UserUpdater implements Queueable {
public List<User> usersToUpdate;
public UserUpdater(List<User> usersToUpdate) {
this.usersToUpdate = usersToUpdate;
}
public void execute(QueueableContext context) {
update usersToUpdate;
}
}
]]></code>
</test-code>
<test-code>
<description>[apex] Queueable Without Finalizer - negative test case #5302</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class UserUpdater implements Queueable, Finalizer {
public List<User> usersToUpdate;
public UserUpdater(List<User> usersToUpdate) {
this.usersToUpdate = usersToUpdate;
}
public void execute(QueueableContext context) {
System.attachFinalizer(this);
update usersToUpdate;
}
public void execute(FinalizerContext ctx) {
if (ctx.getResult() == ParentJobResult.SUCCESS) {
// Handle success
} else {
// Handle failure
}
}
}
]]></code>
</test-code>
</test-data>
@@ -260,6 +260,36 @@ public class Something {
.isEmpty();
}
}
]]></code>
</test-code>
<test-code>
<description>[apex] AvoidNonRestrictiveQueries when LIMIT is followed by bind expression #5270</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public with sharing class DemoController {
public static final Integer LIMIT_ACCOUNTS = 2;
@AuraEnabled
public static List<Account> getTwoAccounts() {
List<Account> result = [
SELECT Id, Name FROM Account WITH SECURITY_ENFORCED
LIMIT:LIMIT_ACCOUNTS // note: no spaces... - false positive here
];
List<Account> result2 = [
SELECT Id, Name FROM Account WITH SECURITY_ENFORCED
LIMIT :LIMIT_ACCOUNTS
];
List<Account> result3 = [
SELECT Id, Name FROM Account WITH SECURITY_ENFORCED
LIMIT : LIMIT_ACCOUNTS
];
// sosl:
List<List<SObject>> searchList = [FIND 'map*' IN ALL FIELDS RETURNING Account (Id, Name), Contact, Opportunity, Lead LIMIT:LIMIT_ACCOUNTS];
return result;
}
}
]]></code>
</test-code>
</test-data>
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>7.6.0</version>
<version>7.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>7.6.0</version>
<version>7.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
+1 -1
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>7.6.0</version>
<version>7.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -0,0 +1,23 @@
/*
* BSD-style license; for more info see http://pmd.sourceforge.net/license.html
*/
package net.sourceforge.pmd.annotation;
import java.lang.annotation.Documented;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
/**
* Marks a class as generated code, and therefore to be ignored for code coverage purposes.
*
* @since 7.7.0
*/
@Retention(RetentionPolicy.CLASS)
@Documented
public @interface Generated {
/** The generator that produced this code */
String value() default "";
}
@@ -48,7 +48,7 @@ class AbstractNodeTest {
return childIndexes;
}
static Object childrenAndGrandChildrenIndexes() {
static Object[] childrenAndGrandChildrenIndexes() {
final Integer[] childrenIndexes = childrenIndexes();
final Integer[] grandChildrenIndexes = grandChildrenIndexes();
final Object[] indexes = new Object[childrenIndexes.length * grandChildrenIndexes.length];
+2 -2
View File
@@ -7,7 +7,7 @@
<parent>
<groupId>net.sourceforge.pmd</groupId>
<artifactId>pmd</artifactId>
<version>7.6.0</version>
<version>7.8.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@@ -34,10 +34,10 @@
<configuration>
<target>
<ant antfile="${javacc.ant.wrapper}" target="alljavacc">
<property name="plugin-classpath" refid="maven.plugin.classpath"/>
<property name="no-jjtree" value="true" /> <!-- This is a CPD module -->
<property name="lang-name" value="Cpp" />
<property name="lang-id" value="cpp" />
<property name="javacc.jar" value="${javacc.jar}" />
</ant>
</target>
</configuration>
Loaded 30 of 204 files, more files were not shown because too many files have changed in this diff. Show more