diff options
author | Andrey Turbanov <turbanoff@gmail.com> | 2021-12-18 15:20:43 +0300 |
---|---|---|
committer | Andrey Turbanov <turbanoff@gmail.com> | 2021-12-18 15:20:43 +0300 |
commit | 4c8c90de69b4e3cdeea0f598fea5a5358ac2c861 (patch) | |
tree | 6b1526b6d91bde9f3a1e00bace4e12cde6b6dfd4 /weaver/src | |
parent | 4021ffcbfe320a1b91bb2bcee7a112f7122ef82d (diff) | |
download | aspectj-4c8c90de69b4e3cdeea0f598fea5a5358ac2c861.tar.gz aspectj-4c8c90de69b4e3cdeea0f598fea5a5358ac2c861.zip |
Reduce empty array allocations
Diffstat (limited to 'weaver/src')
14 files changed, 33 insertions, 36 deletions
diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java index 58af6d64f..77b3aa47a 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/AtAjAttributes.java @@ -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 diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowCounterFieldAdder.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowCounterFieldAdder.java index 586147827..3e50444d4 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowCounterFieldAdder.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelCflowCounterFieldAdder.java @@ -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); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java index 3ffe74773..42679304b 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -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); diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelField.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelField.java index 4428fdf42..37876a3cb 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelField.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelField.java @@ -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]; diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java index abf1b3c1a..882548cbe 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelMethod.java @@ -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; diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java index d1c4a9f42..7d471a6b6 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelObjectType.java @@ -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; } diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java index 4d2e2bc88..9640fe118 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelShadow.java @@ -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; diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java index fc2a2451a..9e56d9e88 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -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 diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java index 4a0ed1358..90a8dadb2 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyClassGen.java @@ -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; diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java index 022345d40..fb8cf52a9 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -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 diff --git a/weaver/src/main/java/org/aspectj/weaver/bcel/TypeAnnotationAccessVar.java b/weaver/src/main/java/org/aspectj/weaver/bcel/TypeAnnotationAccessVar.java index d982fd4b4..6fee85141 100644 --- a/weaver/src/main/java/org/aspectj/weaver/bcel/TypeAnnotationAccessVar.java +++ b/weaver/src/main/java/org/aspectj/weaver/bcel/TypeAnnotationAccessVar.java @@ -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)); diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java b/weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java index 6cfc4fb77..dfddd18da 100644 --- a/weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java +++ b/weaver/src/main/java/org/aspectj/weaver/reflect/Java15AnnotationFinder.java @@ -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())) { diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java b/weaver/src/main/java/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java index 2fccd1dd7..a9527b6f7 100644 --- a/weaver/src/main/java/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java +++ b/weaver/src/main/java/org/aspectj/weaver/reflect/Java15ReflectionBasedReferenceTypeDelegate.java @@ -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; diff --git a/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java b/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java index 799dbdfdc..caf984821 100644 --- a/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java +++ b/weaver/src/main/java/org/aspectj/weaver/reflect/JavaLangTypeToResolvedTypeConverter.java @@ -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); |