@ -188,6 +188,7 @@ are deprecated as internal API.
|
||||
* [#2730](https://github.com/pmd/pmd/pull/2730): Cleanup: StringBuilder issues - [XenoAmess](https://github.com/XenoAmess)
|
||||
* [#2731](https://github.com/pmd/pmd/pull/2731): Cleanup: avoid compiling Patterns repeatedly - [XenoAmess](https://github.com/XenoAmess)
|
||||
* [#2732](https://github.com/pmd/pmd/pull/2732): Cleanup: use StandardCharsets instead of Charset.forName - [XenoAmess](https://github.com/XenoAmess)
|
||||
* [#2733](https://github.com/pmd/pmd/pull/2733): Cleanup: Collection::addAll issues - [XenoAmess](https://github.com/XenoAmess)
|
||||
* [#2734](https://github.com/pmd/pmd/pull/2734): Cleanup: use try with resources - [XenoAmess](https://github.com/XenoAmess)
|
||||
|
||||
|
||||
|
@ -563,11 +563,7 @@ interface ImmutableList<E> extends List<E> {
|
||||
|
||||
@Override
|
||||
public List<E> toList() {
|
||||
List<E> result = new ArrayList<>(size());
|
||||
for (E item : this) {
|
||||
result.add(item);
|
||||
}
|
||||
return result;
|
||||
return new ArrayList<>(this);
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,8 +58,7 @@ public class JUnitUseExpectedRule extends AbstractJUnitRule {
|
||||
if (child instanceof ASTMethodDeclaration) {
|
||||
boolean isJUnitMethod = isJUnitMethod((ASTMethodDeclaration) child, data);
|
||||
if (inAnnotation || isJUnitMethod) {
|
||||
List<Node> found = new ArrayList<>();
|
||||
found.addAll((List<Node>) visit((ASTMethodDeclaration) child, data));
|
||||
List<Node> found = new ArrayList<>((List<Node>) visit((ASTMethodDeclaration) child, data));
|
||||
for (Node name : found) {
|
||||
addViolation(data, name);
|
||||
}
|
||||
|
@ -32,8 +32,7 @@ public class UnusedPrivateFieldRule extends AbstractLombokAwareRule {
|
||||
|
||||
@Override
|
||||
protected Collection<String> defaultSuppressionAnnotations() {
|
||||
Collection<String> defaultValues = new ArrayList<>();
|
||||
defaultValues.addAll(super.defaultSuppressionAnnotations());
|
||||
Collection<String> defaultValues = new ArrayList<>(super.defaultSuppressionAnnotations());
|
||||
defaultValues.add("java.lang.Deprecated");
|
||||
defaultValues.add("javafx.fxml.FXML");
|
||||
defaultValues.add("lombok.experimental.Delegate");
|
||||
|
@ -61,8 +61,7 @@ public class SingularFieldRule extends AbstractLombokAwareRule {
|
||||
|
||||
@Override
|
||||
protected Collection<String> defaultSuppressionAnnotations() {
|
||||
Collection<String> defaultValues = new ArrayList<>();
|
||||
defaultValues.addAll(super.defaultSuppressionAnnotations());
|
||||
Collection<String> defaultValues = new ArrayList<>(super.defaultSuppressionAnnotations());
|
||||
defaultValues.add("lombok.experimental.Delegate");
|
||||
defaultValues.add("lombok.EqualsAndHashCode");
|
||||
return defaultValues;
|
||||
|
@ -19,8 +19,7 @@ public class MethodFirstPhase {
|
||||
|
||||
Exception b = vararg((Number) null);
|
||||
|
||||
Set<String> set = new HashSet<>();
|
||||
set.addAll(Arrays.asList("a", "b")); // TODO: return type of method call Arrays.asList is missing
|
||||
Set<String> set = new HashSet<>(Arrays.asList("a", "b")); // TODO: return type of method call Arrays.asList is missing
|
||||
|
||||
List<String> myList = new ArrayList<>();
|
||||
Collections.sort(myList); // TODO: generic type variables on methods
|
||||
|
@ -784,8 +784,7 @@ public class JspDocStyleTest extends AbstractJspNodesTst {
|
||||
* @return
|
||||
*/
|
||||
private List<ASTElement> sortNodesByName(Collection<ASTElement> elements) {
|
||||
List<ASTElement> list = new ArrayList<>();
|
||||
list.addAll(elements);
|
||||
List<ASTElement> list = new ArrayList<>(elements);
|
||||
Collections.sort(list, new Comparator<ASTElement>() {
|
||||
public int compare(ASTElement o1, ASTElement o2) {
|
||||
if (o1.getName() == null) {
|
||||
@ -812,8 +811,7 @@ public class JspDocStyleTest extends AbstractJspNodesTst {
|
||||
* @return
|
||||
*/
|
||||
private <T extends Node> List<T> sortByImage(Collection<T> elements) {
|
||||
List<T> list = new ArrayList<>();
|
||||
list.addAll(elements);
|
||||
List<T> list = new ArrayList<>(elements);
|
||||
Collections.sort(list, new Comparator<Node>() {
|
||||
public int compare(Node o1, Node o2) {
|
||||
if (o1.getImage() == null) {
|
||||
|
Reference in New Issue
Block a user