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 MAP can provide aspect information at runtime.
25 * Done: - AspectDeclaration - AdviceDeclaration - PointcutDeclaration
27 * To Do: - DeclareDeclaration - Inter-Type Declaration
29 public class AddAtAspectJAnnotationsVisitor extends ASTVisitor {
31 // private CompilationUnitDeclaration unit;
33 public AddAtAspectJAnnotationsVisitor(CompilationUnitDeclaration unit) {
37 public boolean visit(TypeDeclaration localTypeDeclaration, BlockScope scope) {
38 if (localTypeDeclaration instanceof AspectDeclaration) {
39 ((AspectDeclaration) localTypeDeclaration).addAtAspectJAnnotations();
44 public boolean visit(TypeDeclaration memberTypeDeclaration, ClassScope scope) {
45 if (memberTypeDeclaration instanceof AspectDeclaration) {
46 ((AspectDeclaration) memberTypeDeclaration).addAtAspectJAnnotations();
51 public boolean visit(TypeDeclaration typeDeclaration, CompilationUnitScope scope) {
52 if (typeDeclaration instanceof AspectDeclaration) {
53 ((AspectDeclaration) typeDeclaration).addAtAspectJAnnotations();
58 public boolean visit(MethodDeclaration methodDeclaration, ClassScope scope) {
59 if (methodDeclaration instanceof AdviceDeclaration) {
60 ((AdviceDeclaration) methodDeclaration).addAtAspectJAnnotations();
61 } else if (methodDeclaration instanceof PointcutDeclaration) {
62 ((PointcutDeclaration) methodDeclaration).addAtAspectJAnnotations();
63 } else if (methodDeclaration instanceof DeclareDeclaration) {
64 ((DeclareDeclaration) methodDeclaration).addAtAspectJAnnotations();
65 } else if (methodDeclaration instanceof InterTypeDeclaration) {
66 ((InterTypeDeclaration) methodDeclaration).addAtAspectJAnnotations();