A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/pmd/pmd/issues/4148 below:

[java] UseArrayListInsteadOfVector ignores Vector when other classes are imported · Issue #4148 · pmd/pmd · GitHub

Affects PMD Version:6.47.0

Rule:UseArrayListInsteadOfVector

Please provide the rule name and a link to the rule documentation:
https://pmd.sourceforge.io/pmd-6.50.0/pmd_rules_java_performance.html#usearraylistinsteadofvector

Description:
Hi, I found a false negative about the rule UseArrayListInsteadOfVector, please read the first code example below. PMD should have reported a warning in line 5, but it does not. However, in the second code example, PMD can report the warning as expected. Hence, I think this is a false negative. Thank you!

Code Sample demonstrating the issue:

First code example

import org.Annotation;
@Annotation
public class C {
    void x() {
        Vector v = new Vector();  // should report a warning in this line, but no warnings
    }
}

Second code example

public class C {
    void x() {
        Vector v = new Vector();  // Can detect the warning
    }
}

Expected outcome:

PMD should report a violation at line 5, but doesn't. This is a false-negative.

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