Merge branch 'master' into pmd7-textfile-display-name

This commit is contained in:
Clément Fournier
2023-05-03 16:20:15 +02:00
3 changed files with 41 additions and 0 deletions

View File

@ -389,6 +389,7 @@ Language specific fixes:
* [#4317](https://github.com/pmd/pmd/issues/4317): \[java] Some AST nodes should not be TypeNodes
* [#4359](https://github.com/pmd/pmd/issues/4359): \[java] Type resolution fails with NPE when the scope is not a type declaration
* [#4367](https://github.com/pmd/pmd/issues/4367): \[java] Move testrule TypeResTest into internal
* [#4405](https://github.com/pmd/pmd/issues/4405): \[java] Processing error with ArrayIndexOutOfBoundsException
* java-bestpractices
* [#342](https://github.com/pmd/pmd/issues/342): \[java] AccessorMethodGeneration: Name clash with another public field not properly handled
* [#755](https://github.com/pmd/pmd/issues/755): \[java] AccessorClassGeneration false positive for private constructors
@ -462,6 +463,7 @@ Language specific fixes:
* [#3668](https://github.com/pmd/pmd/pull/3668): \[java] ClassWithOnlyPrivateConstructorsShouldBeFinal - fix FP with inner private classes
* [#3754](https://github.com/pmd/pmd/issues/3754): \[java] SingularField false positive with read in while condition
* [#3786](https://github.com/pmd/pmd/issues/3786): \[java] SimplifyBooleanReturns should consider operator precedence
* [#3840](https://github.com/pmd/pmd/issues/3840): \[java] LawOfDemeter disallows method call on locally created object
* [#4238](https://github.com/pmd/pmd/pull/4238): \[java] Make LawOfDemeter not use the rulechain
* [#4254](https://github.com/pmd/pmd/issues/4254): \[java] ImmutableField - false positive with Lombok @<!-- -->Setter
* [#4477](https://github.com/pmd/pmd/issues/4477): \[java] SignatureDeclareThrowsException: false-positive with TestNG annotations
@ -504,6 +506,7 @@ Language specific fixes:
* [#2712](https://github.com/pmd/pmd/issues/2712): \[java] SimplifyStartsWith false-positive with AssertJ
* [#3486](https://github.com/pmd/pmd/pull/3486): \[java] InsufficientStringBufferDeclaration: Fix NPE
* [#3848](https://github.com/pmd/pmd/issues/3848): \[java] StringInstantiation: false negative when using method result
* [#4070](https://github.com/pmd/pmd/issues/4070): \[java] A false positive about the rule RedundantFieldInitializer
* kotlin
* [#419](https://github.com/pmd/pmd/issues/419): \[kotlin] Add support for Kotlin
* [#4389](https://github.com/pmd/pmd/pull/4389): \[kotlin] Update grammar to version 1.8

View File

@ -1160,4 +1160,32 @@ public final class ControlEvent {
interface C { void doIt(); }
]]></code>
</test-code>
<test-code>
<description>[java] LawOfDemeter disallows method call on locally created object #3840</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
import java.util.List;
import java.util.concurrent.CompletableFuture;
public class ParallelHandler<T> {
private List<CompletableFuture<T>> futures;
//...
// pmd failed to warn
public List<CompletableFuture<T>> get_nowarning() {
CompletableFuture.allOf(futures.toArray(new CompletableFuture[] {})).join(); // point 1: true-negative
return futures;
}
// pmd warns CompletableFuture.allOf(tempVar).join();
public List<CompletableFuture<T>> get_fp() {
CompletableFuture[] tempVar = futures.toArray(new CompletableFuture[] {});
CompletableFuture.allOf(tempVar).join(); // point 2: false positive
return futures;
}
}
]]></code>
</test-code>
</test-data>

View File

@ -1471,4 +1471,14 @@ class O {
}
]]></code>
</test-code>
<test-code>
<description>FP #4070</description>
<expected-problems>0</expected-problems>
<code><![CDATA[
public class FP {
private static final int BASE = 1;
char c = 0 + BASE; // should not report a warning in this line
}
]]></code>
</test-code>
</test-data>