8573 Commits

Author SHA1 Message Date
Clément Fournier
d6736903f0 Fix #5162 SingularField FP with synchronized block 2024-08-25 00:46:45 +02:00
Juan Martín Sotuyo Dodero
45618c0e13 Merge branch 'master' into issue-5151 2024-08-24 18:20:38 -03:00
Clément Fournier
da864aeccd Fix #5167 - issue with type projection 2024-08-24 16:48:37 +02:00
Juan Martín Sotuyo Dodero
c9c0558e2b Suppress PMD warning
- "Simplifying" the return here would simply make it harder to read
2024-08-24 01:02:06 -03:00
Juan Martín Sotuyo Dodero
980eaacd13 Unify compile-time constant detection
- Improving the constant folder allows other rules to work better
 - Fixes #3602
 - Curiously, InefficientStringBuffering has been broken since PMD 7.0.0
   (regression introduced in #3113)
2024-08-24 00:48:53 -03:00
Juan Martín Sotuyo Dodero
8ecc21c06f Merge branch 'master' into issue-5151 2024-08-24 00:14:55 -03:00
Juan Martín Sotuyo Dodero
96f60e9b0e Handle computed array access keys
- Tidy up the code, the fact the `getLogLevelName` was cheating and
   returning null when it considered a log to be safe was making the
   code harder to think about
2024-08-24 00:11:43 -03:00
Clément Fournier
43112078a5 Fix issue #5145 - problem with inference of conditional exprs
Also finally fixes the bug that we swept under the rug in 24c1093b.
2024-08-23 18:23:43 +02:00
Charles Honton
8a39917fa2 added unit test 2024-08-22 13:54:17 -07:00
Charles Honton
3dd47a3b94 update AvoidSynchronizedAtMethodLevel message to mention ReentrantLock
see https://openjdk.org/jeps/8337395
2024-08-22 08:20:06 -07:00
Juan Martín Sotuyo Dodero
4033315c7d Properly handle all qualifiable expressions
- Up date the documentation to better show what is being flagged
2024-08-21 23:40:04 -03:00
Juan Martín Sotuyo Dodero
90ebac893f Fix whitespace 2024-08-19 01:45:37 -03:00
Juan Martín Sotuyo Dodero
9ef927067e Fix tests regarding array accesses 2024-08-18 19:41:06 -03:00
Juan Martín Sotuyo Dodero
4352b53aec Add tests regarding array accesses 2024-08-18 19:40:51 -03:00
Juan Martín Sotuyo Dodero
abcc20e655 Fix #5152 2024-08-18 19:29:48 -03:00
Juan Martín Sotuyo Dodero
176fae39d2 Add test for #5152 2024-08-18 19:29:39 -03:00
Juan Martín Sotuyo Dodero
792d91e062 Fix GuardLogStatementRule for field accesses 2024-08-18 19:23:25 -03:00
Juan Martín Sotuyo Dodero
ca34c3edd3 Add minimal failing case for #5151 2024-08-18 19:22:09 -03:00
Andreas Dangel
13b8556bf6 Fixup from review (#5112)
Co-authored-by: Clément Fournier <clement.fournier76@gmail.com>
2024-08-13 11:22:43 +01:00
Andreas Dangel
21d499d5ef [doc] Release Notes for Java 23 Support (#5062)
Also add some @since tags to new API methods
2024-08-01 11:53:04 +02:00
Andreas Dangel
17a4a487a6 [java] CommentRequired - add test for markdown comments 2024-08-01 11:53:04 +02:00
Andreas Dangel
c53462b3b6 Improve RuleTst performance
Reuse the classloader for auxclasspath
instead of creating a new one for every
single rule test case.
2024-08-01 11:46:45 +02:00
Andreas Dangel
d171bcbdb3 [java] Default Imports for simple compilation unit
Import by default module java.base
and java.io.IO.*
2024-08-01 11:46:45 +02:00
Andreas Dangel
cbc475ede3 [java] Add ImplicitClassDeclaration
JEP 477: Implicitly Declared Classes and Instance Main Methods
(Third Preview)
2024-08-01 11:46:41 +02:00
Andreas Dangel
55d57acc63 [java] Remove String Template Preview feature for Java 23 2024-08-01 11:44:46 +02:00
Andreas Dangel
0823c88cba [java] Support primitive types in instanceof (Java 23 Preview)
Allow to use primitive types in patterns, instanceof, and
switch. This is a Java 23 Preview feature.
See JEP 455.
2024-08-01 11:44:45 +02:00
Andreas Dangel
47470b5d0c [java] Support module import declarations (JEP 476)
- new JModuleSymbol
- UnnecessaryImportRule also supports module imports
- module-info.class can be loaded by ClasspathClassLoader
- Support annotations on modules
- Verify that exported packages are loaded
2024-08-01 11:44:37 +02:00
Andreas Dangel
176e522721 [java] UnnecessaryImportRule: Support Markdown comments 2024-08-01 10:28:31 +02:00
Andreas Dangel
7a6662fcda [java] Support "Markdown documentation comments" (JEP 467) 2024-08-01 10:28:31 +02:00
Andreas Dangel
bb40b754a2 [java] Update impl for "Flexible Constructor Bodies" 2024-08-01 10:28:30 +02:00
Andreas Dangel
20750f9591 [java] Update implementation for "Implicitly Declared Classes...
... and Instance Main Methods" (JEP 477)

 - language feature is renamed
 - update symbol table resolver
2024-08-01 10:28:30 +02:00
Andreas Dangel
a7eab294b4 [java] Make UNNAMED_VARIABLES_AND_PATTERNS a regular language feature
This is now possible, since java 21 preview is gone.
2024-08-01 10:28:30 +02:00
Andreas Dangel
10681cd6a8 [java] Remove version 21-preview 2024-08-01 10:28:29 +02:00
Andreas Dangel
568314bb89 [java] Add new language version 23 and 23-preview 2024-08-01 10:15:09 +02:00
Andreas Dangel
ee800d326f [release] Prepare next development version [skip ci] 2024-07-26 10:11:46 +02:00
Andreas Dangel
db5fa2dbce [release] prepare release pmd_releases/7.4.0 2024-07-26 09:03:38 +02:00
Andreas Dangel
41393d4637 [java] AccessorClassGeneration - handle default ctors
Fixes #5106
2024-07-25 13:05:47 +02:00
Andreas Dangel
a3f9d4af59 [java] Simplify UnusedPrivateMethodRule
Co-authored-by: Clément Fournier <clement.fournier76@gmail.com>
2024-07-25 09:57:20 +02:00
Andreas Dangel
1464cbca38 [java] Fix UnusedPrivateMethod for @lombok.Builder.ObtainVia (#5111)
Merge pull request #5111 from kdebski85:issue-5110-lombok-obtain-via
2024-07-23 20:11:23 +02:00
Andreas Dangel
e8bfc0d01c [java] UnusedPrivateMethodRule - fixups from PR review 2024-07-23 20:05:11 +02:00
Krzysztof Debski
57e8954556 [java] Simplify processing of MethodSource annotation 2024-07-22 17:33:45 +02:00
Krzysztof Debski
121cdba3a4 [java] Make 'ASTAnnotation#flatValue' method static 2024-07-22 13:27:04 +02:00
Krzysztof Debski
9006dd1a89 [java] Generalize annotation handling in UnusedPrivateMethodRule 2024-07-22 13:22:24 +02:00
Andreas Dangel
4d2034ef0f [java] FP for UnusedPrivateMethod with Jakarta @PostConstruct/PreDestroy annotations (#5118)
Merge pull request #5118 from kdebski85:issue-5117-unused-private-method-jakarta
2024-07-19 14:48:03 +02:00
Krzysztof Debski
cb1d1963a4 [java] Ignore unused private methods referenced by any field annotation attribute 2024-07-17 10:18:31 +02:00
Krzysztof Debski
9d0719201d [java] Do not report UnusedPrivateMethod for method annotated with @jakarta.annotation.PostConstruct/PreDestroy 2024-07-15 16:31:58 +02:00
Krzysztof Debski
45d68cf455 [java] Imports order fix 2024-07-11 17:33:39 +02:00
Krzysztof Debski
3609034bf7 [java] Do not report MissingStaticMethodInNonInstantiatableClass for class with @lombok.Builder 2024-07-11 17:24:38 +02:00
Krzysztof Debski
c053f00fb5 [java] Do not report UnusedPrivateMethod for method referenced by @lombok.Builder.ObtainVia 2024-07-11 17:00:01 +02:00
Krzysztof Debski
3a66d50ac2 [java] Do not report MissingStaticMethodInNonInstantiatableClass for private constructor with @lombok.Builder 2024-07-11 15:30:01 +02:00