1 /* *******************************************************************
2 * Copyright (c) 2005 IBM Corporation Ltd
4 * This program and the accompanying materials are made available
5 * under the terms of the Eclipse Public License v1.0
6 * which accompanies this distribution and is available at
7 * http://www.eclipse.org/legal/epl-v10.html
10 * Adrian Colyer initial implementation
11 * ******************************************************************/
12 package org.aspectj.ajdt.internal.compiler.ast;
14 import org.aspectj.org.eclipse.jdt.internal.compiler.ASTVisitor;
15 import org.aspectj.org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration;
16 import org.aspectj.org.eclipse.jdt.internal.compiler.ast.MethodDeclaration;
17 import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
18 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.BlockScope;
19 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.ClassScope;
20 import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope;
23 * Adds runtime visible annotations to code-style aspect declarations so that the
24 * MAP can provide aspect information at runtime.
29 * - PointcutDeclaration
32 * - DeclareDeclaration
33 * - Inter-Type Declaration
35 public class AddAtAspectJAnnotationsVisitor extends ASTVisitor {
37 private CompilationUnitDeclaration unit;
39 public AddAtAspectJAnnotationsVisitor(CompilationUnitDeclaration unit) {
43 public boolean visit(TypeDeclaration localTypeDeclaration, BlockScope scope) {
44 if (localTypeDeclaration instanceof AspectDeclaration) {
45 ((AspectDeclaration) localTypeDeclaration).addAtAspectJAnnotations();
50 public boolean visit(TypeDeclaration memberTypeDeclaration,ClassScope scope) {
51 if (memberTypeDeclaration instanceof AspectDeclaration) {
52 ((AspectDeclaration) memberTypeDeclaration).addAtAspectJAnnotations();
57 public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope) {
58 if (typeDeclaration instanceof AspectDeclaration) {
59 ((AspectDeclaration) typeDeclaration).addAtAspectJAnnotations();
63 public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
64 if (methodDeclaration instanceof AdviceDeclaration) {
65 ((AdviceDeclaration)methodDeclaration).addAtAspectJAnnotations();
66 } else if (methodDeclaration instanceof PointcutDeclaration) {
67 ((PointcutDeclaration)methodDeclaration).addAtAspectJAnnotations();
68 } else if (methodDeclaration instanceof DeclareDeclaration) {
69 ((DeclareDeclaration)methodDeclaration).addAtAspectJAnnotations();