From af9f445bd7645d5b7b370f29005aa2d4f8bca804 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 17 Jun 2009 20:53:38 +0000 Subject: [PATCH] 280651: first changes: better rels --- .../weaver/model/AsmRelationshipProvider.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java b/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java index 9311f0e37..d25d8a25d 100644 --- a/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java +++ b/weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java @@ -34,6 +34,7 @@ import org.aspectj.weaver.AdviceKind; import org.aspectj.weaver.Checker; import org.aspectj.weaver.Lint; import org.aspectj.weaver.Member; +import org.aspectj.weaver.NewParentTypeMunger; import org.aspectj.weaver.ReferenceType; import org.aspectj.weaver.ResolvedMember; import org.aspectj.weaver.ResolvedPointcutDefinition; @@ -109,6 +110,12 @@ public class AsmRelationshipProvider { } } + private static boolean isMixinRelated(ResolvedTypeMunger typeTransformer) { + Kind kind = typeTransformer.getKind(); + return kind == ResolvedTypeMunger.MethodDelegate2 || kind == ResolvedTypeMunger.FieldHost + || (kind == ResolvedTypeMunger.Parent && ((NewParentTypeMunger) typeTransformer).isMixin()); + } + /** * Add a relationship for a type transformation (declare parents, intertype method declaration, declare annotation on type). */ @@ -117,7 +124,6 @@ public class AsmRelationshipProvider { if (model == null) { return; } - if (World.createInjarHierarchy && isBinaryAspect(originatingAspect)) { createHierarchy(model, typeTransformer, originatingAspect); } @@ -125,7 +131,8 @@ public class AsmRelationshipProvider { if (originatingAspect.getSourceLocation() != null) { String sourceHandle = ""; IProgramElement sourceNode = null; - if (typeTransformer.getSourceLocation() != null && typeTransformer.getSourceLocation().getOffset() != -1) { + if (typeTransformer.getSourceLocation() != null && typeTransformer.getSourceLocation().getOffset() != -1 + && !isMixinRelated(typeTransformer)) { sourceNode = model.getHierarchy().findElementForType(originatingAspect.getPackageName(), originatingAspect.getClassName()); IProgramElement closer = model.getHierarchy().findCloserMatchForLineNumber(sourceNode, @@ -157,7 +164,8 @@ public class AsmRelationshipProvider { String targetHandle = findOrFakeUpNode(model, onType); if (targetHandle == null) return; - + System.err.println("source=" + sourceHandle); + System.err.println("target=" + targetHandle); IRelationshipMap mapper = model.getRelationshipMap(); IRelationship foreward = mapper.get(sourceHandle, IRelationship.Kind.DECLARE_INTER_TYPE, INTER_TYPE_DECLARES, false, true); -- 2.39.5