diff options
author | Andy Clement <aclement@pivotal.io> | 2022-01-10 08:09:47 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-10 08:09:47 -0800 |
commit | 04b4ff08535291ac111884320661ae23f1d7a3c9 (patch) | |
tree | 492cdd06efa5fa3215f1b0bb49397f25408734c3 /org.aspectj.ajdt.core | |
parent | 605b700abfb1cffcc3d39ae768d048bf6a8fef2a (diff) | |
parent | 4c8c90de69b4e3cdeea0f598fea5a5358ac2c861 (diff) | |
download | aspectj-04b4ff08535291ac111884320661ae23f1d7a3c9.tar.gz aspectj-04b4ff08535291ac111884320661ae23f1d7a3c9.zip |
Merge pull request #109 from turbanoff/avoid_empty_arrays_allocation
Reduce empty array allocations
Diffstat (limited to 'org.aspectj.ajdt.core')
6 files changed, 14 insertions, 14 deletions
diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java index abbfdf974..4579308b9 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AdviceDeclaration.java @@ -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) { diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java index f1155fe2f..4de7c57e0 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/AspectDeclaration.java @@ -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; } diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java index 072bbeee5..25df5deea 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/DeclareDeclaration.java @@ -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; diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java index cbac1619c..285f6f5bf 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java @@ -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) diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java index 5f8b1f2f7..dadb3bb09 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseFactory.java @@ -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)); diff --git a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java index 49c80e318..8ed7a0275 100644 --- a/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java +++ b/org.aspectj.ajdt.core/src/main/java/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java @@ -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++) { |