Proposed Rule Name: UnnecessaryVarargsArrayCreation
Proposed Category: Code Style Best Practices
Description: This new rule would flag instances of code that explicitly creates an array when calling a varargs method. This is more heavy to read and could be simplified.
I think this new rule may only be written in pmd 7, because type resolution in pmd 6 does not expose information about the called method.
Code Sample:
List<String> strings = Arrays.asList(new String[] { "a", "b", }); // flagged by the rule strings = Arrays.asList("a", "b"); // ok
Arrays.asList(someVariable) // ok
Possible Properties:
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