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

@ -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>