diff options
author | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-15 16:06:32 +0200 |
---|---|---|
committer | Lars Grefer <eclipse@larsgrefer.de> | 2020-08-15 16:06:32 +0200 |
commit | a85308ec103a69a86a8e02adf02112d472b00568 (patch) | |
tree | a1fe0ef9fe221292774ef280e4d8f0d55cf1555c /org.aspectj.matcher/src/main | |
parent | 9cab74717265239e03d1aec53c5ec60a6d7d9718 (diff) | |
download | aspectj-a85308ec103a69a86a8e02adf02112d472b00568.tar.gz aspectj-a85308ec103a69a86a8e02adf02112d472b00568.zip |
Manual array to collection copy
Reports the copying of array contents to a collection where each element is added individually using a for loop. Such constructs may be replaced by a call to Collection.addAll(Arrays.asList()) or Collections.addAll().
Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'org.aspectj.matcher/src/main')
-rw-r--r-- | org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java index 2d969c2f8..763f78f0b 100644 --- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java +++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AbstractReferenceTypeDelegate.java @@ -13,6 +13,7 @@ package org.aspectj.weaver; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.aspectj.bridge.ISourceLocation; @@ -135,15 +136,11 @@ public abstract class AbstractReferenceTypeDelegate implements ReferenceTypeDele AbstractReferenceTypeDelegate outerObjectType = (AbstractReferenceTypeDelegate) outerDelegate; if (outerObjectType.isNested()) { GenericSignature.FormalTypeParameter[] parentParams = outerObjectType.getFormalTypeParametersFromOuterClass(); - for (GenericSignature.FormalTypeParameter parentParam : parentParams) { - typeParameters.add(parentParam); - } + Collections.addAll(typeParameters, parentParams); } GenericSignature.ClassSignature outerSig = outerObjectType.getGenericClassTypeSignature(); if (outerSig != null) { - for (FormalTypeParameter formalTypeParameter : outerSig.formalTypeParameters) { - typeParameters.add(formalTypeParameter); - } + Collections.addAll(typeParameters, outerSig.formalTypeParameters); } GenericSignature.FormalTypeParameter[] ret = new GenericSignature.FormalTypeParameter[typeParameters.size()]; |