Affects PMD Version:
6.22.0
Rule:
https://pmd.github.io/latest/pmd_rules_java_codestyle.html#usediamondoperator
Description:
Code Sample demonstrating the issue:
@FunctionalInterface public interface LambdaKey<T> { String key(T value); } --- different file public class LambdaKeyConverter<T> { public LambdaKeyConverter(final LambdaKey<T> lambdaKey) { } } --- different file import java.util.List; public class SomeClass { private final LambdaKeyConverter converter = new LambdaKeyConverter<List>(list -> String.valueOf(list.size())); }
A SSCCE is provided at https://gitlab.com/krichter-sscce/pmd-diamond-operator-lambda-false-positive with CI output at https://gitlab.com/krichter-sscce/pmd-diamond-operator-lambda-false-positive/-/jobs/489958762
Expected outcome:
This is a false-positive as <List>
is necessary in order to allow list.size()
to compile.
Running PMD through: Maven
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4