]> source.dussan.org Git - aspectj.git/commitdiff
add last apt fix [apt]
authorhsestupin <stupin.sergey@gmail.com>
Wed, 2 Jul 2014 11:36:30 +0000 (15:36 +0400)
committerhsestupin <stupin.sergey@gmail.com>
Fri, 1 Aug 2014 17:25:16 +0000 (20:25 +0300)
Signed-off-by: hsestupin <stupin.sergey@gmail.com>
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java

index 918d0177e257e1fcfb646c636b0c04e7128e4840..49b0f7371bfd65c8a097beb2f18d6546403036eb 100644 (file)
@@ -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