Skip to content

Commit

Permalink
HSEARCH-3425 Warnings: Manual array to collection copy
Browse files Browse the repository at this point in the history
  • Loading branch information
yrodiere committed Feb 8, 2019
1 parent 6215f30 commit 2c09250
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 9 deletions.
Expand Up @@ -10,6 +10,7 @@
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.LinkedList;
import java.util.List;
Expand Down Expand Up @@ -129,9 +130,7 @@ private static List<String> getFieldNames(Field f) {
}
else {
fieldNames.add( serializedName.value() );
for ( String alternate : serializedName.alternate() ) {
fieldNames.add( alternate );
}
Collections.addAll( fieldNames, serializedName.alternate() );
}
return fieldNames;
}
Expand Down
Expand Up @@ -54,9 +54,7 @@ public Builder ignoreErrorStatuses(int ... ignoredErrorStatuses) {
}

public Builder ignoreErrorTypes(String ... ignoredErrorTypes) {
for ( String ignoredErrorType : ignoredErrorTypes ) {
this.ignoredErrorTypes.add( ignoredErrorType );
}
Collections.addAll( this.ignoredErrorTypes, ignoredErrorTypes );
return this;
}

Expand Down
Expand Up @@ -6,6 +6,7 @@
*/
package org.hibernate.checkstyle.checks.regexp;

import java.util.Collections;
import java.util.HashSet;

import com.puppycrawl.tools.checkstyle.api.AbstractCheck;
Expand All @@ -29,9 +30,7 @@ public class IllegalImport extends AbstractCheck {
* @param importStatements array of illegal packages
*/
public void setIllegalClassnames(String[] importStatements) {
for ( String impo : importStatements ) {
notAllowedImports.add( impo );
}
Collections.addAll( notAllowedImports, importStatements );
}

public void setMessage(String message) {
Expand Down

0 comments on commit 2c09250

Please sign in to comment.