Affects PMD Version:7.0.0-rc4
Rule:UnnecessaryImport
https://docs.pmd-code.org/latest/pmd_rules_java_codestyle.html#unnecessaryimport
Description:
According to the rule description, if a class is imported, and subsequently, used in the code, PMD should not report it as a violation. However, the provided sample code, adhering to the rule's specifications, is erroneously marked as a violation. This inconsistency suggests a false positive in the PMD analysis.
Code Sample demonstrating the issue:
import org.junit.Test; import java.util.Arrays; import static org.junit.Assert.assertTrue; public class Foo{ @Test public void testfoo(Object a){ assertTrue(a instanceof Arrays); } }
Expected outcome:
PMD reports a violation at line 2 and line 3, but that's wrong. That's a false positive.
Running PMD through: [CLI]
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