]> source.dussan.org Git - aspectj.git/commitdiff
Reduce empty array allocations 109/head
authorAndrey Turbanov <turbanoff@gmail.com>
Sat, 18 Dec 2021 12:20:43 +0000 (15:20 +0300)
committerAndrey Turbanov <turbanoff@gmail.com>
Sat, 18 Dec 2021 12:20:43 +0000 (15:20 +0300)
39 files changed:
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/FieldOrMethod.java
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/JavaClass.java
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Method.java
bcel-builder/src/main/java/org/aspectj/apache/bcel/classfile/Utility.java
bcel-builder/src/main/java/org/aspectj/apache/bcel/generic/ClassGen.java
bridge/src/main/java/org/aspectj/bridge/MessageUtil.java
loadtime/src/main/java/org/aspectj/weaver/loadtime/ConcreteAspectCodeGen.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java
org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/Advice.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/AjcMemberMaker.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/MemberImpl.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/MissingResolvedTypeWithKnownSignature.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/ResolvedType.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/AnnotationPatternList.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/patterns/IfPointcut.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegate.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/ReflectionBasedReferenceTypeDelegateFactory.java
org.aspectj.matcher/src/main/java/org/aspectj/weaver/reflect/StandardShadow.java
util/src/main/java/org/aspectj/util/GenericSignature.java
util/src/main/java/org/aspectj/util/GenericSignatureParser.java
weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java
weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowCounterFieldAdder.java
weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java
weaver/src/main/java/org/aspectj/weaver/bcel/BcelField.java
weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java
weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java
weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java
weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java
weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java
weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java
weaver/src/main/java/org/aspectj/weaver/bcel/TypeAnnotationAccessVar.java
weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java
weaver/src/main/java/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java
weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java

index 67f70e1b4a4e2ef3202b52beed50bbe07a969daa..59e4d2b374d0b6b1b176ae93109c9b545ed37108 100644 (file)
@@ -177,7 +177,7 @@ public abstract class FieldOrMethod extends Modifiers implements Node {
                        if (accumulatedAnnotations.size() == 0) {
                                annotations = AnnotationGen.NO_ANNOTATIONS;
                        } else {
-                               annotations = accumulatedAnnotations.toArray(new AnnotationGen[] {});
+                               annotations = accumulatedAnnotations.toArray(AnnotationGen.NO_ANNOTATIONS);
                        }
                }
                return annotations;
index 0be2b8ae5aa570284ebb1b6c70f600d7da6e94f6..5d2ec65e5568c69eaa91d8c0ab6700c363fd32a6 100644 (file)
@@ -88,10 +88,7 @@ import org.aspectj.apache.bcel.util.SyntheticRepository;
 public class JavaClass extends Modifiers implements Cloneable, Node {
 
        private static final String[] NoInterfaceNames = new String[0];
-       private static final Field[] NoFields = new Field[0];
-       private static final Method[] NoMethod = new Method[0];
        private static final int[] NoInterfaceIndices = new int[0];
-       private static final Attribute[] NoAttributes = new Attribute[0];
 
        private String fileName;
        private String packageName;
@@ -141,9 +138,9 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
                this.modifiers = access_flags;
                this.cpool = cpool;
                this.interfaces = interfaces;
-               this.fields = (fields == null ? NoFields : fields);
-               this.methods = (methods == null ? NoMethod : methods);
-               this.attributes = (attributes == null ? NoAttributes : attributes);
+               this.fields = (fields == null ? Field.NoFields : fields);
+               this.methods = (methods == null ? Method.NoMethods : methods);
+               this.attributes = (attributes == null ? Attribute.NoAttributes : attributes);
                annotationsOutOfDate = true;
 
                // Get source file name if available
@@ -294,7 +291,7 @@ public class JavaClass extends Modifiers implements Cloneable, Node {
                                        accumulatedAnnotations.addAll(runtimeAnnotations.getAnnotations());
                                }
                        }
-                       annotations = accumulatedAnnotations.toArray(new AnnotationGen[] {});
+                       annotations = accumulatedAnnotations.toArray(AnnotationGen.NO_ANNOTATIONS);
                        annotationsOutOfDate = false;
                }
                return annotations;
index 316eaa4c985cbc9d4a5a962683e83db0110d46c6..8f9003744fbadb97c2326a848d06dae7edab81e0 100644 (file)
@@ -228,8 +228,8 @@ public final class Method extends FieldOrMethod {
                        AnnotationGen[] invisibleOnes = null;
                        for (int i = 0; i < parameterCount; i++) {
                                int count = 0;
-                               visibleOnes = new AnnotationGen[0];
-                               invisibleOnes = new AnnotationGen[0];
+                               visibleOnes = AnnotationGen.NO_ANNOTATIONS;
+                               invisibleOnes = AnnotationGen.NO_ANNOTATIONS;
                                if (parameterAnnotationsVis != null) {
                                        visibleOnes = parameterAnnotationsVis.getAnnotationsOnParameter(i);
                                        count += visibleOnes.length;
index 921570515536723628bf7e10042b6d2cd90bca9b..6ac083bcefeae095eebb7a5fe49b82b812e95d53 100644 (file)
@@ -709,7 +709,7 @@ public abstract class Utility {
                                newAttributes.add(new RuntimeInvisParamAnnos(riaIndex, riaData.length, riaData, cp));
                        }
 
-                       return newAttributes.toArray(new Attribute[] {});
+                       return newAttributes.toArray(Attribute.NoAttributes);
                } catch (IOException e) {
                        System.err.println("IOException whilst processing parameter annotations");
                        e.printStackTrace();
index fc8112858c9f7f01fddd9d7f9f8fea30c04b5d78..ce4eb98eaaeba69e303c448428a338581762076e 100644 (file)
@@ -195,7 +195,7 @@ public class ClassGen extends Modifiers implements Cloneable {
                ConstantPool cp = this.cpool.getFinalConstantPool();
 
                return new JavaClass(classnameIndex, superclassnameIndex, filename, major, minor, modifiers, cp, interfaces, fields,
-                               methods, attributes.toArray(new Attribute[0]));// OPTIMIZE avoid toArray()?
+                               methods, attributes.toArray(Attribute.NoAttributes));// OPTIMIZE avoid toArray()?
        }
 
        public void addInterface(String name) {
index 0a765e503631d4f1cd8d25edd56f3e9be9aefef2..7ef4e92abbad73bf548e95615939bb06b3b85de1 100644 (file)
@@ -357,7 +357,7 @@ public class MessageUtil {
         */
        public static IMessage[] getMessagesExcept(IMessageHolder holder, final IMessage.Kind kind, final boolean orGreater) {
                if ((null == holder) || (null == kind)) {
-                       return new IMessage[0];
+                       return IMessage.RA_IMessage;
                }
 
                IMessageHandler selector = new IMessageHandler() {
index 459a0f86cf6b89c395a4f91c94b0d6dc31588ed7..1d812c6ba8135b4011c72d4d1fdf21a2c24287a3 100644 (file)
@@ -11,6 +11,8 @@
  *******************************************************************************/
 package org.aspectj.weaver.loadtime;
 
+import static org.aspectj.apache.bcel.generic.Type.NO_ARGS;
+
 import java.lang.reflect.Modifier;
 import java.util.ArrayList;
 import java.util.Collection;
@@ -75,7 +77,6 @@ import org.aspectj.weaver.patterns.TypePattern;
 public class ConcreteAspectCodeGen {
 
        private final static String[] EMPTY_STRINGS = new String[0];
-       private final static Type[] EMPTY_TYPES = new Type[0];
 
        /**
         * Concrete aspect definition we build for
@@ -427,17 +428,17 @@ public class ConcreteAspectCodeGen {
                }
 
                // default constructor
-               LazyMethodGen init = new LazyMethodGen(Modifier.PUBLIC, Type.VOID, "<init>", EMPTY_TYPES, EMPTY_STRINGS, cg);
+               LazyMethodGen init = new LazyMethodGen(Modifier.PUBLIC, Type.VOID, "<init>", NO_ARGS, EMPTY_STRINGS, cg);
                InstructionList cbody = init.getBody();
                cbody.append(InstructionConstants.ALOAD_0);
 
-               cbody.append(cg.getFactory().createInvoke(parentName, "<init>", Type.VOID, EMPTY_TYPES, Constants.INVOKESPECIAL));
+               cbody.append(cg.getFactory().createInvoke(parentName, "<init>", Type.VOID, NO_ARGS, Constants.INVOKESPECIAL));
                cbody.append(InstructionConstants.RETURN);
                cg.addMethodGen(init);
 
                for (Definition.Pointcut abstractPc : concreteAspect.pointcuts) {
                        // TODO AV - respect visibility instead of opening up as public?
-                       LazyMethodGen mg = new LazyMethodGen(Modifier.PUBLIC, Type.VOID, abstractPc.name, EMPTY_TYPES, EMPTY_STRINGS, cg);
+                       LazyMethodGen mg = new LazyMethodGen(Modifier.PUBLIC, Type.VOID, abstractPc.name, NO_ARGS, EMPTY_STRINGS, cg);
                        SimpleElementValue svg = new SimpleElementValue(ElementValue.STRING, cg.getConstantPool(), abstractPc.expression);
                        List<NameValuePair> elems = new ArrayList<>();
                        elems.add(new NameValuePair("value", svg, cg.getConstantPool()));
@@ -547,7 +548,7 @@ public class ConcreteAspectCodeGen {
 
                String nameComponent = da.declareAnnotationKind.name().toLowerCase();
                String declareName = new StringBuilder("ajc$declare_at_").append(nameComponent).append("_").append(decCounter).toString();
-               LazyMethodGen declareMethod = new LazyMethodGen(Modifier.PUBLIC, Type.VOID, declareName, Type.NO_ARGS, EMPTY_STRINGS, cg);
+               LazyMethodGen declareMethod = new LazyMethodGen(Modifier.PUBLIC, Type.VOID, declareName, NO_ARGS, EMPTY_STRINGS, cg);
                InstructionList declareMethodBody = declareMethod.getBody();
                declareMethodBody.append(InstructionFactory.RETURN);
                declareMethod.addAnnotation(constructedAnnotation);
@@ -909,7 +910,7 @@ public class ConcreteAspectCodeGen {
                }
 
                // Time to construct the method itself:
-               LazyMethodGen advice = new LazyMethodGen(Modifier.PUBLIC, returnType, adviceName, paramTypes.toArray(new Type[0]), EMPTY_STRINGS, cg);
+               LazyMethodGen advice = new LazyMethodGen(Modifier.PUBLIC, returnType, adviceName, paramTypes.toArray(NO_ARGS), EMPTY_STRINGS, cg);
 
                InstructionList adviceBody = advice.getBody();
 
index abbfdf974d34b99ffe9bf54ccc28e5147e11fc4c..4579308b95ff9675df7e59f0299007eb6a2a10de 100644 (file)
@@ -141,9 +141,9 @@ public class AdviceDeclaration extends AjMethodDeclaration {
 
                        // XXX set these correctly
                        formalsUnchangedToProceed = new boolean[baseArgumentCount];
-                       proceedCallSignatures = new ResolvedMember[0];
+                       proceedCallSignatures = ResolvedMember.NONE;
                        proceedInInners = false;
-                       declaredExceptions = new UnresolvedType[0];
+                       declaredExceptions = UnresolvedType.NONE;
 
                        for (Proceed call : proceedCalls) {
                                if (call.inInner) {
index f1155fe2f487f59505f4c14da4cffc268b172d47..4de7c57e01709794565d35458e3bbc2811071c3e 100644 (file)
@@ -1129,7 +1129,7 @@ public class AspectDeclaration extends TypeDeclaration {
        }
 
        private PerClause resolvePerClause() {
-               EclipseScope iscope = new EclipseScope(new FormalBinding[0], scope);
+               EclipseScope iscope = new EclipseScope(FormalBinding.NONE, scope);
                perClause.resolve(iscope);
                return perClause;
        }
index 072bbeee589f1a1802a330fe769309fabaff3259..25df5deea5499b628e07c96f9b9dcf87be056034 100644 (file)
@@ -147,7 +147,7 @@ public class DeclareDeclaration extends AjMethodDeclaration {
                        return null;
                }
 
-               EclipseScope scope = new EclipseScope(new FormalBinding[0], classScope);
+               EclipseScope scope = new EclipseScope(FormalBinding.NONE, classScope);
 
                declareDecl.resolve(scope);
                return declareDecl;
index cbac1619c5e2f7941e5950039e6f46199d0f310d..285f6f5bf669314361af8fea3862f732d1cb229f 100644 (file)
@@ -280,7 +280,7 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
                        if (perClause != null && !perClause.equals("")) {
                                ISourceContext context = new EclipseSourceContext(unit.compilationResult, pcLoc[0]);
                                Pointcut pc = new PatternParser(perClause, context).maybeParsePerClause();
-                               FormalBinding[] bindings = new FormalBinding[0];
+                               FormalBinding[] bindings = FormalBinding.NONE;
                                if (pc != null)
                                        pc.resolve(new EclipseScope(bindings, typeDecl.scope));
                        }
@@ -430,9 +430,9 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
 
        private FormalBinding[] buildFormalAdviceBindingsFrom(MethodDeclaration mDecl) {
                if (mDecl.arguments == null)
-                       return new FormalBinding[0];
+                       return FormalBinding.NONE;
                if (mDecl.binding == null)
-                       return new FormalBinding[0];
+                       return FormalBinding.NONE;
                EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(mDecl.scope);
                String extraArgName = maybeGetExtraArgName();
                if (extraArgName == null)
index 5f8b1f2f720141eababf0018a0419a396acc3d62..dadb3bb091b4dc64c00243e8c3f4e7780174d988 100644 (file)
@@ -291,7 +291,7 @@ public class EclipseFactory {
                        // act of resolution here may cause recursion problems since the parameters may
                        // be type variables that we haven't fixed up yet.
                        if (arguments == null) {
-                               arguments = new UnresolvedType[0];
+                               arguments = UnresolvedType.NONE;
                                // for pr384398
                                if (!hasAnyArguments(ptb)) {
                                        return UnresolvedType.forRawTypeName(getName(binding));
index 49c80e318cbaea08790af2ae308f1457a0929dc9..8ed7a0275a47204c56812e7a33eaae53e1b6fc03 100644 (file)
@@ -349,9 +349,9 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
                        declaredFields.add(factory.makeResolvedMember(f));
                }
 
-               this.declaredPointcuts = declaredPointcuts.toArray(new ResolvedPointcutDefinition[0]);
-               this.declaredMethods = declaredMethods.toArray(new ResolvedMember[0]);
-               this.declaredFields = declaredFields.toArray(new ResolvedMember[0]);
+               this.declaredPointcuts = declaredPointcuts.toArray(ResolvedPointcutDefinition.NO_POINTCUTS);
+               this.declaredMethods = declaredMethods.toArray(ResolvedMember.NONE);
+               this.declaredFields = declaredFields.toArray(ResolvedMember.NONE);
        }
 
        private final static char[] valuesCharArray = "values".toCharArray();
@@ -395,10 +395,10 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
 
        private FormalBinding[] buildFormalAdviceBindingsFrom(AbstractMethodDeclaration mDecl) {
                if (mDecl.arguments == null) {
-                       return new FormalBinding[0];
+                       return FormalBinding.NONE;
                }
                if (mDecl.binding == null) {
-                       return new FormalBinding[0];
+                       return FormalBinding.NONE;
                }
                EclipseFactory factory = EclipseFactory.fromScopeLookupEnvironment(mDecl.scope);
                String extraArgName = "";// maybeGetExtraArgName();
@@ -1198,7 +1198,7 @@ public class EclipseSourceType extends AbstractReferenceTypeDelegate {
        @Override
        public TypeVariable[] getTypeVariables() {
                if (declaration.typeParameters == null) {
-                       return new TypeVariable[0];
+                       return TypeVariable.NONE;
                }
                TypeVariable[] typeVariables = new TypeVariable[declaration.typeParameters.length];
                for (int i = 0; i < typeVariables.length; i++) {
index 284786213d8632fbbd33bae52898b654ffb49cfe..94cf7561ed8fccaed1990cbe813da560be40a7dd 100644 (file)
@@ -104,7 +104,7 @@ public abstract class Advice extends ShadowMunger {
                if (signature != null) {
                        bindingParameterTypes = signature.getParameterTypes();
                } else {
-                       bindingParameterTypes = new UnresolvedType[0];
+                       bindingParameterTypes = UnresolvedType.NONE;
                }
        }
 
index b20d0c2ca61e74b9473a2bd4ee13094ddf169676..88e14400d8598909b98906fd724377ed3b468c26 100644 (file)
@@ -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;
        }
 
index 33111fc65b775f09f3f9d5c7e5d3f65cf67d54b1..f837ac522080363a3944e7755989ae3c837f6d23 100644 (file)
@@ -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 {
index 8d3159dc5cfb5d57f77f9b96660456546acd60e3..a21461592024ac6e3a9a9c9e167780678406196e 100644 (file)
@@ -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
index dcf5f21ae1491ea70ac789a707e66ab22b364e24..b0069d840cc6817cd57a7d5e3148e6eba69b5927 100644 (file)
@@ -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();
index d9b61c603881289cf41265523cb006074b24c33b..ede14efcabf0171cf2ca1e379d5eaf636b4d836c 100644 (file)
@@ -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() {
index 40014cda4025c5aa0921348e7857ef6fd9eaf3ab..5ecbd81151afe7ac3f9ad9277f2f422f4525c1e8 100644 (file)
@@ -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;
index 39f989a697947447b47dc18b45fe5c83125f36d5..e9e48e9105ed162e482264aa32b49c201d539226 100644 (file)
@@ -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;
        }
 
        /*
index 8da8151cf3529e497ea213f65887c9ce509f3080..9e42e7b82c425649ee89cbb63c992ceb34002221 100644 (file)
@@ -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());
                }
index 59fcb9082a51b52219bec14c85f40734bec5152a..ad584fa354fb4bd53ba5b94190c5e72c693b8bd3 100644 (file)
@@ -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);
index e68a78b7e18cc657d11037836c270cc30d19e3c0..3ac8787712c606374498f6f2ada82a0a8d9ce446 100644 (file)
@@ -38,7 +38,7 @@ public class GenericSignature {
        }
 
        public static class MethodTypeSignature {
-               public FormalTypeParameter[] formalTypeParameters = new FormalTypeParameter[0];
+               public FormalTypeParameter[] formalTypeParameters = FormalTypeParameter.NONE;
                public TypeSignature[] parameters = new TypeSignature[0];
                public TypeSignature returnType;
                public FieldTypeSignature[] throwsSignatures = new FieldTypeSignature[0];
index 3f1f3d52a2b6392d1a1b729c86c81222534df24e..b6fbe4b4b6aeeed6a3bc7d1db8ced07b7f1c49d4 100644 (file)
@@ -71,7 +71,7 @@ public class GenericSignatureParser {
                this.inputString = sig;
                tokenStream = tokenize(sig);
                tokenIndex = 0;
-               FormalTypeParameter[] formals = new FormalTypeParameter[0];
+               FormalTypeParameter[] formals = FormalTypeParameter.NONE;
                TypeSignature returnType = null;
                // FormalTypeParameters-opt
                if (maybeEat("<")) {
index 58af6d64f50e4667a725025e4bb661733a1bff82..77b3aa47aef0f3579a1e41ec29289178099f0de4 100644 (file)
@@ -558,7 +558,7 @@ public class AtAjAttributes {
                                // struct.ajAttributes.add(new AjAttribute.WeaverVersionInfo());
                                AjAttribute.Aspect aspectAttribute = new AjAttribute.Aspect(perClause);
                                struct.ajAttributes.add(aspectAttribute);
-                               FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
+                               FormalBinding[] bindings = FormalBinding.NONE;
                                final IScope binding;
                                binding = new BindingScope(struct.enclosingType, struct.context, bindings);
 
@@ -717,7 +717,7 @@ public class AtAjAttributes {
                                }
                                if (fieldType.isInterface()) {
                                        TypePattern parent = parseTypePattern(fieldType.getName(), struct);
-                                       FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
+                                       FormalBinding[] bindings = FormalBinding.NONE;
                                        IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);
                                        // first add the declare implements like
                                        List<TypePattern> parents = new ArrayList<>(1);
@@ -970,7 +970,7 @@ public class AtAjAttributes {
                }
 
                // Create the declare parents that will add the interfaces to matching targets
-               FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
+               FormalBinding[] bindings = FormalBinding.NONE;
                IScope binding = new BindingScope(struct.enclosingType, struct.context, bindings);
                // how do we mark this as a decp due to decmixin?
                DeclareParents dp = new DeclareParentsMixin(targetTypePattern, newParents);
@@ -990,7 +990,7 @@ public class AtAjAttributes {
                        // TODO check for overlapping interfaces. Eg. A implements I, I extends J - if they specify interfaces={I,J} we dont
                        // want to do any methods twice
                        ResolvedMember[] methods = typeForDelegation.getMethodsWithoutIterator(true, false, false).toArray(
-                                       new ResolvedMember[0]);
+                    ResolvedMember.NONE);
                        for (ResolvedMember resolvedMember : methods) {
                                ResolvedMember method = resolvedMember;
                                if (method.isAbstract()) {
@@ -1033,7 +1033,7 @@ public class AtAjAttributes {
                                if (argumentNames != null) {
                                        struct.unparsedArgumentNames = argumentNames;
                                }
-                               FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
+                               FormalBinding[] bindings = FormalBinding.NONE;
                                try {
                                        bindings = extractBindings(struct);
                                } catch (UnreadableDebugInfoException unreadableDebugInfoException) {
@@ -1082,7 +1082,7 @@ public class AtAjAttributes {
                        NameValuePair afterAdvice = getAnnotationElement(after, VALUE);
                        if (afterAdvice != null) {
                                // this/target/args binding
-                               FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
+                               FormalBinding[] bindings = FormalBinding.NONE;
                                String argumentNames = getArgNamesValue(after);
                                if (argumentNames != null) {
                                        struct.unparsedArgumentNames = argumentNames;
@@ -1172,7 +1172,7 @@ public class AtAjAttributes {
                        // this/target/args binding
                        // exclude the return binding from the pointcut binding since it is
                        // an extraArg binding
-                       FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
+                       FormalBinding[] bindings = FormalBinding.NONE;
                        try {
                                bindings = (returned == null ? extractBindings(struct) : extractBindings(struct, returned));
                        } catch (UnreadableDebugInfoException unreadableDebugInfoException) {
@@ -1262,7 +1262,7 @@ public class AtAjAttributes {
                        // this/target/args binding
                        // exclude the throwned binding from the pointcut binding since it
                        // is an extraArg binding
-                       FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
+                       FormalBinding[] bindings = FormalBinding.NONE;
                        try {
                                bindings = (thrownFormal == null ? extractBindings(struct) : extractBindings(struct, thrownFormal));
                        } catch (UnreadableDebugInfoException unreadableDebugInfoException) {
@@ -1317,7 +1317,7 @@ public class AtAjAttributes {
                                if (argumentNames != null) {
                                        struct.unparsedArgumentNames = argumentNames;
                                }
-                               FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
+                               FormalBinding[] bindings = FormalBinding.NONE;
                                try {
                                        bindings = extractBindings(struct);
                                } catch (UnreadableDebugInfoException unreadableDebugInfoException) {
@@ -1579,7 +1579,7 @@ public class AtAjAttributes {
                        }
                }
 
-               return bindings.toArray(new FormalBinding[] {});
+               return bindings.toArray(FormalBinding.NONE);
        }
 
        // FIXME alex deal with exclude index
index 586147827ebfb7dd1c7247f4da7fd3398a6d025d..3e50444d4f751d7b41efe7d5d0fbc264f7b0ae5b 100644 (file)
@@ -56,7 +56,7 @@ public class BcelCflowCounterFieldAdder extends BcelTypeMunger {
 
                setup.append(fact.createNew(new ObjectType(NameMangler.CFLOW_COUNTER_TYPE)));
                setup.append(InstructionFactory.createDup(1));
-               setup.append(fact.createInvoke(NameMangler.CFLOW_COUNTER_TYPE, "<init>", Type.VOID, new Type[0], Constants.INVOKESPECIAL));
+               setup.append(fact.createInvoke(NameMangler.CFLOW_COUNTER_TYPE, "<init>", Type.VOID, Type.NO_ARGS, Constants.INVOKESPECIAL));
 
                setup.append(Utility.createSet(fact, cflowCounterField));
                clinit.getBody().insert(setup);
index 3ffe74773843b7a1b190b9bca9780056797a4523..42679304b28c861a840a7dae699688b2341b2f9d 100644 (file)
@@ -1946,7 +1946,7 @@ class BcelClassWeaver implements IClassWeaver {
                                catchBlockForLiteralLoadingFail.append(InstructionFactory.createDup_1(1));
                                catchBlockForLiteralLoadingFail.append(InstructionFactory.SWAP);
                                catchBlockForLiteralLoadingFail.append(fact.createInvoke("java.lang.Throwable", "getMessage",
-                                               Type.getType(String.class), new Type[] {}, Constants.INVOKEVIRTUAL));
+                                               Type.getType(String.class), Type.NO_ARGS, Constants.INVOKEVIRTUAL));
                                catchBlockForLiteralLoadingFail.append(fact.createInvoke("java.lang.NoClassDefFoundError", "<init>", Type.VOID,
                                                new Type[] { Type.getType(String.class) }, Constants.INVOKESPECIAL));
                                catchBlockForLiteralLoadingFail.append(InstructionFactory.ATHROW);
index 4428fdf42622598b416f4809fbd5eb91b46fb214..37876a3cb1cc83a07ecfada8315b3ea65d66517d 100644 (file)
@@ -273,7 +273,7 @@ final class BcelField extends ResolvedMemberImpl {
                        GenericSignature.ClassSignature genericTypeSig = bcelObjectType.getGenericClassTypeSignature();
 
                        GenericSignature.FormalTypeParameter[] parentFormals = bcelObjectType.getAllFormals();
-                       GenericSignature.FormalTypeParameter[] typeVars = ((genericTypeSig == null) ? new GenericSignature.FormalTypeParameter[0]
+                       GenericSignature.FormalTypeParameter[] typeVars = ((genericTypeSig == null) ? GenericSignature.FormalTypeParameter.NONE
                                        : genericTypeSig.formalTypeParameters);
                        GenericSignature.FormalTypeParameter[] formals = new GenericSignature.FormalTypeParameter[parentFormals.length
                                        + typeVars.length];
index abf1b3c1aad15fb3eef0f80028ee3932bd61e387..882548cbe6e8b150e7cf8672382bbfedec3f467d 100644 (file)
@@ -423,15 +423,13 @@ class BcelMethod extends ResolvedMemberImpl {
                bitflags |= HAS_ANNOTATIONS;
        }
 
-       public static final AnnotationAJ[] NO_PARAMETER_ANNOTATIONS = new AnnotationAJ[] {};
-
        public void addParameterAnnotation(int param, AnnotationAJ anno) {
                ensureParameterAnnotationsRetrieved();
                if (parameterAnnotations == NO_PARAMETER_ANNOTATIONXS) {
                        // First time we've added any, so lets set up the array
                        parameterAnnotations = new AnnotationAJ[getArity()][];
                        for (int i = 0; i < getArity(); i++) {
-                               parameterAnnotations[i] = NO_PARAMETER_ANNOTATIONS;
+                               parameterAnnotations[i] = AnnotationAJ.EMPTY_ARRAY;
                        }
                }
                int existingCount = parameterAnnotations[param].length;
index d1c4a9f42ef95fe4cf56b4367f59af0115e10c37..7d471a6b6ecf15e8797ec4ee468db3625d4e8925 100644 (file)
@@ -398,7 +398,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
                if (pointcuts.size() == 0) {
                        this.pointcuts = ResolvedPointcutDefinition.NO_POINTCUTS;
                } else {
-                       this.pointcuts = pointcuts.toArray(new ResolvedPointcutDefinition[0]);
+                       this.pointcuts = pointcuts.toArray(ResolvedPointcutDefinition.NO_POINTCUTS);
                }
 
                resolveAnnotationDeclares(l);
@@ -459,7 +459,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
         * until *after* the pointcuts have been resolved.
         */
        private void resolveAnnotationDeclares(List<AjAttribute> attributeList) {
-               FormalBinding[] bindings = new org.aspectj.weaver.patterns.FormalBinding[0];
+               FormalBinding[] bindings = FormalBinding.NONE;
                IScope bindingScope = new BindingScope(getResolvedTypeX(), getResolvedTypeX().getSourceContext(), bindings);
                for (AjAttribute a : attributeList) {
                        if (a instanceof AjAttribute.DeclareAttribute) {
@@ -836,7 +836,7 @@ public class BcelObjectType extends AbstractReferenceTypeDelegate {
        public GenericSignature.FormalTypeParameter[] getAllFormals() {
                ensureGenericSignatureUnpacked();
                if (formalsForResolution == null) {
-                       return new GenericSignature.FormalTypeParameter[0];
+                       return FormalTypeParameter.NONE;
                } else {
                        return formalsForResolution;
                }
index 4d2e2bc888d41475f9c02dffeeccda9371bec7e5..9640fe11816ff24b3bc45f65568f23a93ec90cdd 100644 (file)
@@ -2047,7 +2047,7 @@ public class BcelShadow extends Shadow {
 
                        if (isPer) {
                                entrySuccessInstructions.append(fact.createInvoke(munger.getConcreteAspect().getName(),
-                                               NameMangler.PERCFLOW_PUSH_METHOD, Type.VOID, new Type[] {}, Constants.INVOKESTATIC));
+                                               NameMangler.PERCFLOW_PUSH_METHOD, Type.VOID, Type.NO_ARGS, Constants.INVOKESTATIC));
                        } else {
                                BcelVar[] cflowStateVars = munger.getExposedStateAsBcelVars(false);
 
@@ -2059,7 +2059,7 @@ public class BcelShadow extends Shadow {
                                        entrySuccessInstructions.append(Utility.createGet(fact, cflowField));
                                        // arrayVar.appendLoad(entrySuccessInstructions, fact);
                                        entrySuccessInstructions.append(fact.createInvoke(NameMangler.CFLOW_COUNTER_TYPE, "inc", Type.VOID,
-                                                       new Type[] {}, Constants.INVOKEVIRTUAL));
+                                                       Type.NO_ARGS, Constants.INVOKEVIRTUAL));
                                } else {
                                        BcelVar arrayVar = genTempVar(UnresolvedType.OBJECTARRAY);
 
@@ -2097,10 +2097,10 @@ public class BcelShadow extends Shadow {
                                exitInstructions.append(Utility.createGet(fact, cflowField));
                                if (munger.getKind() != AdviceKind.PerCflowEntry && munger.getKind() != AdviceKind.PerCflowBelowEntry
                                                && munger.getExposedStateAsBcelVars(false).length == 0) {
-                                       exitInstructions.append(fact.createInvoke(NameMangler.CFLOW_COUNTER_TYPE, "dec", Type.VOID, new Type[] {},
+                                       exitInstructions.append(fact.createInvoke(NameMangler.CFLOW_COUNTER_TYPE, "dec", Type.VOID, Type.NO_ARGS,
                                                        Constants.INVOKEVIRTUAL));
                                } else {
-                                       exitInstructions.append(fact.createInvoke(NameMangler.CFLOW_STACK_TYPE, "pop", Type.VOID, new Type[] {},
+                                       exitInstructions.append(fact.createInvoke(NameMangler.CFLOW_STACK_TYPE, "pop", Type.VOID, Type.NO_ARGS,
                                                        Constants.INVOKEVIRTUAL));
                                }
                                return exitInstructions;
index fc2a2451a48b03335cda1210dac26070dab1b3d6..9e56d9e883fd90e0e7bcbf56beec96fb3f287e4b 100644 (file)
@@ -783,7 +783,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
 
                        Type fieldType = BcelWorld.makeBcelType(aspectType);
                        LazyMethodGen mg = new LazyMethodGen(Modifier.PUBLIC, fieldType, NameMangler.perObjectInterfaceGet(aspectType),
-                                       new Type[0], new String[0], gen);
+                                       Type.NO_ARGS, new String[0], gen);
                        InstructionList il = new InstructionList();
                        InstructionFactory fact = gen.getFactory();
                        il.append(InstructionConstants.ALOAD_0);
@@ -832,7 +832,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
                // "public com_blah_SecurityAspect ajc$com_blah_SecurityAspect$localAspectOf()"
                Type fieldType = BcelWorld.makeBcelType(aspectType);
                LazyMethodGen mg = new LazyMethodGen(Modifier.PUBLIC | Modifier.STATIC, fieldType,
-                               NameMangler.perTypeWithinLocalAspectOf(aspectType), new Type[0], new String[0], gen);
+                               NameMangler.perTypeWithinLocalAspectOf(aspectType), Type.NO_ARGS, new String[0], gen);
                InstructionList il = new InstructionList();
                // PTWIMPL ?? Should check if it is null and throw
                // NoAspectBoundException
index 4a0ed1358123bda84ad480c6bbccbc0ed29f0859..90a8dadb2426c8e4e337045a7cc4bb25477d6808 100644 (file)
@@ -990,7 +990,7 @@ public final class LazyClassGen {
                                return gen;
                        }
                }
-               LazyMethodGen clinit = new LazyMethodGen(Modifier.STATIC, Type.VOID, "<clinit>", new Type[0], NO_STRINGS, this);
+               LazyMethodGen clinit = new LazyMethodGen(Modifier.STATIC, Type.VOID, "<clinit>", Type.NO_ARGS, NO_STRINGS, this);
                clinit.getBody().insert(InstructionConstants.RETURN);
                methodGens.add(clinit);
                return clinit;
index 022345d4048e65037860a32afa2b07877aa3596e..fb8cf52a9bb2fab296b38abf440cae90a459301b 100644 (file)
@@ -78,8 +78,6 @@ import org.aspectj.weaver.tools.Traceable;
  */
 public final class LazyMethodGen implements Traceable {
 
-       private static final AnnotationAJ[] NO_ANNOTATIONAJ = new AnnotationAJ[] {};
-
        private int modifiers;
        private Type returnType;
        private final String name;
@@ -305,7 +303,7 @@ public final class LazyMethodGen implements Traceable {
                                                newParameterAnnotations[i] = new AnnotationAJ[1];
                                                newParameterAnnotations[i][0] = anno;
                                        } else {
-                                               newParameterAnnotations[i] = NO_ANNOTATIONAJ;
+                                               newParameterAnnotations[i] = AnnotationAJ.EMPTY_ARRAY;
                                        }
                                }
                        } else {
@@ -336,7 +334,7 @@ public final class LazyMethodGen implements Traceable {
        public AnnotationAJ[] getAnnotations() {
                initialize();
                if (memberView == null && newAnnotations!=null && newAnnotations.size()!=0) {
-                       return newAnnotations.toArray(new AnnotationAJ[0]);
+                       return newAnnotations.toArray(AnnotationAJ.EMPTY_ARRAY);
                }
                return null;
        }
@@ -618,7 +616,7 @@ public final class LazyMethodGen implements Traceable {
                if (enclosingClass != null && enclosingClass.getType() != null) {
                        context = enclosingClass.getType().getSourceContext();
                }
-               List<AjAttribute> as = Utility.readAjAttributes(getClassName(), attributes.toArray(new Attribute[] {}), context, null, weaverVersion,
+               List<AjAttribute> as = Utility.readAjAttributes(getClassName(), attributes.toArray(Attribute.NoAttributes), context, null, weaverVersion,
                                new BcelConstantPoolReader(this.enclosingClass.getConstantPool()));
                if (!as.isEmpty()) {
                        out.println("    " + as.get(0)); // XXX assuming exactly one
index d982fd4b4aa1eadccb8739c471e38a3106f8d223..6fee85141218f43f901b4a3d7fdc5d230f47c1ad 100644 (file)
@@ -59,7 +59,7 @@ public class TypeAnnotationAccessVar extends BcelVar {
                Type jlClass = BcelWorld.makeBcelType(UnresolvedType.JL_CLASS);
                Type jlaAnnotation = BcelWorld.makeBcelType(UnresolvedType.ANNOTATION);
                il.append(target.createLoad(fact));
-               il.append(fact.createInvoke("java/lang/Object", "getClass", jlClass, new Type[] {}, Constants.INVOKEVIRTUAL));
+               il.append(fact.createInvoke("java/lang/Object", "getClass", jlClass, Type.NO_ARGS, Constants.INVOKEVIRTUAL));
                il.append(fact.createConstant(new ObjectType(toType.getName())));
                il.append(fact.createInvoke("java/lang/Class", "getAnnotation", jlaAnnotation, new Type[] { jlClass },
                                Constants.INVOKEVIRTUAL));
index 6cfc4fb778bf279043ea029eb818924fb37b0a44..dfddd18da673a5ba62a3318bc8ad792c8a3b7601 100644 (file)
@@ -20,6 +20,7 @@ import org.aspectj.apache.bcel.classfile.Attribute;
 import org.aspectj.apache.bcel.classfile.JavaClass;
 import org.aspectj.apache.bcel.classfile.LocalVariable;
 import org.aspectj.apache.bcel.classfile.LocalVariableTable;
+import org.aspectj.apache.bcel.classfile.annotation.AnnotationGen;
 import org.aspectj.apache.bcel.util.ClassLoaderRepository;
 import org.aspectj.apache.bcel.util.NonCachingClassLoaderRepository;
 import org.aspectj.apache.bcel.util.Repository;
@@ -124,7 +125,7 @@ public class Java15AnnotationFinder implements AnnotationFinder, ArgNameFinder {
                // memory.
                try {
                        JavaClass jc = bcelRepository.loadClass(onMember.getDeclaringClass());
-                       org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[] anns = new org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[0];
+                       org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[] anns = AnnotationGen.NO_ANNOTATIONS;
                        if (onMember instanceof Method) {
                                org.aspectj.apache.bcel.classfile.Method bcelMethod = jc.getMethod((Method) onMember);
                                if (bcelMethod == null) {
@@ -147,7 +148,7 @@ public class Java15AnnotationFinder implements AnnotationFinder, ArgNameFinder {
                        bcelRepository.clear();
                        // OPTIMIZE make constant 0 size array for sharing
                        if (anns == null)
-                               anns = new org.aspectj.apache.bcel.classfile.annotation.AnnotationGen[0];
+                               anns = AnnotationGen.NO_ANNOTATIONS;
                        // convert to our Annotation type
                        for (org.aspectj.apache.bcel.classfile.annotation.AnnotationGen ann : anns) {
                                if (ann.getTypeSignature().equals(ofType.getSignature())) {
index 2fccd1dd7408e382840dee31e69e195cd391c27e..a9527b6f7bbe473a3e51f4ad10bb687e6ee2ad6d 100644 (file)
@@ -250,7 +250,7 @@ public class Java15ReflectionBasedReferenceTypeDelegate extends ReflectionBasedR
        private ResolvedMember createGenericFieldMember(Field forField) {
                ReflectionBasedResolvedMemberImpl ret = new ReflectionBasedResolvedMemberImpl(org.aspectj.weaver.Member.FIELD,
                                getGenericResolvedType(), forField.getModifiers(), typeConverter.fromType(forField.getType()), forField.getName(),
-                               new UnresolvedType[0], forField);
+                               UnresolvedType.NONE, forField);
                ret.setAnnotationFinder(this.annotationFinder);
                ret.setGenericSignatureInformationProvider(new Java15GenericSignatureInformationProvider(this.getWorld()));
                return ret;
index 799dbdfdcfac51b2dcf4e77c5ffd3462637d62d6..caf984821434ee315b6b1dca50dd747bda8e6d95 100644 (file)
@@ -94,7 +94,7 @@ public class JavaLangTypeToResolvedTypeConverter {
                        Type[] bounds = tv.getBounds();
                        ResolvedType[] resBounds = fromTypes(bounds);
                        ResolvedType upperBound = resBounds[0];
-                       ResolvedType[] additionalBounds = new ResolvedType[0];
+                       ResolvedType[] additionalBounds = ResolvedType.EMPTY_RESOLVED_TYPE_ARRAY;
                        if (resBounds.length > 1) {
                                additionalBounds = new ResolvedType[resBounds.length - 1];
                                System.arraycopy(resBounds, 1, additionalBounds, 0, additionalBounds.length);