aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.matcher
diff options
context:
space:
mode:
authorAndrey Turbanov <turbanoff@gmail.com>2021-12-18 15:20:43 +0300
committerAndrey Turbanov <turbanoff@gmail.com>2021-12-18 15:20:43 +0300
commit4c8c90de69b4e3cdeea0f598fea5a5358ac2c861 (patch)
tree6b1526b6d91bde9f3a1e00bace4e12cde6b6dfd4 /org.aspectj.matcher
parent4021ffcbfe320a1b91bb2bcee7a112f7122ef82d (diff)
downloadaspectj-4c8c90de69b4e3cdeea0f598fea5a5358ac2c861.tar.gz
aspectj-4c8c90de69b4e3cdeea0f598fea5a5358ac2c861.zip
Reduce empty array allocations
Diffstat (limited to 'org.aspectj.matcher')
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java2
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjcMemberMaker.java2
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java2
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java10
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java2
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java6
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java2
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java6
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java6
-rw-r--r--org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/StandardShadow.java2
10 files changed, 19 insertions, 21 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 284786213..94cf7561e 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
@@ -104,7 +104,7 @@ public abstract class Advice extends ShadowMunger {
if (signature != null) {
bindingParameterTypes = signature.getParameterTypes();
} else {
- bindingParameterTypes = new UnresolvedType[0];
+ bindingParameterTypes = UnresolvedType.NONE;
}
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjcMemberMaker.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjcMemberMaker.java
index b20d0c2ca..88e14400d 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjcMemberMaker.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjcMemberMaker.java
@@ -140,7 +140,7 @@ public class AjcMemberMaker {
// public static a.X ajc$createAspectInstance(java.lang.String)
ResolvedMemberImpl rm = new ResolvedMemberImpl(Member.METHOD, declaringType, PUBLIC_STATIC, declaringType, // return value
NameMangler.PERTYPEWITHIN_CREATEASPECTINSTANCE_METHOD,
- new UnresolvedType[] { UnresolvedType.forSignature("Ljava/lang/String;") }, new UnresolvedType[] {});
+ new UnresolvedType[] { UnresolvedType.forSignature("Ljava/lang/String;") }, UnresolvedType.NONE);
return rm;
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java
index 33111fc65..f837ac522 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java
@@ -211,7 +211,7 @@ public class MemberImpl implements Member {
l.add(UnresolvedType.forSignature(sig.substring(start, i)));
}
}
- UnresolvedType[] paramTypes = l.toArray(new UnresolvedType[0]);
+ UnresolvedType[] paramTypes = l.toArray(UnresolvedType.NONE);
UnresolvedType returnType = UnresolvedType.forSignature(sig.substring(i + 1, sig.length()));
return new Object[] { returnType, paramTypes };
} else {
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java
index 8d3159dc5..a21461592 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java
@@ -25,8 +25,6 @@ import org.aspectj.bridge.context.CompilationAndWeavingContext;
*/
public class MissingResolvedTypeWithKnownSignature extends ResolvedType {
- private static ResolvedMember[] NO_MEMBERS = new ResolvedMember[0];
- private static ResolvedType[] NO_TYPES = new ResolvedType[0];
private boolean issuedCantFindTypeError = false;
private boolean issuedJoinPointWarning = false;
private boolean issuedMissingInterfaceWarning = false;
@@ -61,7 +59,7 @@ public class MissingResolvedTypeWithKnownSignature extends ResolvedType {
@Override
public ResolvedMember[] getDeclaredFields() {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_FIELDS);
- return NO_MEMBERS;
+ return ResolvedMember.NONE;
}
/*
@@ -72,7 +70,7 @@ public class MissingResolvedTypeWithKnownSignature extends ResolvedType {
@Override
public ResolvedMember[] getDeclaredMethods() {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_METHODS);
- return NO_MEMBERS;
+ return ResolvedMember.NONE;
}
@Override
@@ -84,13 +82,13 @@ public class MissingResolvedTypeWithKnownSignature extends ResolvedType {
@Override
public ResolvedType[] getDeclaredInterfaces() {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_INTERFACES);
- return NO_TYPES;
+ return ResolvedType.EMPTY_RESOLVED_TYPE_ARRAY;
}
@Override
public ResolvedMember[] getDeclaredPointcuts() {
raiseCantFindType(WeaverMessages.CANT_FIND_TYPE_POINTCUTS);
- return NO_MEMBERS;
+ return ResolvedMember.NONE;
}
@Override
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java
index dcf5f21ae..b0069d840 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java
@@ -1085,7 +1085,7 @@ public abstract class ResolvedType extends UnresolvedType implements AnnotatedEl
l.add(m);
}
}
- return l.toArray(new ResolvedMember[0]);
+ return l.toArray(ResolvedMember.NONE);
}
public abstract ISourceContext getSourceContext();
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java
index d9b61c603..ede14efca 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java
@@ -30,13 +30,13 @@ public class AnnotationPatternList extends PatternNode {
private AnnotationTypePattern[] typePatterns;
int ellipsisCount = 0;
- public static final AnnotationPatternList EMPTY = new AnnotationPatternList(new AnnotationTypePattern[] {});
+ public static final AnnotationPatternList EMPTY = new AnnotationPatternList(AnnotationTypePattern.NONE);
public static final AnnotationPatternList ANY = new AnnotationPatternList(
new AnnotationTypePattern[] { AnnotationTypePattern.ELLIPSIS });
public AnnotationPatternList() {
- typePatterns = new AnnotationTypePattern[0];
+ typePatterns = AnnotationTypePattern.NONE;
ellipsisCount = 0;
}
@@ -50,7 +50,7 @@ public class AnnotationPatternList extends PatternNode {
}
public AnnotationPatternList(List<AnnotationTypePattern> l) {
- this((AnnotationTypePattern[]) l.toArray(new AnnotationTypePattern[0]));
+ this((AnnotationTypePattern[]) l.toArray(AnnotationTypePattern.NONE));
}
protected AnnotationTypePattern[] getAnnotationPatterns() {
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java
index 40014cda4..5ecbd8115 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java
@@ -308,7 +308,7 @@ public class IfPointcut extends Pointcut {
}
}
- ret = Test.makeAnd(ret, Test.makeCall(testMethod, (Expr[]) args.toArray(new Expr[0])));
+ ret = Test.makeAnd(ret, Test.makeCall(testMethod, (Expr[]) args.toArray(Expr.NONE)));
// Remember...
ifLastMatchedShadowId = shadow.shadowId;
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java
index 39f989a69..e9e48e910 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java
@@ -212,7 +212,7 @@ public class ReflectionBasedReferenceTypeDelegate implements ReferenceTypeDelega
*/
public ResolvedType[] getAnnotationTypes() {
// no annotations in Java 1.4
- return new ResolvedType[0];
+ return ResolvedType.EMPTY_RESOLVED_TYPE_ARRAY;
}
/*
@@ -281,7 +281,7 @@ public class ReflectionBasedReferenceTypeDelegate implements ReferenceTypeDelega
* @see org.aspectj.weaver.ReferenceTypeDelegate#getDeclaredPointcuts()
*/
public ResolvedMember[] getDeclaredPointcuts() {
- return new ResolvedMember[0];
+ return ResolvedMember.NONE;
}
/*
@@ -291,7 +291,7 @@ public class ReflectionBasedReferenceTypeDelegate implements ReferenceTypeDelega
*/
public TypeVariable[] getTypeVariables() {
// no type variables in Java 1.4
- return new TypeVariable[0];
+ return TypeVariable.NONE;
}
/*
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java
index 8da8151cf..9e42e7b82 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java
@@ -160,8 +160,8 @@ public class ReflectionBasedReferenceTypeDelegateFactory {
public static ResolvedMember createStaticInitMember(Class forType, World inWorld) {
return new ResolvedMemberImpl(org.aspectj.weaver.Member.STATIC_INITIALIZATION, toResolvedType(forType,
- (IReflectionWorld) inWorld), Modifier.STATIC, UnresolvedType.VOID, "<clinit>", new UnresolvedType[0],
- new UnresolvedType[0]);
+ (IReflectionWorld) inWorld), Modifier.STATIC, UnresolvedType.VOID, "<clinit>", UnresolvedType.NONE,
+ UnresolvedType.NONE);
}
public static ResolvedMember createResolvedConstructor(Constructor aConstructor, World inWorld) {
@@ -181,7 +181,7 @@ public class ReflectionBasedReferenceTypeDelegateFactory {
public static ResolvedMember createResolvedField(Field aField, World inWorld) {
ReflectionBasedResolvedMemberImpl ret = new ReflectionBasedResolvedMemberImpl(org.aspectj.weaver.Member.FIELD,
toResolvedType(aField.getDeclaringClass(), (IReflectionWorld) inWorld), aField.getModifiers(), toResolvedType(
- aField.getType(), (IReflectionWorld) inWorld), aField.getName(), new UnresolvedType[0], aField);
+ aField.getType(), (IReflectionWorld) inWorld), aField.getName(), UnresolvedType.NONE, aField);
if (inWorld instanceof IReflectionWorld) {
ret.setAnnotationFinder(((IReflectionWorld) inWorld).getAnnotationFinder());
}
diff --git a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/StandardShadow.java b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/StandardShadow.java
index 59fcb9082..ad584fa35 100644
--- a/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/StandardShadow.java
+++ b/org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/StandardShadow.java
@@ -111,7 +111,7 @@ public class StandardShadow extends Shadow {
Kind kind = Shadow.StaticInitialization;
if (clinit == -1) {
Member clinitMember = new ResolvedMemberImpl(org.aspectj.weaver.Member.STATIC_INITIALIZATION, forType, Modifier.STATIC,
- UnresolvedType.VOID, "<clinit>", new UnresolvedType[0], new UnresolvedType[0]);
+ UnresolvedType.VOID, "<clinit>", UnresolvedType.NONE, UnresolvedType.NONE);
return new StandardShadow(inWorld, kind, clinitMember, null, forType, null, withContext);
} else {
return new StandardShadow(inWorld, kind, members[clinit], null, forType, null, withContext);