8573 Commits

Author SHA1 Message Date
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
Andreas Dangel
9dcb697f13
Improve DeadlockTest 2024-11-07 12:38:11 +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
Andreas Dangel
16eafc89c2
[java] TooFewBranchesForSwitch - allow list of case constants
Fixes #5287
2024-10-27 16:24:05 +01: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
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
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
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
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
c95817a75d
Merge branch 'main' into issue-4813 2024-10-22 20:55:38 +02:00
Andreas Dangel
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
Andreas Dangel
6d55f6f053
[java] UselessOperationOnImmutable: consider java.time.* types
Fixes #5244
2024-10-18 17:42:44 +02:00
Andreas Dangel
f4941433ce
Merge branch 'main' into rename-defaultlabelswitch 2024-10-18 16:39:12 +02:00
Andreas Dangel
ef0db9a166
Merge branch 'main' into issue-5249-5250 2024-10-18 16:30:01 +02:00
Andreas Dangel
dafdc964a5
Merge branch 'main' into issue-3362 2024-10-18 16:22:17 +02:00
Andreas Dangel
fb94e2493c
Merge branch 'main' into issue-5030 2024-10-18 16:20:11 +02:00
Andreas Dangel
f317e8bee5
Merge branch 'main' into java-unit-test-rules 2024-10-18 16:15:51 +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
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
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
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
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