We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Affects PMD Version: 7.2.0
Rule: UseArraysAsList
Please provide the rule name and a link to the rule documentation: https://docs.pmd-code.org/latest/pmd_rules_java_performance.html#usearraysaslist
Description: UseArraysAsList should not warn when elements are skipped in array
Code Sample demonstrating the issue:
import java.util.*; public class Test { public static void main(String... args) { String[] entrySet = {"key1", "value1", "key2", "value2", "key3", "value3"}; for (String key : keySet(entrySet)) { System.out.println(key); } } private static Collection<String> keySet(String... entrySet) { final Set<String> result = new HashSet<>(entrySet.length / 2); for (int i = 0; i < entrySet.length; i += 2) { result.add(entrySet[i]); } return result; } }
Expected outcome: No warning
PMD reports a violation at line 13, but that's wrong. That's a false positive. Full message:
[INFO] PMD version: 7.2.0 [INFO] PMD Failure: Test:13 Rule:UseArraysAsList Priority:3 Use asList instead of tight loops.
Running PMD through: Maven
Possibly related to:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Affects PMD Version: 7.2.0
Rule: UseArraysAsList
Please provide the rule name and a link to the rule documentation:
https://docs.pmd-code.org/latest/pmd_rules_java_performance.html#usearraysaslist
Description: UseArraysAsList should not warn when elements are skipped in array
Code Sample demonstrating the issue:
Expected outcome: No warning
PMD reports a violation at line 13, but that's wrong. That's a false positive.
Full message:
Running PMD through: Maven
Possibly related to:
The text was updated successfully, but these errors were encountered: