From a7f617d3d69822f6383d9ab18561b22b69436000 Mon Sep 17 00:00:00 2001 From: hsestupin Date: Wed, 2 Jul 2014 15:36:30 +0400 Subject: [PATCH] add last apt fix [apt] Signed-off-by: hsestupin --- .../compiler/lookup/AjLookupEnvironment.java | 31 ++++++++++++++----- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index 918d0177e..49b0f7371 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -31,13 +31,7 @@ import org.aspectj.bridge.WeaveMessage; import org.aspectj.bridge.context.CompilationAndWeavingContext; import org.aspectj.bridge.context.ContextToken; import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation; -import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration; -import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation; -import org.aspectj.org.eclipse.jdt.internal.compiler.ast.NormalAnnotation; -import org.aspectj.org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference; -import org.aspectj.org.eclipse.jdt.internal.compiler.ast.SingleTypeReference; -import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration; -import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeReference; +import org.aspectj.org.eclipse.jdt.internal.compiler.ast.*; import org.aspectj.org.eclipse.jdt.internal.compiler.env.AccessRestriction; import org.aspectj.org.eclipse.jdt.internal.compiler.env.IBinaryType; import org.aspectj.org.eclipse.jdt.internal.compiler.env.INameEnvironment; @@ -1432,6 +1426,29 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC public void anonymousTypeBindingCreated(LocalTypeBinding aBinding) { factory.addSourceTypeBinding(aBinding, null); } + + @Override + public void buildTypeBindings(CompilationUnitDeclaration unit, AccessRestriction accessRestriction) { + if (this.isProcessingAnnotations && hasAspectDeclarations(unit)) { + throw new SourceTypeCollisionException(); + } + super.buildTypeBindings(unit, accessRestriction); + } + + private static boolean hasAspectDeclarations(CompilationUnitDeclaration unit) { + for (int j = 0; j < unit.types.length; j++) { + if (unit.types[j] instanceof AspectDeclaration) { + return true; + } + } + return false; + } + + @Override + public void reset() { + this.factory.cleanup(); + super.reset(); + } } // commented out, supplied as info on how to manipulate annotations in an -- 2.39.5