From 33193b5616710b1ebd6b88dd7f78b4b8916f7dec Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 30 Oct 2008 15:45:13 +0000 Subject: [PATCH] 252702: declare parents in model --- .../core/builder/AsmHierarchyBuilder.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java index b0b8c2f95..fc03e4923 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/core/builder/AsmHierarchyBuilder.java @@ -27,6 +27,7 @@ import java.util.StringTokenizer; import org.aspectj.ajdt.internal.compiler.CompilationResultDestinationManager; import org.aspectj.ajdt.internal.compiler.ast.AdviceDeclaration; import org.aspectj.ajdt.internal.compiler.ast.AspectDeclaration; +import org.aspectj.ajdt.internal.compiler.ast.DeclareDeclaration; import org.aspectj.ajdt.internal.compiler.ast.InterTypeDeclaration; import org.aspectj.ajdt.internal.compiler.ast.PointcutDeclaration; import org.aspectj.ajdt.internal.compiler.lookup.AjLookupEnvironment; @@ -65,9 +66,12 @@ import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.UnresolvedType; import org.aspectj.weaver.World; import org.aspectj.weaver.patterns.AndPointcut; +import org.aspectj.weaver.patterns.Declare; +import org.aspectj.weaver.patterns.DeclareParents; import org.aspectj.weaver.patterns.OrPointcut; import org.aspectj.weaver.patterns.Pointcut; import org.aspectj.weaver.patterns.ReferencePointcut; +import org.aspectj.weaver.patterns.TypePatternList; /** * At each iteration of processCompilationUnit the declarations for a particular compilation unit are added to the @@ -484,6 +488,18 @@ public class AsmHierarchyBuilder extends ASTVisitor { // if (shouldAddUsesPointcut) // addUsesPointcutRelationsForNode(peNode, namedPointcuts, methodDeclaration); + if (methodDeclaration instanceof DeclareDeclaration) { + DeclareDeclaration dDeclaration = (DeclareDeclaration) methodDeclaration; + Declare decl = dDeclaration.declareDecl; + if (decl instanceof DeclareParents) { + TypePatternList tpl = ((DeclareParents) decl).getParents(); + List parents = new ArrayList(); + for (int i = 0; i < tpl.size(); i++) { + parents.add(tpl.get(i).getExactType().getName()); + } + peNode.setParentTypes(parents); + } + } if (methodDeclaration.returnType != null) { // if we don't make the distinction between ITD fields and other // methods, then we loose the type, for example int, for the field -- 2.39.5