From 87da93e5cbf1056963305b0c3526c7d3df04b3ca Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 7 Feb 2007 13:50:05 +0000 Subject: [PATCH] Don't create multiple ExposeTypeMungers for the same type, it is *dumb* --- .../aspectj/weaver/CrosscuttingMembers.java | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java b/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java index 9ceacacd1..3ff7d75aa 100644 --- a/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java +++ b/weaver/src/org/aspectj/weaver/CrosscuttingMembers.java @@ -9,8 +9,6 @@ * Contributors: * PARC initial implementation * ******************************************************************/ - - package org.aspectj.weaver; import java.util.ArrayList; @@ -168,10 +166,21 @@ public class CrosscuttingMembers { typeToExpose = UnresolvedType.forSignature(typeToExpose.getErasureSignature()); } } - ResolvedMember member = new ResolvedMemberImpl( - Member.STATIC_INITIALIZATION, typeToExpose, 0, ResolvedType.VOID, "", UnresolvedType.NONE); - addTypeMunger(world.concreteTypeMunger( - new PrivilegedAccessMunger(member), inAspect)); + // Check we haven't already got a munger for this: + String signatureToLookFor = typeToExpose.getSignature(); + for (Iterator iterator = typeMungers.iterator(); iterator.hasNext();) { + ConcreteTypeMunger cTM = (ConcreteTypeMunger) iterator.next(); + ResolvedTypeMunger rTM = cTM.getMunger(); + if (rTM!=null && rTM instanceof ExposeTypeMunger) { + String exposedType = ((ExposeTypeMunger)rTM).getExposedTypeSignature(); + if (exposedType.equals(signatureToLookFor)) return; // dont need to bother + } + } + addTypeMunger(world.concreteTypeMunger(new ExposeTypeMunger(typeToExpose), inAspect)); +// ResolvedMember member = new ResolvedMemberImpl( +// Member.STATIC_INITIALIZATION, typeToExpose, 0, ResolvedType.VOID, "", UnresolvedType.NONE); +// addTypeMunger(world.concreteTypeMunger( +// new PrivilegedAccessMunger(member), inAspect)); } public void addPrivilegedAccesses(Collection accessedMembers) { -- 2.39.5