A RetroSearch Logo

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

Search Query:

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

[java] ReplaceVectorWithList false-positive (neither `Vector` nor `List` usage) · Issue #4852 · pmd/pmd · GitHub

This follows some feedback in #4816

Affects PMD Version: 7.0.0-rc4

Rule: ReplaceVectorWithList

Description:
The 3 sets of classes generate false-positive.

[INFO] PMD Failure: pmd.false_positive.AAntiFraudPolicy:8 Rule:ReplaceVectorWithList Priority:3 Consider replacing this Vector with the newer java.util.List.
[INFO] PMD Failure: pmd.false_positive.AAntiFraudPolicy:8 Rule:ReplaceVectorWithList Priority:3 Consider replacing this Vector with the newer java.util.List.
[INFO] PMD Failure: pmd.false_positive.AAntiFraudPolicy:8 Rule:ReplaceVectorWithList Priority:3 Consider replacing this Vector with the newer java.util.List.
[INFO] PMD Failure: pmd.false_positive.AAntiFraudPolicy:9 Rule:ReplaceVectorWithList Priority:3 Consider replacing this Vector with the newer java.util.List.

Code Sample demonstrating the issue:

package pmd.false_positive;

public enum AntiFraudCheckResult {
	UNAVAILABLE;
}
package pmd.false_positive;

public interface IAntiFraudCriterion {
}
package pmd.false_positive;

import java.util.Map;
import java.util.function.Predicate;

public class AAntiFraudPolicy<C extends IAntiFraudCriterion> {

	public static <E extends Enum<E> & IAntiFraudCriterion> AAntiFraudPolicy<E> of(Class<E> enumClass,
			Map<E, Predicate<AntiFraudCheckResult>> criterionChecks) {
		return new AAntiFraudPolicy<E>();
	}

}

Expected outcome:

PMD reports a violation at line ..., but that's wrong. That's a false positive.

Running PMD through: [CLI | Ant | Maven | Gradle | Designer | Other]


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