aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authorLars Grefer <eclipse@larsgrefer.de>2020-08-15 16:35:54 +0200
committerLars Grefer <eclipse@larsgrefer.de>2020-08-15 16:35:54 +0200
commitd66bec041a857bc3076a20dfeb1aa6037b020db1 (patch)
treeab29bd5c21811b4d3564e549e820bd518ceb2680 /org.aspectj.matcher
parentefa2e5ce8c9cc2d20ab7479d1caa4a2ae1de6e8a (diff)
downloadaspectj-d66bec041a857bc3076a20dfeb1aa6037b020db1.tar.gz
aspectj-d66bec041a857bc3076a20dfeb1aa6037b020db1.zip
Manual array copy
Reports the manual copying of array contents which may be replaced by calls to System.arraycopy(). Signed-off-by: Lars Grefer <eclipse@larsgrefer.de>
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java4
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java4
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java4
3 files changed, 3 insertions, 9 deletions
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java
index cd786e724..d759bc721 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java
@@ -304,9 +304,7 @@ public abstract class Advice extends ShadowMunger {
return allNames;
}
String[] result = new String[getBaseParameterCount()];
- for (int i = 0; i < result.length; i++) {
- result[i] = allNames[i];
- }
+ if (result.length >= 0) System.arraycopy(allNames, 0, result, 0, result.length);
return result;
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java
index 4e1ef74df..c0fed9aee 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/PointcutRewriter.java
@@ -252,9 +252,7 @@ public class PointcutRewriter {
}
// otherwise ...
Pointcut[] subset = new Pointcut[ps.length - 1];
- for (int i = 1; i < ps.length; i++) {
- subset[i - 1] = ps[i];
- }
+ if (ps.length - 1 >= 0) System.arraycopy(ps, 1, subset, 0, ps.length - 1);
return new AndPointcut(ps[0], createAndsFor(subset));
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java
index b8e58c342..c5f44ae0f 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/WildTypePattern.java
@@ -588,9 +588,7 @@ public class WildTypePattern extends TypePattern {
@Override
public TypePattern parameterizeWith(Map<String,UnresolvedType> typeVariableMap, World w) {
NamePattern[] newNamePatterns = new NamePattern[namePatterns.length];
- for (int i = 0; i < namePatterns.length; i++) {
- newNamePatterns[i] = namePatterns[i];
- }
+ System.arraycopy(namePatterns, 0, newNamePatterns, 0, namePatterns.length);
if (newNamePatterns.length == 1) {
String simpleName = newNamePatterns[0].maybeGetSimpleName();
if (simpleName != null) {