]> source.dussan.org Git - aspectj.git/commitdiff
246125: all asm related stuff moved out of org.aspectj.weaver package
authoraclement <aclement>
Mon, 20 Oct 2008 22:30:28 +0000 (22:30 +0000)
committeraclement <aclement>
Mon, 20 Oct 2008 22:30:28 +0000 (22:30 +0000)
weaver/src/org/aspectj/weaver/Advice.java
weaver/src/org/aspectj/weaver/Checker.java
weaver/src/org/aspectj/weaver/ReferenceType.java
weaver/src/org/aspectj/weaver/ResolvedType.java
weaver/src/org/aspectj/weaver/Shadow.java
weaver/src/org/aspectj/weaver/ShadowMunger.java
weaver/src/org/aspectj/weaver/World.java
weaver/src/org/aspectj/weaver/bcel/BcelWorld.java
weaver/src/org/aspectj/weaver/model/AsmRelationshipProvider.java

index 2935f0d08ced8fe2f34a110c501ea33f90d6735b..0472b57013d4a2a591c0b0534f2ac85f5ceb5522 100644 (file)
@@ -49,7 +49,7 @@ public abstract class Advice extends ShadowMunger {
        // annotations on
        // this advice
 
-       ISourceLocation lastReportedMonitorExitJoinpointLocation = null;
+       public ISourceLocation lastReportedMonitorExitJoinpointLocation = null;
 
        public static Advice makeCflowEntry(World world, Pointcut entry, boolean isBelow, Member stackField, int nFreeVars,
                        List innerCflowEntries, ResolvedType inAspect) {
index c563792407b8420c227a3cd4f290d5798c0cac4b..7505d12e57149714c9933cd8874928ae88d4dacd 100644 (file)
@@ -16,82 +16,88 @@ import java.util.Collection;
 import java.util.Collections;
 import java.util.Map;
 
-import org.aspectj.asm.IRelationship;
-import org.aspectj.bridge.IMessage;
-import org.aspectj.bridge.ISourceLocation;
-import org.aspectj.bridge.Message;
-import org.aspectj.weaver.model.AsmRelationshipProvider;
 import org.aspectj.weaver.patterns.DeclareErrorOrWarning;
 import org.aspectj.weaver.patterns.PerClause;
 import org.aspectj.weaver.patterns.Pointcut;
 
+/**
+ * Representation of a shadow munger for a declare error or warning declaration.
+ * 
+ * @author Andy Clement
+ */
 public class Checker extends ShadowMunger {
 
-       private String msg;
-       private boolean isError;
+       private final String message;
+       private final boolean isError; // if not error then it is a warning
+       private volatile int hashCode = -1;
 
+       /**
+        * Create a Checker for a deow.
+        * 
+        * @param deow the declare error or warning for which to create the checker munger
+        */
        public Checker(DeclareErrorOrWarning deow) {
                super(deow.getPointcut(), deow.getStart(), deow.getEnd(), deow.getSourceContext());
-               this.msg = deow.getMessage();
+               this.message = deow.getMessage();
                this.isError = deow.isError();
        }
 
-       private Checker(Pointcut pc, int start, int end, ISourceContext context) {
+       /**
+        * Only used when filling in a parameterized Checker.
+        * 
+        * @param pc the pointcut
+        * @param start the start
+        * @param end the end
+        * @param context the source context
+        * @param message the message string
+        * @param isError whether it is an error or just a warning
+        */
+       private Checker(Pointcut pc, int start, int end, ISourceContext context, String message, boolean isError) {
                super(pc, start, end, context);
+               this.message = message;
+               this.isError = isError;
        }
 
-       public ShadowMunger concretize(ResolvedType fromType, World world, PerClause clause) {
-               pointcut = pointcut.concretize(fromType, getDeclaringType(), 0, this);
-               return this;
+       public boolean isError() {
+               return isError;
        }
 
+       /**
+        * Not supported for a Checker
+        */
        public void specializeOn(Shadow shadow) {
                throw new RuntimeException("illegal state");
        }
 
+       /**
+        * Not supported for a Checker
+        */
        public void implementOn(Shadow shadow) {
                throw new RuntimeException("illegal state");
        }
 
-       public ShadowMunger parameterizeWith(ResolvedType declaringType, Map typeVariableMap) {
-               Checker ret = new Checker(getPointcut().parameterizeWith(typeVariableMap, declaringType.getWorld()), getStart(), getEnd(),
-                               this.sourceContext);
-               ret.msg = this.msg;
-               ret.isError = this.isError;
-               return ret;
-       }
-
+       /**
+        * Determine if the Checker matches at a shadow. If it does then we can immediately report the message. There (currently) can
+        * never be a non-statically determinable match.
+        * 
+        * @param shadow the shadow which to match against
+        * @param world the world through which to access message handlers
+        */
        public boolean match(Shadow shadow, World world) {
                if (super.match(shadow, world)) {
-                       IMessage message = new Message(msg, shadow.toString(), isError ? IMessage.ERROR : IMessage.WARNING, shadow
-                                       .getSourceLocation(), null, new ISourceLocation[] { this.getSourceLocation() }, true, 0, // id
-                                       -1, -1); // source start/end
-
-                       world.getMessageHandler().handleMessage(message);
-
-                       if (world.getCrossReferenceHandler() != null) {
-                               world.getCrossReferenceHandler().addCrossReference(this.getSourceLocation(), shadow.getSourceLocation(),
-                                               (this.isError ? IRelationship.Kind.DECLARE_ERROR : IRelationship.Kind.DECLARE_WARNING), false);
-
-                       }
-
-                       if (world.getModel() != null) {
-                               AsmRelationshipProvider.getDefault().checkerMunger(world.getModel(), shadow, this);
-                       }
+                       world.reportCheckerMatch(this, shadow);
                }
                return false;
        }
 
+       // FIXME what the hell?
        public int compareTo(Object other) {
                return 0;
        }
 
-       public Collection getThrownExceptions() {
-               return Collections.EMPTY_LIST;
-       }
-
+       // FIXME Alex: ATAJ is that ok in all cases ?
        /**
-        * Default to true FIXME Alex: ATAJ is that ok in all cases ?
+        * Default to true
         * 
         * @return
         */
@@ -99,21 +105,19 @@ public class Checker extends ShadowMunger {
                return true;
        }
 
-       // XXX this perhaps ought to take account of the other fields in advice ...
+       public Collection getThrownExceptions() {
+               return Collections.EMPTY_LIST;
+       }
+
+       // FIXME this perhaps ought to take account of the other fields in advice ...
        public boolean equals(Object other) {
-               if (!(other instanceof Checker))
+               if (!(other instanceof Checker)) {
                        return false;
+               }
                Checker o = (Checker) other;
-               return o.isError == isError && ((o.pointcut == null) ? (pointcut == null) : o.pointcut.equals(pointcut))
-               // &&
-               // (AsmManager.getDefault().getHandleProvider().dependsOnLocation()
-               // ?((o.getSourceLocation()==null) ? (getSourceLocation()==null): o.getSourceLocation().equals(getSourceLocation())):true)
-               // // pr134471 - remove when handles are improved to be independent of location
-               ;
+               return o.isError == isError && ((o.pointcut == null) ? (pointcut == null) : o.pointcut.equals(pointcut));
        }
 
-       private volatile int hashCode = -1;
-
        public int hashCode() {
                if (hashCode == -1) {
                        int result = 17;
@@ -124,8 +128,24 @@ public class Checker extends ShadowMunger {
                return hashCode;
        }
 
-       public boolean isError() {
-               return isError;
+       public ShadowMunger parameterizeWith(ResolvedType declaringType, Map typeVariableMap) {
+               Checker ret = new Checker(this.pointcut.parameterizeWith(typeVariableMap, declaringType.getWorld()), this.start, this.end,
+                               this.sourceContext, this.message, this.isError);
+               return ret;
+       }
+
+       /**
+        * Concretize this Checker by concretizing the pointcut.
+        * 
+        */
+       public ShadowMunger concretize(ResolvedType theAspect, World world, PerClause clause) {
+               this.pointcut = this.pointcut.concretize(theAspect, getDeclaringType(), 0, this);
+               this.hashCode = -1;
+               return this;
+       }
+
+       public String getMessage() {
+               return this.message;
        }
 
 }
index 92f4c9f7672f470b203e77a035d6c66ab6ad7094..d1669abec1813f1f7deb67c0e9d40b7af4d072a6 100644 (file)
@@ -626,7 +626,7 @@ public class ReferenceType extends ResolvedType {
                return pclause;
        }
 
-       protected Collection getDeclares() {
+       public Collection getDeclares() {
                if (parameterizedDeclares != null)
                        return parameterizedDeclares;
                Collection declares = null;
index c9c862ab22e62cc28f0a6fd7c14f127daf3001d8..670eb3af2496f834e7b4a9491f2ac1275385ce69 100644 (file)
@@ -33,8 +33,7 @@ import org.aspectj.util.FuzzyBoolean;
 import org.aspectj.weaver.patterns.Declare;
 import org.aspectj.weaver.patterns.PerClause;
 
-public abstract class ResolvedType extends UnresolvedType implements
-               AnnotatedElement {
+public abstract class ResolvedType extends UnresolvedType implements AnnotatedElement {
 
        public static final ResolvedType[] EMPTY_RESOLVED_TYPE_ARRAY = new ResolvedType[0];
        public static final String PARAMETERIZED_TYPE_IDENTIFIER = "P";
@@ -53,8 +52,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                this.world = world;
        }
 
-       protected ResolvedType(String signature, String signatureErasure,
-                       World world) {
+       protected ResolvedType(String signature, String signatureErasure, World world) {
                super(signature, signatureErasure);
                this.world = world;
        }
@@ -62,9 +60,8 @@ public abstract class ResolvedType extends UnresolvedType implements
        // ---- things that don't require a world
 
        /**
-        * Returns an iterator through ResolvedType objects representing all the
-        * direct supertypes of this type. That is, through the superclass, if any,
-        * and all declared interfaces.
+        * Returns an iterator through ResolvedType objects representing all the direct supertypes of this type. That is, through the
+        * superclass, if any, and all declared interfaces.
         */
        public final Iterator getDirectSupertypes() {
                Iterator ifacesIterator = Iterators.array(getDeclaredInterfaces());
@@ -85,19 +82,17 @@ public abstract class ResolvedType extends UnresolvedType implements
        public abstract ResolvedMember[] getDeclaredPointcuts();
 
        /**
-        * Returns a ResolvedType object representing the superclass of this type,
-        * or null. If this represents a java.lang.Object, a primitive type, or
-        * void, this method returns null.
+        * Returns a ResolvedType object representing the superclass of this type, or null. If this represents a java.lang.Object, a
+        * primitive type, or void, this method returns null.
         */
        public abstract ResolvedType getSuperclass();
 
        /**
-        * Returns the modifiers for this type. <p/> See
-        * {@link Class#getModifiers()} for a description of the weirdness of this
-        * methods on primitives and arrays.
+        * Returns the modifiers for this type.
+        * <p/>
+        * See {@link Class#getModifiers()} for a description of the weirdness of this methods on primitives and arrays.
         * 
-        * @param world
-        *            the {@link World} in which the lookup is made.
+        * @param world the {@link World} in which the lookup is made.
         * @return an int representing the modifiers for this type
         * @see java.lang.reflect.Modifier
         */
@@ -178,22 +173,22 @@ public abstract class ResolvedType extends UnresolvedType implements
        // ---- difficult things
 
        /**
-        * returns an iterator through all of the fields of this type, in order for
-        * checking from JVM spec 2ed 5.4.3.2. This means that the order is <p/>
+        * returns an iterator through all of the fields of this type, in order for checking from JVM spec 2ed 5.4.3.2. This means that
+        * the order is
+        * <p/>
         * <ul>
         * <li>fields from current class</li>
         * <li>recur into direct superinterfaces</li>
         * <li>recur into superclass</li>
         * </ul>
-        * <p/> We keep a hashSet of interfaces that we've visited so we don't
-        * spiral out into 2^n land.
+        * <p/>
+        * We keep a hashSet of interfaces that we've visited so we don't spiral out into 2^n land.
         */
        public Iterator getFields() {
                final Iterators.Filter dupFilter = Iterators.dupFilter();
                Iterators.Getter typeGetter = new Iterators.Getter() {
                        public Iterator get(Object o) {
-                               return dupFilter.filter(((ResolvedType) o)
-                                               .getDirectSupertypes());
+                               return dupFilter.filter(((ResolvedType) o).getDirectSupertypes());
                        }
                };
                Iterators.Getter fieldGetter = new Iterators.Getter() {
@@ -201,29 +196,27 @@ public abstract class ResolvedType extends UnresolvedType implements
                                return Iterators.array(((ResolvedType) o).getDeclaredFields());
                        }
                };
-               return Iterators
-                               .mapOver(Iterators.recur(this, typeGetter), fieldGetter);
+               return Iterators.mapOver(Iterators.recur(this, typeGetter), fieldGetter);
        }
 
        /**
-        * returns an iterator through all of the methods of this type, in order for
-        * checking from JVM spec 2ed 5.4.3.3. This means that the order is <p/>
+        * returns an iterator through all of the methods of this type, in order for checking from JVM spec 2ed 5.4.3.3. This means that
+        * the order is
+        * <p/>
         * <ul>
         * <li>methods from current class</li>
         * <li>recur into superclass, all the way up, not touching interfaces</li>
         * <li>recur into all superinterfaces, in some unspecified order</li>
         * </ul>
-        * <p/> We keep a hashSet of interfaces that we've visited so we don't
-        * spiral out into 2^n land. NOTE: Take a look at the javadoc on
-        * getMethodsWithoutIterator() to see if you are sensitive to a quirk in
-        * getMethods()
+        * <p/>
+        * We keep a hashSet of interfaces that we've visited so we don't spiral out into 2^n land. NOTE: Take a look at the javadoc on
+        * getMethodsWithoutIterator() to see if you are sensitive to a quirk in getMethods()
         */
        public Iterator getMethods() {
                final Iterators.Filter dupFilter = Iterators.dupFilter();
                Iterators.Getter ifaceGetter = new Iterators.Getter() {
                        public Iterator get(Object o) {
-                               return dupFilter.filter(Iterators.array(((ResolvedType) o)
-                                               .getDeclaredInterfaces()));
+                               return dupFilter.filter(Iterators.array(((ResolvedType) o).getDeclaredInterfaces()));
                        }
                };
                Iterators.Getter methodGetter = new Iterators.Getter() {
@@ -251,23 +244,19 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * Return a list of methods, first those declared on this class, then those
-        * declared on the superclass (recurse) and then those declared on the
-        * superinterfaces. The getMethods() call above doesn't quite work the same
-        * as it will (through the iterator) return methods declared on *this* class
-        * twice, once at the start and once at the end - I couldn't debug that
-        * problem, so created this alternative.
+        * Return a list of methods, first those declared on this class, then those declared on the superclass (recurse) and then those
+        * declared on the superinterfaces. The getMethods() call above doesn't quite work the same as it will (through the iterator)
+        * return methods declared on *this* class twice, once at the start and once at the end - I couldn't debug that problem, so
+        * created this alternative.
         */
-       public List getMethodsWithoutIterator(boolean includeITDs,
-                       boolean allowMissing) {
+       public List getMethodsWithoutIterator(boolean includeITDs, boolean allowMissing) {
                List methods = new ArrayList();
                Set knowninterfaces = new HashSet();
                addAndRecurse(knowninterfaces, methods, this, includeITDs, allowMissing);
                return methods;
        }
 
-       private void addAndRecurse(Set knowninterfaces, List collector,
-                       ResolvedType rtx, boolean includeITDs, boolean allowMissing) {
+       private void addAndRecurse(Set knowninterfaces, List collector, ResolvedType rtx, boolean includeITDs, boolean allowMissing) {
                collector.addAll(Arrays.asList(rtx.getDeclaredMethods())); // Add the
                // methods
                // declared
@@ -287,8 +276,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                if (!rtx.equals(ResolvedType.OBJECT)) {
                        ResolvedType superType = rtx.getSuperclass();
                        if (superType != null && !superType.isMissing()) {
-                               addAndRecurse(knowninterfaces, collector, superType,
-                                               includeITDs, allowMissing); // Recurse if we aren't at
+                               addAndRecurse(knowninterfaces, collector, superType, includeITDs, allowMissing); // Recurse if we aren't at
                                // the top
                        }
                }
@@ -305,12 +293,9 @@ public abstract class ResolvedType extends UnresolvedType implements
                        // as those are used for @AJ ITD and we precisely want to skip those
                        boolean shouldSkip = false;
                        for (int j = 0; j < rtx.interTypeMungers.size(); j++) {
-                               ConcreteTypeMunger munger = (ConcreteTypeMunger) rtx.interTypeMungers
-                                               .get(j);
-                               if (munger.getMunger() != null
-                                               && munger.getMunger().getKind() == ResolvedTypeMunger.Parent
-                                               && ((NewParentTypeMunger) munger.getMunger())
-                                                               .getNewParent().equals(iface) // pr171953
+                               ConcreteTypeMunger munger = (ConcreteTypeMunger) rtx.interTypeMungers.get(j);
+                               if (munger.getMunger() != null && munger.getMunger().getKind() == ResolvedTypeMunger.Parent
+                                               && ((NewParentTypeMunger) munger.getMunger()).getNewParent().equals(iface) // pr171953
                                ) {
                                        shouldSkip = true;
                                        break;
@@ -324,12 +309,10 @@ public abstract class ResolvedType extends UnresolvedType implements
                                knowninterfaces.add(iface);
                                if (allowMissing && iface.isMissing()) {
                                        if (iface instanceof MissingResolvedTypeWithKnownSignature) {
-                                               ((MissingResolvedTypeWithKnownSignature) iface)
-                                                               .raiseWarningOnMissingInterfaceWhilstFindingMethods();
+                                               ((MissingResolvedTypeWithKnownSignature) iface).raiseWarningOnMissingInterfaceWhilstFindingMethods();
                                        }
                                } else {
-                                       addAndRecurse(knowninterfaces, collector, iface,
-                                                       includeITDs, allowMissing);
+                                       addAndRecurse(knowninterfaces, collector, iface, includeITDs, allowMissing);
                                }
                        }
                }
@@ -406,23 +389,18 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * Looks for the first member in the hierarchy matching aMember. This method
-        * differs from lookupMember(Member) in that it takes into account
-        * parameters which are type variables - which clearly an unresolved Member
-        * cannot do since it does not know anything about type variables.
+        * Looks for the first member in the hierarchy matching aMember. This method differs from lookupMember(Member) in that it takes
+        * into account parameters which are type variables - which clearly an unresolved Member cannot do since it does not know
+        * anything about type variables.
         */
-       public ResolvedMember lookupResolvedMember(ResolvedMember aMember,
-                       boolean allowMissing) {
+       public ResolvedMember lookupResolvedMember(ResolvedMember aMember, boolean allowMissing) {
                Iterator toSearch = null;
                ResolvedMember found = null;
-               if ((aMember.getKind() == Member.METHOD)
-                               || (aMember.getKind() == Member.CONSTRUCTOR)) {
+               if ((aMember.getKind() == Member.METHOD) || (aMember.getKind() == Member.CONSTRUCTOR)) {
                        toSearch = getMethodsWithoutIterator(true, allowMissing).iterator();
                } else {
                        if (aMember.getKind() != Member.FIELD)
-                               throw new IllegalStateException(
-                                               "I didn't know you would look for members of kind "
-                                                               + aMember.getKind());
+                               throw new IllegalStateException("I didn't know you would look for members of kind " + aMember.getKind());
                        toSearch = getFields();
                }
                while (toSearch.hasNext()) {
@@ -455,8 +433,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                // If they aren't the same, we need to allow for covariance ... where
                // one sig might be ()LCar; and
                // the subsig might be ()LFastCar; - where FastCar is a subclass of Car
-               boolean equalCovariantSignatures = m1.getParameterSignature().equals(
-                               m2.getParameterSignature());
+               boolean equalCovariantSignatures = m1.getParameterSignature().equals(m2.getParameterSignature());
                if (equalCovariantSignatures)
                        return true;
 
@@ -498,42 +475,38 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * returns an iterator through all of the pointcuts of this type, in order
-        * for checking from JVM spec 2ed 5.4.3.2 (as for fields). This means that
-        * the order is <p/>
+        * returns an iterator through all of the pointcuts of this type, in order for checking from JVM spec 2ed 5.4.3.2 (as for
+        * fields). This means that the order is
+        * <p/>
         * <ul>
         * <li>pointcuts from current class</li>
         * <li>recur into direct superinterfaces</li>
         * <li>recur into superclass</li>
         * </ul>
-        * <p/> We keep a hashSet of interfaces that we've visited so we don't
-        * spiral out into 2^n land.
+        * <p/>
+        * We keep a hashSet of interfaces that we've visited so we don't spiral out into 2^n land.
         */
        public Iterator getPointcuts() {
                final Iterators.Filter dupFilter = Iterators.dupFilter();
                // same order as fields
                Iterators.Getter typeGetter = new Iterators.Getter() {
                        public Iterator get(Object o) {
-                               return dupFilter.filter(((ResolvedType) o)
-                                               .getDirectSupertypes());
+                               return dupFilter.filter(((ResolvedType) o).getDirectSupertypes());
                        }
                };
                Iterators.Getter pointcutGetter = new Iterators.Getter() {
                        public Iterator get(Object o) {
                                // System.err.println("getting for " + o);
-                               return Iterators.array(((ResolvedType) o)
-                                               .getDeclaredPointcuts());
+                               return Iterators.array(((ResolvedType) o).getDeclaredPointcuts());
                        }
                };
-               return Iterators.mapOver(Iterators.recur(this, typeGetter),
-                               pointcutGetter);
+               return Iterators.mapOver(Iterators.recur(this, typeGetter), pointcutGetter);
        }
 
        public ResolvedPointcutDefinition findPointcut(String name) {
                // System.err.println("looking for pointcuts " + this);
                for (Iterator i = getPointcuts(); i.hasNext();) {
-                       ResolvedPointcutDefinition f = (ResolvedPointcutDefinition) i
-                                       .next();
+                       ResolvedPointcutDefinition f = (ResolvedPointcutDefinition) i.next();
                        // System.err.println(f);
                        if (name.equals(f.getName())) {
                                return f;
@@ -553,10 +526,8 @@ public abstract class ResolvedType extends UnresolvedType implements
        // ??? collecting data-structure, shouldn't really be a field
        public CrosscuttingMembers crosscuttingMembers;
 
-       public CrosscuttingMembers collectCrosscuttingMembers(
-                       boolean shouldConcretizeIfNeeded) {
-               crosscuttingMembers = new CrosscuttingMembers(this,
-                               shouldConcretizeIfNeeded);
+       public CrosscuttingMembers collectCrosscuttingMembers(boolean shouldConcretizeIfNeeded) {
+               crosscuttingMembers = new CrosscuttingMembers(this, shouldConcretizeIfNeeded);
                crosscuttingMembers.setPerClause(getPerClause());
                crosscuttingMembers.addShadowMungers(collectShadowMungers());
                // GENERICITDFIX
@@ -564,8 +535,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                crosscuttingMembers.addTypeMungers(getTypeMungers());
                // FIXME AV - skip but needed ?? or ??
                // crosscuttingMembers.addLateTypeMungers(getLateTypeMungers());
-               crosscuttingMembers.addDeclares(collectDeclares(!this
-                               .doesNotExposeShadowMungers()));
+               crosscuttingMembers.addDeclares(collectDeclares(!this.doesNotExposeShadowMungers()));
                crosscuttingMembers.addPrivilegedAccesses(getPrivilegedAccesses());
 
                // System.err.println("collected cc members: " + this + ", " +
@@ -591,8 +561,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                        final Iterators.Filter dupFilter = Iterators.dupFilter();
                        Iterators.Getter typeGetter = new Iterators.Getter() {
                                public Iterator get(Object o) {
-                                       return dupFilter.filter(((ResolvedType) o)
-                                                       .getDirectSupertypes());
+                                       return dupFilter.filter(((ResolvedType) o).getDirectSupertypes());
                                }
                        };
                        Iterator typeIterator = Iterators.recur(this, typeGetter);
@@ -616,16 +585,14 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        private final Collection collectShadowMungers() {
-               if (!this.isAspect() || this.isAbstract()
-                               || this.doesNotExposeShadowMungers())
+               if (!this.isAspect() || this.isAbstract() || this.doesNotExposeShadowMungers())
                        return Collections.EMPTY_LIST;
 
                ArrayList acc = new ArrayList();
                final Iterators.Filter dupFilter = Iterators.dupFilter();
                Iterators.Getter typeGetter = new Iterators.Getter() {
                        public Iterator get(Object o) {
-                               return dupFilter.filter(((ResolvedType) o)
-                                               .getDirectSupertypes());
+                               return dupFilter.filter(((ResolvedType) o).getDirectSupertypes());
                        }
                };
                Iterator typeIterator = Iterators.recur(this, typeGetter);
@@ -646,7 +613,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                return null;
        }
 
-       protected Collection getDeclares() {
+       public Collection getDeclares() {
                return Collections.EMPTY_LIST;
        }
 
@@ -703,13 +670,11 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        public void addAnnotation(AnnotationAJ annotationX) {
-               throw new RuntimeException(
-                               "ResolvedType.addAnnotation() should never be called");
+               throw new RuntimeException("ResolvedType.addAnnotation() should never be called");
        }
 
        public AnnotationAJ[] getAnnotations() {
-               throw new RuntimeException(
-                               "ResolvedType.getAnnotations() should never be called");
+               throw new RuntimeException("ResolvedType.getAnnotations() should never be called");
        }
 
        /**
@@ -768,17 +733,13 @@ public abstract class ResolvedType extends UnresolvedType implements
                                        if (munger instanceof Advice) {
                                                Advice advice = (Advice) munger;
                                                // update to use the parameterized signature...
-                                               UnresolvedType[] ptypes = methods[i]
-                                                               .getGenericParameterTypes();
+                                               UnresolvedType[] ptypes = methods[i].getGenericParameterTypes();
                                                UnresolvedType[] newPTypes = new UnresolvedType[ptypes.length];
                                                for (int j = 0; j < ptypes.length; j++) {
                                                        if (ptypes[j] instanceof TypeVariableReferenceType) {
                                                                TypeVariableReferenceType tvrt = (TypeVariableReferenceType) ptypes[j];
-                                                               if (typeVariableMap.containsKey(tvrt
-                                                                               .getTypeVariable().getName())) {
-                                                                       newPTypes[j] = (UnresolvedType) typeVariableMap
-                                                                                       .get(tvrt.getTypeVariable()
-                                                                                                       .getName());
+                                                               if (typeVariableMap.containsKey(tvrt.getTypeVariable().getName())) {
+                                                                       newPTypes[j] = (UnresolvedType) typeVariableMap.get(tvrt.getTypeVariable().getName());
                                                                } else {
                                                                        newPTypes[j] = ptypes[j];
                                                                }
@@ -819,8 +780,7 @@ public abstract class ResolvedType extends UnresolvedType implements
        private ResolvedMember[] filterInJavaVisible(ResolvedMember[] ms) {
                List l = new ArrayList();
                for (int i = 0, len = ms.length; i < len; i++) {
-                       if (!ms[i].isAjSynthetic()
-                                       && ms[i].getAssociatedShadowMunger() == null) {
+                       if (!ms[i].isAjSynthetic() && ms[i].getAssociatedShadowMunger() == null) {
                                l.add(ms[i]);
                        }
                }
@@ -864,14 +824,14 @@ public abstract class ResolvedType extends UnresolvedType implements
        public static ResolvedType makeArray(ResolvedType type, int dim) {
                if (dim == 0)
                        return type;
-               ResolvedType array = new ArrayReferenceType("[" + type.getSignature(),
-                               "[" + type.getErasureSignature(), type.getWorld(), type);
+               ResolvedType array = new ArrayReferenceType("[" + type.getSignature(), "[" + type.getErasureSignature(), type.getWorld(),
+                               type);
                return makeArray(array, dim - 1);
        }
 
        static class Primitive extends ResolvedType {
-               private int size;
-               private int index;
+               private final int size;
+               private final int index;
 
                Primitive(String signature, int size, int index) {
                        super(signature, null);
@@ -900,14 +860,12 @@ public abstract class ResolvedType extends UnresolvedType implements
                        if (!other.isPrimitiveType()) {
                                if (!world.isInJava5Mode())
                                        return false;
-                               return validBoxing.contains(this.getSignature()
-                                               + other.getSignature());
+                               return validBoxing.contains(this.getSignature() + other.getSignature());
                        }
                        return assignTable[((Primitive) other).index][index];
                }
 
-               public final boolean isAssignableFrom(ResolvedType other,
-                               boolean allowMissing) {
+               public final boolean isAssignableFrom(ResolvedType other, boolean allowMissing) {
                        return isAssignableFrom(other);
                }
 
@@ -933,7 +891,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                }
 
                private static final boolean[][] assignTable = {// to: B C D F I J S V Z
-                               // from
+               // from
                                { true, true, true, true, true, true, true, false, false }, // B
                                { false, true, true, true, true, true, false, false, false }, // C
                                { false, false, true, false, false, false, false, false, false }, // D
@@ -945,7 +903,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                                { false, false, false, false, false, false, false, false, true }, // Z
                };
                private static final boolean[][] noConvertTable = {// to: B C D F I J S
-                               // V Z from
+               // V Z from
                                { true, true, false, false, true, false, true, false, false }, // B
                                { false, true, false, false, true, false, false, false, false }, // C
                                { false, false, true, false, false, false, false, false, false }, // D
@@ -1033,8 +991,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                        return false;
                }
 
-               public final boolean isAssignableFrom(ResolvedType other,
-                               boolean allowMissing) {
+               public final boolean isAssignableFrom(ResolvedType other, boolean allowMissing) {
                        return false;
                }
 
@@ -1053,8 +1010,7 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * Look up a member, takes into account any ITDs on this type. return null
-        * if not found
+        * Look up a member, takes into account any ITDs on this type. return null if not found
         */
        public ResolvedMember lookupMemberNoSupers(Member member) {
                ResolvedMember ret = lookupDirectlyDeclaredMemberNoSupers(member);
@@ -1103,9 +1059,8 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * This lookup has specialized behaviour - a null result tells the
-        * EclipseTypeMunger that it should make a default implementation of a
-        * method on this type.
+        * This lookup has specialized behaviour - a null result tells the EclipseTypeMunger that it should make a default
+        * implementation of a method on this type.
         * 
         * @param member
         * @return
@@ -1114,8 +1069,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                return lookupMemberIncludingITDsOnInterfaces(member, this);
        }
 
-       private ResolvedMember lookupMemberIncludingITDsOnInterfaces(Member member,
-                       ResolvedType onType) {
+       private ResolvedMember lookupMemberIncludingITDsOnInterfaces(Member member, ResolvedType onType) {
                ResolvedMember ret = onType.lookupMemberNoSupers(member);
                if (ret != null) {
                        return ret;
@@ -1154,8 +1108,7 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * ??? This method is O(N*M) where N = number of methods and M is number of
-        * inter-type declarations in my super
+        * ??? This method is O(N*M) where N = number of methods and M is number of inter-type declarations in my super
         */
        public List getInterTypeMungersIncludingSupers() {
                ArrayList ret = new ArrayList();
@@ -1181,9 +1134,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                for (Iterator iter = getDirectSupertypes(); iter.hasNext();) {
                        ResolvedType superType = (ResolvedType) iter.next();
                        if (superType == null) {
-                               throw new BCException(
-                                               "UnexpectedProblem: a supertype in the hierarchy for "
-                                                               + this.getName() + " is null");
+                               throw new BCException("UnexpectedProblem: a supertype in the hierarchy for " + this.getName() + " is null");
                        }
                        superType.collectInterTypeMungers(collector);
                }
@@ -1196,11 +1147,9 @@ public abstract class ResolvedType extends UnresolvedType implements
                        if (!superMunger.getSignature().isAbstract())
                                continue;
 
-                       for (Iterator iter = getInterTypeMungers().iterator(); iter
-                                       .hasNext();) {
+                       for (Iterator iter = getInterTypeMungers().iterator(); iter.hasNext();) {
                                ConcreteTypeMunger myMunger = (ConcreteTypeMunger) iter.next();
-                               if (conflictingSignature(myMunger.getSignature(), superMunger
-                                               .getSignature())) {
+                               if (conflictingSignature(myMunger.getSignature(), superMunger.getSignature())) {
                                        iter1.remove();
                                        continue outer;
                                }
@@ -1222,9 +1171,8 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * Check: 1) That we don't have any abstract type mungers unless this type
-        * is abstract. 2) That an abstract ITDM on an interface is declared public.
-        * (Compiler limitation) (PR70794)
+        * Check: 1) That we don't have any abstract type mungers unless this type is abstract. 2) That an abstract ITDM on an interface
+        * is declared public. (Compiler limitation) (PR70794)
         */
        public void checkInterTypeMungers() {
                if (isAbstract())
@@ -1232,8 +1180,7 @@ public abstract class ResolvedType extends UnresolvedType implements
 
                boolean itdProblem = false;
 
-               for (Iterator iter = getInterTypeMungersIncludingSupers().iterator(); iter
-                               .hasNext();) {
+               for (Iterator iter = getInterTypeMungersIncludingSupers().iterator(); iter.hasNext();) {
                        ConcreteTypeMunger munger = (ConcreteTypeMunger) iter.next();
                        itdProblem = checkAbstractDeclaration(munger) || itdProblem; // Rule
                        // 2
@@ -1243,25 +1190,17 @@ public abstract class ResolvedType extends UnresolvedType implements
                if (itdProblem)
                        return; // If the rules above are broken, return right now
 
-               for (Iterator iter = getInterTypeMungersIncludingSupers().iterator(); iter
-                               .hasNext();) {
+               for (Iterator iter = getInterTypeMungersIncludingSupers().iterator(); iter.hasNext();) {
                        ConcreteTypeMunger munger = (ConcreteTypeMunger) iter.next();
-                       if (munger.getSignature() != null
-                                       && munger.getSignature().isAbstract()) { // Rule 1
+                       if (munger.getSignature() != null && munger.getSignature().isAbstract()) { // Rule 1
                                if (munger.getMunger().getKind() == ResolvedTypeMunger.MethodDelegate) {
                                        // ignore for @AJ ITD as munger.getSignature() is the
                                        // interface method hence abstract
                                } else {
-                                       world
-                                                       .getMessageHandler()
+                                       world.getMessageHandler()
                                                        .handleMessage(
-                                                                       new Message(
-                                                                                       "must implement abstract inter-type declaration: "
-                                                                                                       + munger.getSignature(),
-                                                                                       "",
-                                                                                       IMessage.ERROR,
-                                                                                       getSourceLocation(),
-                                                                                       null,
+                                                                       new Message("must implement abstract inter-type declaration: " + munger.getSignature(), "",
+                                                                                       IMessage.ERROR, getSourceLocation(), null,
                                                                                        new ISourceLocation[] { getMungerLocation(munger) }));
                                }
                        }
@@ -1269,34 +1208,20 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * See PR70794. This method checks that if an abstract inter-type method
-        * declaration is made on an interface then it must also be public. This is
-        * a compiler limitation that could be made to work in the future (if
-        * someone provides a worthwhile usecase)
+        * See PR70794. This method checks that if an abstract inter-type method declaration is made on an interface then it must also
+        * be public. This is a compiler limitation that could be made to work in the future (if someone provides a worthwhile usecase)
         * 
         * @return indicates if the munger failed the check
         */
        private boolean checkAbstractDeclaration(ConcreteTypeMunger munger) {
-               if (munger.getMunger() != null
-                               && (munger.getMunger() instanceof NewMethodTypeMunger)) {
+               if (munger.getMunger() != null && (munger.getMunger() instanceof NewMethodTypeMunger)) {
                        ResolvedMember itdMember = munger.getSignature();
                        ResolvedType onType = itdMember.getDeclaringType().resolve(world);
-                       if (onType.isInterface() && itdMember.isAbstract()
-                                       && !itdMember.isPublic()) {
-                               world
-                                               .getMessageHandler()
-                                               .handleMessage(
-                                                               new Message(
-                                                                               WeaverMessages
-                                                                                               .format(
-                                                                                                               WeaverMessages.ITD_ABSTRACT_MUST_BE_PUBLIC_ON_INTERFACE,
-                                                                                                               munger.getSignature(),
-                                                                                                               onType),
-                                                                               "",
-                                                                               Message.ERROR,
-                                                                               getSourceLocation(),
-                                                                               null,
-                                                                               new ISourceLocation[] { getMungerLocation(munger) }));
+                       if (onType.isInterface() && itdMember.isAbstract() && !itdMember.isPublic()) {
+                               world.getMessageHandler().handleMessage(
+                                               new Message(WeaverMessages.format(WeaverMessages.ITD_ABSTRACT_MUST_BE_PUBLIC_ON_INTERFACE, munger
+                                                               .getSignature(), onType), "", Message.ERROR, getSourceLocation(), null,
+                                                               new ISourceLocation[] { getMungerLocation(munger) }));
                                return true;
                        }
                }
@@ -1304,9 +1229,8 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * Get a source location for the munger. Until intertype mungers remember
-        * where they came from, the source location for the munger itself is null.
-        * In these cases use the source location for the aspect containing the ITD.
+        * Get a source location for the munger. Until intertype mungers remember where they came from, the source location for the
+        * munger itself is null. In these cases use the source location for the aspect containing the ITD.
         */
        private ISourceLocation getMungerLocation(ConcreteTypeMunger munger) {
                ISourceLocation sloc = munger.getSourceLocation();
@@ -1317,13 +1241,12 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * Returns a ResolvedType object representing the declaring type of this
-        * type, or null if this type does not represent a non-package-level-type.
-        * <p/> <strong>Warning</strong>: This is guaranteed to work for all member
-        * types. For anonymous/local types, the only guarantee is given in JLS
-        * 13.1, where it guarantees that if you call getDeclaringType() repeatedly,
-        * you will eventually get the top-level class, but it does not say anything
-        * about classes in between.
+        * Returns a ResolvedType object representing the declaring type of this type, or null if this type does not represent a
+        * non-package-level-type.
+        * <p/>
+        * <strong>Warning</strong>: This is guaranteed to work for all member types. For anonymous/local types, the only guarantee is
+        * given in JLS 13.1, where it guarantees that if you call getDeclaringType() repeatedly, you will eventually get the top-level
+        * class, but it does not say anything about classes in between.
         * 
         * @return the declaring UnresolvedType object, or null.
         */
@@ -1333,8 +1256,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                String name = getName();
                int lastDollar = name.lastIndexOf('$');
                while (lastDollar > 0) { // allow for classes starting '$' (pr120474)
-                       ResolvedType ret = world.resolve(UnresolvedType.forName(name
-                                       .substring(0, lastDollar)), true);
+                       ResolvedType ret = world.resolve(UnresolvedType.forName(name.substring(0, lastDollar)), true);
                        if (!ResolvedType.isMissing(ret))
                                return ret;
                        lastDollar = name.lastIndexOf('$', lastDollar - 1);
@@ -1342,26 +1264,22 @@ public abstract class ResolvedType extends UnresolvedType implements
                return null;
        }
 
-       public static boolean isVisible(int modifiers, ResolvedType targetType,
-                       ResolvedType fromType) {
+       public static boolean isVisible(int modifiers, ResolvedType targetType, ResolvedType fromType) {
                // System.err.println("mod: " + modifiers + ", " + targetType + " and "
                // + fromType);
 
                if (Modifier.isPublic(modifiers)) {
                        return true;
                } else if (Modifier.isPrivate(modifiers)) {
-                       return targetType.getOutermostType().equals(
-                                       fromType.getOutermostType());
+                       return targetType.getOutermostType().equals(fromType.getOutermostType());
                } else if (Modifier.isProtected(modifiers)) {
-                       return samePackage(targetType, fromType)
-                                       || targetType.isAssignableFrom(fromType);
+                       return samePackage(targetType, fromType) || targetType.isAssignableFrom(fromType);
                } else { // package-visible
                        return samePackage(targetType, fromType);
                }
        }
 
-       private static boolean samePackage(ResolvedType targetType,
-                       ResolvedType fromType) {
+       private static boolean samePackage(ResolvedType targetType, ResolvedType fromType) {
                String p1 = targetType.getPackageName();
                String p2 = fromType.getPackageName();
                if (p1 == null)
@@ -1372,35 +1290,28 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * Checks if the generic type for 'this' and the generic type for 'other'
-        * are the same - it can be passed raw or parameterized versions and will
-        * just compare the underlying generic type.
+        * Checks if the generic type for 'this' and the generic type for 'other' are the same - it can be passed raw or parameterized
+        * versions and will just compare the underlying generic type.
         */
        private boolean genericTypeEquals(ResolvedType other) {
                ResolvedType rt = other;
                if (rt.isParameterizedType() || rt.isRawType())
                        rt.getGenericType();
-               if (((isParameterizedType() || isRawType()) && getGenericType().equals(
-                               rt))
-                               || (this.equals(other)))
+               if (((isParameterizedType() || isRawType()) && getGenericType().equals(rt)) || (this.equals(other)))
                        return true;
                return false;
        }
 
        /**
-        * Look up the actual occurence of a particular type in the hierarchy for
-        * 'this' type. The input is going to be a generic type, and the caller
-        * wants to know if it was used in its RAW or a PARAMETERIZED form in this
-        * hierarchy.
+        * Look up the actual occurence of a particular type in the hierarchy for 'this' type. The input is going to be a generic type,
+        * and the caller wants to know if it was used in its RAW or a PARAMETERIZED form in this hierarchy.
         * 
         * returns null if it can't be found.
         */
-       public ResolvedType discoverActualOccurrenceOfTypeInHierarchy(
-                       ResolvedType lookingFor) {
+       public ResolvedType discoverActualOccurrenceOfTypeInHierarchy(ResolvedType lookingFor) {
                if (!lookingFor.isGenericType())
-                       throw new BCException(
-                                       "assertion failed: method should only be called with generic type, but "
-                                                       + lookingFor + " is " + lookingFor.typeKind);
+                       throw new BCException("assertion failed: method should only be called with generic type, but " + lookingFor + " is "
+                                       + lookingFor.typeKind);
 
                if (this.equals(ResolvedType.OBJECT))
                        return null;
@@ -1417,8 +1328,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                        ResolvedType superI = superIs[i];
                        if (superI.genericTypeEquals(lookingFor))
                                return superI;
-                       ResolvedType checkTheSuperI = superI
-                                       .discoverActualOccurrenceOfTypeInHierarchy(lookingFor);
+                       ResolvedType checkTheSuperI = superI.discoverActualOccurrenceOfTypeInHierarchy(lookingFor);
                        if (checkTheSuperI != null)
                                return checkTheSuperI;
                }
@@ -1426,52 +1336,41 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * Called for all type mungers but only does something if they share type
-        * variables with a generic type which they target. When this happens this
-        * routine will check for the target type in the target hierarchy and 'bind'
-        * any type parameters as appropriate. For example, for the ITD
-        * "List<T> I<T>.x" against a type like this: "class A implements I<String>"
-        * this routine will return a parameterized form of the ITD
-        * "List<String> I.x"
+        * Called for all type mungers but only does something if they share type variables with a generic type which they target. When
+        * this happens this routine will check for the target type in the target hierarchy and 'bind' any type parameters as
+        * appropriate. For example, for the ITD "List<T> I<T>.x" against a type like this: "class A implements I<String>" this routine
+        * will return a parameterized form of the ITD "List<String> I.x"
         */
        public ConcreteTypeMunger fillInAnyTypeParameters(ConcreteTypeMunger munger) {
                boolean debug = false;
                ResolvedMember member = munger.getSignature();
                if (munger.isTargetTypeParameterized()) {
                        if (debug)
-                               System.err.println("Processing attempted parameterization of "
-                                               + munger + " targetting type " + this);
+                               System.err.println("Processing attempted parameterization of " + munger + " targetting type " + this);
                        if (debug)
-                               System.err.println("  This type is " + this + "  (" + typeKind
-                                               + ")");
+                               System.err.println("  This type is " + this + "  (" + typeKind + ")");
                        // need to tailor this munger instance for the particular target...
                        if (debug)
-                               System.err.println("  Signature that needs parameterizing: "
-                                               + member);
+                               System.err.println("  Signature that needs parameterizing: " + member);
                        // Retrieve the generic type
-                       ResolvedType onType = world.resolve(member.getDeclaringType())
-                                       .getGenericType();
+                       ResolvedType onType = world.resolve(member.getDeclaringType()).getGenericType();
                        member.resolve(world); // Ensure all parts of the member are
                        // resolved
                        if (debug)
-                               System.err.println("  Actual target ontype: " + onType + "  ("
-                                               + onType.typeKind + ")");
+                               System.err.println("  Actual target ontype: " + onType + "  (" + onType.typeKind + ")");
                        // quickly find the targettype in the type hierarchy for this type
                        // (it will be either RAW or PARAMETERIZED)
                        ResolvedType actualTarget = discoverActualOccurrenceOfTypeInHierarchy(onType);
                        if (actualTarget == null)
-                               throw new BCException("assertion failed: asked " + this
-                                               + " for occurrence of " + onType
-                                               + " in its hierarchy??");
+                               throw new BCException("assertion failed: asked " + this + " for occurrence of " + onType + " in its hierarchy??");
 
                        // only bind the tvars if its a parameterized type or the raw type
                        // (in which case they collapse to bounds) - don't do it
                        // for generic types ;)
                        if (!actualTarget.isGenericType()) {
                                if (debug)
-                                       System.err.println("Occurrence in " + this
-                                                       + " is actually " + actualTarget + "  ("
-                                                       + actualTarget.typeKind + ")");
+                                       System.err.println("Occurrence in " + this + " is actually " + actualTarget + "  (" + actualTarget.typeKind
+                                                       + ")");
                                // parameterize the signature
                                // ResolvedMember newOne =
                                // member.parameterizedWith(actualTarget.getTypeParameters(),
@@ -1490,9 +1389,7 @@ public abstract class ResolvedType extends UnresolvedType implements
 
        public void addInterTypeMunger(ConcreteTypeMunger munger) {
                ResolvedMember sig = munger.getSignature();
-               if (sig == null
-                               || munger.getMunger() == null
-                               || munger.getMunger().getKind() == ResolvedTypeMunger.PrivilegedAccess) {
+               if (sig == null || munger.getMunger() == null || munger.getMunger().getKind() == ResolvedTypeMunger.PrivilegedAccess) {
                        interTypeMungers.add(munger);
                        return;
                }
@@ -1512,52 +1409,40 @@ public abstract class ResolvedType extends UnresolvedType implements
                // System.err.println("add: " + munger + " to " + this.getClassName() +
                // " with " + interTypeMungers);
                if (sig.getKind() == Member.METHOD) {
-                       if (!compareToExistingMembers(munger, getMethodsWithoutIterator(
-                                       false, true) /* getMethods() */))
+                       if (!compareToExistingMembers(munger, getMethodsWithoutIterator(false, true) /* getMethods() */))
                                return;
                        if (this.isInterface()) {
-                               if (!compareToExistingMembers(munger, Arrays.asList(
-                                               world.getCoreType(OBJECT).getDeclaredMethods())
-                                               .iterator()))
+                               if (!compareToExistingMembers(munger, Arrays.asList(world.getCoreType(OBJECT).getDeclaredMethods()).iterator()))
                                        return;
                        }
                } else if (sig.getKind() == Member.FIELD) {
-                       if (!compareToExistingMembers(munger, Arrays.asList(
-                                       getDeclaredFields()).iterator()))
+                       if (!compareToExistingMembers(munger, Arrays.asList(getDeclaredFields()).iterator()))
                                return;
                } else {
-                       if (!compareToExistingMembers(munger, Arrays.asList(
-                                       getDeclaredMethods()).iterator()))
+                       if (!compareToExistingMembers(munger, Arrays.asList(getDeclaredMethods()).iterator()))
                                return;
                }
 
                // now compare to existingMungers
                for (Iterator i = interTypeMungers.iterator(); i.hasNext();) {
                        ConcreteTypeMunger existingMunger = (ConcreteTypeMunger) i.next();
-                       if (conflictingSignature(existingMunger.getSignature(), munger
-                                       .getSignature())) {
+                       if (conflictingSignature(existingMunger.getSignature(), munger.getSignature())) {
                                // System.err.println("match " + munger + " with " +
                                // existingMunger);
-                               if (isVisible(munger.getSignature().getModifiers(), munger
-                                               .getAspectType(), existingMunger.getAspectType())) {
+                               if (isVisible(munger.getSignature().getModifiers(), munger.getAspectType(), existingMunger.getAspectType())) {
                                        // System.err.println("    is visible");
-                                       int c = compareMemberPrecedence(sig, existingMunger
-                                                       .getSignature());
+                                       int c = compareMemberPrecedence(sig, existingMunger.getSignature());
                                        if (c == 0) {
-                                               c = getWorld().compareByPrecedenceAndHierarchy(
-                                                               munger.getAspectType(),
-                                                               existingMunger.getAspectType());
+                                               c = getWorld().compareByPrecedenceAndHierarchy(munger.getAspectType(), existingMunger.getAspectType());
                                        }
                                        // System.err.println("       compare: " + c);
                                        if (c < 0) {
                                                // the existing munger dominates the new munger
-                                               checkLegalOverride(munger.getSignature(),
-                                                               existingMunger.getSignature());
+                                               checkLegalOverride(munger.getSignature(), existingMunger.getSignature());
                                                return;
                                        } else if (c > 0) {
                                                // the new munger dominates the existing one
-                                               checkLegalOverride(existingMunger.getSignature(),
-                                                               munger.getSignature());
+                                               checkLegalOverride(existingMunger.getSignature(), munger.getSignature());
                                                i.remove();
                                                break;
                                        } else {
@@ -1575,14 +1460,12 @@ public abstract class ResolvedType extends UnresolvedType implements
                interTypeMungers.add(munger);
        }
 
-       private boolean compareToExistingMembers(ConcreteTypeMunger munger,
-                       List existingMembersList) {
+       private boolean compareToExistingMembers(ConcreteTypeMunger munger, List existingMembersList) {
                return compareToExistingMembers(munger, existingMembersList.iterator());
        }
 
        // ??? returning too soon
-       private boolean compareToExistingMembers(ConcreteTypeMunger munger,
-                       Iterator existingMembers) {
+       private boolean compareToExistingMembers(ConcreteTypeMunger munger, Iterator existingMembers) {
                ResolvedMember sig = munger.getSignature();
 
                // ResolvedType declaringAspectType = munger.getAspectType();
@@ -1608,8 +1491,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                // }
                while (existingMembers.hasNext()) {
 
-                       ResolvedMember existingMember = (ResolvedMember) existingMembers
-                                       .next();
+                       ResolvedMember existingMember = (ResolvedMember) existingMembers.next();
                        // don't worry about clashing with bridge methods
                        if (existingMember.isBridgeMethod())
                                continue;
@@ -1622,19 +1504,16 @@ public abstract class ResolvedType extends UnresolvedType implements
                                // munger.getSignature() + ", " +
                                // munger.getSignature().getSourceLocation());
 
-                               if (isVisible(existingMember.getModifiers(), this, munger
-                                               .getAspectType())) {
+                               if (isVisible(existingMember.getModifiers(), this, munger.getAspectType())) {
                                        int c = compareMemberPrecedence(sig, existingMember);
                                        // System.err.println("   c: " + c);
                                        if (c < 0) {
                                                // existingMember dominates munger
-                                               checkLegalOverride(munger.getSignature(),
-                                                               existingMember);
+                                               checkLegalOverride(munger.getSignature(), existingMember);
                                                return false;
                                        } else if (c > 0) {
                                                // munger dominates existingMember
-                                               checkLegalOverride(existingMember, munger
-                                                               .getSignature());
+                                               checkLegalOverride(existingMember, munger.getSignature());
                                                // interTypeMungers.add(munger);
                                                // ??? might need list of these overridden abstracts
                                                continue;
@@ -1643,8 +1522,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                                                // FIXME this whole method seems very hokey - unaware of
                                                // covariance/varargs/bridging - it
                                                // could do with a rewrite !
-                                               boolean sameReturnTypes = (existingMember
-                                                               .getReturnType().equals(sig.getReturnType()));
+                                               boolean sameReturnTypes = (existingMember.getReturnType().equals(sig.getReturnType()));
                                                if (sameReturnTypes) {
                                                        // pr206732 - if the existingMember is due to a
                                                        // previous application of this same ITD (which can
@@ -1654,59 +1532,36 @@ public abstract class ResolvedType extends UnresolvedType implements
                                                        // higher level and dont do this, but that is rather
                                                        // more work.
                                                        boolean isDuplicateOfPreviousITD = false;
-                                                       ResolvedType declaringRt = existingMember
-                                                                       .getDeclaringType().resolve(world);
+                                                       ResolvedType declaringRt = existingMember.getDeclaringType().resolve(world);
                                                        WeaverStateInfo wsi = declaringRt.getWeaverState();
                                                        if (wsi != null) {
-                                                               List mungersAffectingThisType = wsi
-                                                                               .getTypeMungers(declaringRt);
+                                                               List mungersAffectingThisType = wsi.getTypeMungers(declaringRt);
                                                                if (mungersAffectingThisType != null) {
-                                                                       for (Iterator iterator = mungersAffectingThisType
-                                                                                       .iterator(); iterator.hasNext()
+                                                                       for (Iterator iterator = mungersAffectingThisType.iterator(); iterator.hasNext()
                                                                                        && !isDuplicateOfPreviousITD;) {
-                                                                               ConcreteTypeMunger ctMunger = (ConcreteTypeMunger) iterator
-                                                                                               .next();
+                                                                               ConcreteTypeMunger ctMunger = (ConcreteTypeMunger) iterator.next();
                                                                                // relatively crude check - is the ITD
                                                                                // for the same as the existingmember
                                                                                // and does it come
                                                                                // from the same aspect
-                                                                               if (ctMunger.getSignature().equals(
-                                                                                               existingMember)
-                                                                                               && ctMunger.aspectType
-                                                                                                               .equals(munger
-                                                                                                                               .getAspectType())) {
+                                                                               if (ctMunger.getSignature().equals(existingMember)
+                                                                                               && ctMunger.aspectType.equals(munger.getAspectType())) {
                                                                                        isDuplicateOfPreviousITD = true;
                                                                                }
                                                                        }
                                                                }
                                                        }
                                                        if (!isDuplicateOfPreviousITD) {
-                                                               getWorld()
-                                                                               .getMessageHandler()
-                                                                               .handleMessage(
-                                                                                               MessageUtil
-                                                                                                               .error(
-                                                                                                                               WeaverMessages
-                                                                                                                                               .format(
-                                                                                                                                                               WeaverMessages.ITD_MEMBER_CONFLICT,
-                                                                                                                                                               munger
-                                                                                                                                                                               .getAspectType()
-                                                                                                                                                                               .getName(),
-                                                                                                                                                               existingMember),
-                                                                                                                               munger
-                                                                                                                                               .getSourceLocation()));
+                                                               getWorld().getMessageHandler().handleMessage(
+                                                                               MessageUtil.error(WeaverMessages.format(WeaverMessages.ITD_MEMBER_CONFLICT, munger
+                                                                                               .getAspectType().getName(), existingMember), munger.getSourceLocation()));
                                                        }
                                                }
                                        }
-                               } else if (isDuplicateMemberWithinTargetType(existingMember,
-                                               this, sig)) {
+                               } else if (isDuplicateMemberWithinTargetType(existingMember, this, sig)) {
                                        getWorld().getMessageHandler().handleMessage(
-                                                       MessageUtil
-                                                                       .error(WeaverMessages.format(
-                                                                                       WeaverMessages.ITD_MEMBER_CONFLICT,
-                                                                                       munger.getAspectType().getName(),
-                                                                                       existingMember), munger
-                                                                                       .getSourceLocation()));
+                                                       MessageUtil.error(WeaverMessages.format(WeaverMessages.ITD_MEMBER_CONFLICT, munger.getAspectType()
+                                                                       .getName(), existingMember), munger.getSourceLocation()));
 
                                }
                                // return;
@@ -1721,8 +1576,7 @@ public abstract class ResolvedType extends UnresolvedType implements
        // same declaring type with the same
        // signature AND more than one of them is concrete AND they are both visible
        // within the target type.
-       private boolean isDuplicateMemberWithinTargetType(
-                       ResolvedMember existingMember, ResolvedType targetType,
+       private boolean isDuplicateMemberWithinTargetType(ResolvedMember existingMember, ResolvedType targetType,
                        ResolvedMember itdMember) {
                if ((existingMember.isAbstract() || itdMember.isAbstract()))
                        return false;
@@ -1735,8 +1589,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                if (itdMember.isPublic())
                        return true;
                // must be in same package to be visible then...
-               if (!targetType.getPackageName().equals(
-                               itdMember.getDeclaringType().getPackageName()))
+               if (!targetType.getPackageName().equals(itdMember.getDeclaringType().getPackageName()))
                        return false;
 
                // trying to put two members with the same signature into the exact same
@@ -1745,17 +1598,14 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * @return true if the override is legal note: calling showMessage with two
-        *         locations issues TWO messages, not ONE message with an additional
-        *         source location.
+        * @return true if the override is legal note: calling showMessage with two locations issues TWO messages, not ONE message with
+        *         an additional source location.
         */
-       public boolean checkLegalOverride(ResolvedMember parent,
-                       ResolvedMember child) {
+       public boolean checkLegalOverride(ResolvedMember parent, ResolvedMember child) {
                // System.err.println("check: " + child.getDeclaringType() +
                // " overrides " + parent.getDeclaringType());
                if (Modifier.isFinal(parent.getModifiers())) {
-                       world.showMessage(Message.ERROR, WeaverMessages.format(
-                                       WeaverMessages.CANT_OVERRIDE_FINAL_MEMBER, parent), child
+                       world.showMessage(Message.ERROR, WeaverMessages.format(WeaverMessages.CANT_OVERRIDE_FINAL_MEMBER, parent), child
                                        .getSourceLocation(), null);
                        return false;
                }
@@ -1765,12 +1615,9 @@ public abstract class ResolvedType extends UnresolvedType implements
                if (world.isInJava5Mode() && parent.getKind() == Member.METHOD) {
 
                        // Look at the generic types when doing this comparison
-                       ResolvedType rtParentReturnType = parent.resolve(world)
-                                       .getGenericReturnType().resolve(world);
-                       ResolvedType rtChildReturnType = child.resolve(world)
-                                       .getGenericReturnType().resolve(world);
-                       incompatibleReturnTypes = !rtParentReturnType
-                                       .isAssignableFrom(rtChildReturnType);
+                       ResolvedType rtParentReturnType = parent.resolve(world).getGenericReturnType().resolve(world);
+                       ResolvedType rtChildReturnType = child.resolve(world).getGenericReturnType().resolve(world);
+                       incompatibleReturnTypes = !rtParentReturnType.isAssignableFrom(rtChildReturnType);
                        // For debug, uncomment this bit and we'll repeat the check - stick
                        // a breakpoint on the call
                        // if (incompatibleReturnTypes) {
@@ -1778,22 +1625,19 @@ public abstract class ResolvedType extends UnresolvedType implements
                        // !rtParentReturnType.isAssignableFrom(rtChildReturnType);
                        // }
                } else {
-                       incompatibleReturnTypes = !parent.getReturnType().equals(
-                                       child.getReturnType());
+                       incompatibleReturnTypes = !parent.getReturnType().equals(child.getReturnType());
                }
 
                if (incompatibleReturnTypes) {
-                       world.showMessage(IMessage.ERROR, WeaverMessages.format(
-                                       WeaverMessages.ITD_RETURN_TYPE_MISMATCH, parent, child),
-                                       child.getSourceLocation(), parent.getSourceLocation());
+                       world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ITD_RETURN_TYPE_MISMATCH, parent, child), child
+                                       .getSourceLocation(), parent.getSourceLocation());
                        return false;
                }
                if (parent.getKind() == Member.POINTCUT) {
                        UnresolvedType[] pTypes = parent.getParameterTypes();
                        UnresolvedType[] cTypes = child.getParameterTypes();
                        if (!Arrays.equals(pTypes, cTypes)) {
-                               world.showMessage(IMessage.ERROR, WeaverMessages.format(
-                                               WeaverMessages.ITD_PARAM_TYPE_MISMATCH, parent, child),
+                               world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ITD_PARAM_TYPE_MISMATCH, parent, child),
                                                child.getSourceLocation(), parent.getSourceLocation());
                                return false;
                        }
@@ -1801,17 +1645,15 @@ public abstract class ResolvedType extends UnresolvedType implements
                // System.err.println("check: " + child.getModifiers() +
                // " more visible " + parent.getModifiers());
                if (isMoreVisible(parent.getModifiers(), child.getModifiers())) {
-                       world.showMessage(IMessage.ERROR, WeaverMessages.format(
-                                       WeaverMessages.ITD_VISIBILITY_REDUCTION, parent, child),
-                                       child.getSourceLocation(), parent.getSourceLocation());
+                       world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ITD_VISIBILITY_REDUCTION, parent, child), child
+                                       .getSourceLocation(), parent.getSourceLocation());
                        return false;
                }
 
                // check declared exceptions
                ResolvedType[] childExceptions = world.resolve(child.getExceptions());
                ResolvedType[] parentExceptions = world.resolve(parent.getExceptions());
-               ResolvedType runtimeException = world
-                               .resolve("java.lang.RuntimeException");
+               ResolvedType runtimeException = world.resolve("java.lang.RuntimeException");
                ResolvedType error = world.resolve("java.lang.Error");
 
                outer: for (int i = 0, leni = childExceptions.length; i < leni; i++) {
@@ -1835,13 +1677,11 @@ public abstract class ResolvedType extends UnresolvedType implements
                        return false;
                }
                if (parent.isStatic() && !child.isStatic()) {
-                       world.showMessage(IMessage.ERROR, WeaverMessages.format(
-                                       WeaverMessages.ITD_OVERRIDDEN_STATIC, child, parent), child
+                       world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ITD_OVERRIDDEN_STATIC, child, parent), child
                                        .getSourceLocation(), null);
                        return false;
                } else if (child.isStatic() && !parent.isStatic()) {
-                       world.showMessage(IMessage.ERROR, WeaverMessages.format(
-                                       WeaverMessages.ITD_OVERIDDING_STATIC, child, parent), child
+                       world.showMessage(IMessage.ERROR, WeaverMessages.format(WeaverMessages.ITD_OVERIDDING_STATIC, child, parent), child
                                        .getSourceLocation(), null);
                        return false;
                }
@@ -1861,8 +1701,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                if (m2.isProtected() && m2.getName().charAt(0) == 'c') {
                        UnresolvedType declaring = m2.getDeclaringType();
                        if (declaring != null) {
-                               if (declaring.getName().equals("java.lang.Object")
-                                               && m2.getName().equals("clone"))
+                               if (declaring.getName().equals("java.lang.Object") && m2.getName().equals("clone"))
                                        return +1;
                        }
                }
@@ -1902,18 +1741,15 @@ public abstract class ResolvedType extends UnresolvedType implements
                return (0 == (i & (Modifier.PUBLIC | Modifier.PRIVATE | Modifier.PROTECTED)));
        }
 
-       private void interTypeConflictError(ConcreteTypeMunger m1,
-                       ConcreteTypeMunger m2) {
+       private void interTypeConflictError(ConcreteTypeMunger m1, ConcreteTypeMunger m2) {
                // XXX this works only if we ignore separate compilation issues
                // XXX dual errors possible if (this instanceof BcelObjectType) return;
 
                // System.err.println("conflict at " + m2.getSourceLocation());
                getWorld().showMessage(
                                IMessage.ERROR,
-                               WeaverMessages.format(WeaverMessages.ITD_CONFLICT, m1
-                                               .getAspectType().getName(), m2.getSignature(), m2
-                                               .getAspectType().getName()), m2.getSourceLocation(),
-                               getSourceLocation());
+                               WeaverMessages.format(WeaverMessages.ITD_CONFLICT, m1.getAspectType().getName(), m2.getSignature(), m2
+                                               .getAspectType().getName()), m2.getSourceLocation(), getSourceLocation());
        }
 
        public ResolvedMember lookupSyntheticMember(Member member) {
@@ -1932,10 +1768,8 @@ public abstract class ResolvedType extends UnresolvedType implements
                // Handling members for the new array join point
                if (world.isJoinpointArrayConstructionEnabled() && this.isArray()) {
                        if (member.getKind() == Member.CONSTRUCTOR) {
-                               ResolvedMemberImpl ret = new ResolvedMemberImpl(
-                                               Member.CONSTRUCTOR, this, Modifier.PUBLIC,
-                                               ResolvedType.VOID, "<init>", world.resolve(member
-                                                               .getParameterTypes()));
+                               ResolvedMemberImpl ret = new ResolvedMemberImpl(Member.CONSTRUCTOR, this, Modifier.PUBLIC, ResolvedType.VOID,
+                                               "<init>", world.resolve(member.getParameterTypes()));
                                return ret;
                        }
                }
@@ -1975,8 +1809,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                if (!interfaceType.isAssignableFrom(this))
                        return null;
                // Check if my super class is an implementor?
-               ResolvedType higherType = this.getSuperclass().getTopmostImplementor(
-                               interfaceType);
+               ResolvedType higherType = this.getSuperclass().getTopmostImplementor(interfaceType);
                if (higherType != null)
                        return higherType;
                return this;
@@ -1987,29 +1820,21 @@ public abstract class ResolvedType extends UnresolvedType implements
                if (getSuperclass() != null)
                        ret.addAll(getSuperclass().getExposedPointcuts());
 
-               for (Iterator i = Arrays.asList(getDeclaredInterfaces()).iterator(); i
-                               .hasNext();) {
+               for (Iterator i = Arrays.asList(getDeclaredInterfaces()).iterator(); i.hasNext();) {
                        ResolvedType t = (ResolvedType) i.next();
-                       addPointcutsResolvingConflicts(ret, Arrays.asList(t
-                                       .getDeclaredPointcuts()), false);
+                       addPointcutsResolvingConflicts(ret, Arrays.asList(t.getDeclaredPointcuts()), false);
                }
-               addPointcutsResolvingConflicts(ret, Arrays
-                               .asList(getDeclaredPointcuts()), true);
+               addPointcutsResolvingConflicts(ret, Arrays.asList(getDeclaredPointcuts()), true);
                for (Iterator i = ret.iterator(); i.hasNext();) {
-                       ResolvedPointcutDefinition inherited = (ResolvedPointcutDefinition) i
-                                       .next();
+                       ResolvedPointcutDefinition inherited = (ResolvedPointcutDefinition) i.next();
                        // System.err.println("looking at: " + inherited + " in " + this);
                        // System.err.println("            " + inherited.isAbstract() +
                        // " in " + this.isAbstract());
                        if (inherited.isAbstract()) {
                                if (!this.isAbstract()) {
-                                       getWorld().showMessage(
-                                                       IMessage.ERROR,
-                                                       WeaverMessages.format(
-                                                                       WeaverMessages.POINCUT_NOT_CONCRETE,
-                                                                       inherited, this.getName()),
-                                                       inherited.getSourceLocation(),
-                                                       this.getSourceLocation());
+                                       getWorld().showMessage(IMessage.ERROR,
+                                                       WeaverMessages.format(WeaverMessages.POINCUT_NOT_CONCRETE, inherited, this.getName()),
+                                                       inherited.getSourceLocation(), this.getSourceLocation());
                                }
                        }
                }
@@ -2017,31 +1842,22 @@ public abstract class ResolvedType extends UnresolvedType implements
                return ret;
        }
 
-       private void addPointcutsResolvingConflicts(List acc, List added,
-                       boolean isOverriding) {
+       private void addPointcutsResolvingConflicts(List acc, List added, boolean isOverriding) {
                for (Iterator i = added.iterator(); i.hasNext();) {
-                       ResolvedPointcutDefinition toAdd = (ResolvedPointcutDefinition) i
-                                       .next();
+                       ResolvedPointcutDefinition toAdd = (ResolvedPointcutDefinition) i.next();
                        // System.err.println("adding: " + toAdd);
                        for (Iterator j = acc.iterator(); j.hasNext();) {
-                               ResolvedPointcutDefinition existing = (ResolvedPointcutDefinition) j
-                                               .next();
+                               ResolvedPointcutDefinition existing = (ResolvedPointcutDefinition) j.next();
                                if (existing == toAdd)
                                        continue;
-                               if (!isVisible(existing.getModifiers(), existing
-                                               .getDeclaringType().resolve(getWorld()), this)) {
+                               if (!isVisible(existing.getModifiers(), existing.getDeclaringType().resolve(getWorld()), this)) {
                                        // if they intended to override it but it is not visible,
                                        // give them a nicer message
-                                       if (existing.isAbstract()
-                                                       && conflictingSignature(existing, toAdd)) {
+                                       if (existing.isAbstract() && conflictingSignature(existing, toAdd)) {
                                                getWorld().showMessage(
                                                                IMessage.ERROR,
-                                                               WeaverMessages.format(
-                                                                               WeaverMessages.POINTCUT_NOT_VISIBLE,
-                                                                               existing.getDeclaringType().getName()
-                                                                                               + "." + existing.getName()
-                                                                                               + "()", this.getName()),
-                                                               toAdd.getSourceLocation(), null);
+                                                               WeaverMessages.format(WeaverMessages.POINTCUT_NOT_VISIBLE, existing.getDeclaringType().getName()
+                                                                               + "." + existing.getName() + "()", this.getName()), toAdd.getSourceLocation(), null);
                                                j.remove();
                                        }
                                        continue;
@@ -2051,17 +1867,10 @@ public abstract class ResolvedType extends UnresolvedType implements
                                                checkLegalOverride(existing, toAdd);
                                                j.remove();
                                        } else {
-                                               getWorld()
-                                                               .showMessage(
-                                                                               IMessage.ERROR,
-                                                                               WeaverMessages
-                                                                                               .format(
-                                                                                                               WeaverMessages.CONFLICTING_INHERITED_POINTCUTS,
-                                                                                                               this.getName()
-                                                                                                                               + toAdd
-                                                                                                                                               .getSignature()),
-                                                                               existing.getSourceLocation(),
-                                                                               toAdd.getSourceLocation());
+                                               getWorld().showMessage(
+                                                               IMessage.ERROR,
+                                                               WeaverMessages.format(WeaverMessages.CONFLICTING_INHERITED_POINTCUTS, this.getName()
+                                                                               + toAdd.getSignature()), existing.getSourceLocation(), toAdd.getSourceLocation());
                                                j.remove();
                                        }
                                }
@@ -2083,29 +1892,25 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * Overridden by ReferenceType to return a sensible answer for parameterized
-        * and raw types.
+        * Overridden by ReferenceType to return a sensible answer for parameterized and raw types.
         * 
         * @return
         */
        public ResolvedType getGenericType() {
                if (!(isParameterizedType() || isRawType()))
-                       throw new BCException("The type " + getBaseName()
-                                       + " is not parameterized or raw - it has no generic type");
+                       throw new BCException("The type " + getBaseName() + " is not parameterized or raw - it has no generic type");
                return null;
        }
 
        public ResolvedType parameterizedWith(UnresolvedType[] typeParameters) {
                if (!(isGenericType() || isParameterizedType()))
                        return this;
-               return TypeFactory.createParameterizedType(this.getGenericType(),
-                               typeParameters, getWorld());
+               return TypeFactory.createParameterizedType(this.getGenericType(), typeParameters, getWorld());
        }
 
        /**
-        * Iff I am a parameterized type, and any of my parameters are type variable
-        * references, return a version with those type parameters replaced in
-        * accordance with the passed bindings.
+        * Iff I am a parameterized type, and any of my parameters are type variable references, return a version with those type
+        * parameters replaced in accordance with the passed bindings.
         */
        public UnresolvedType parameterize(Map typeBindings) {
                if (!isParameterizedType())
@@ -2114,8 +1919,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                // );
                boolean workToDo = false;
                for (int i = 0; i < typeParameters.length; i++) {
-                       if (typeParameters[i].isTypeVariableReference()
-                                       || (typeParameters[i] instanceof BoundedReferenceType)) {
+                       if (typeParameters[i].isTypeVariableReference() || (typeParameters[i] instanceof BoundedReferenceType)) {
                                workToDo = true;
                        }
                }
@@ -2127,8 +1931,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                                newTypeParams[i] = typeParameters[i];
                                if (newTypeParams[i].isTypeVariableReference()) {
                                        TypeVariableReferenceType tvrt = (TypeVariableReferenceType) newTypeParams[i];
-                                       UnresolvedType binding = (UnresolvedType) typeBindings
-                                                       .get(tvrt.getTypeVariable().getName());
+                                       UnresolvedType binding = (UnresolvedType) typeBindings.get(tvrt.getTypeVariable().getName());
                                        if (binding != null)
                                                newTypeParams[i] = binding;
                                } else if (newTypeParams[i] instanceof BoundedReferenceType) {
@@ -2137,8 +1940,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                                        // brType.parameterize(typeBindings)
                                }
                        }
-                       return TypeFactory.createParameterizedType(getGenericType(),
-                                       newTypeParams, getWorld());
+                       return TypeFactory.createParameterizedType(getGenericType(), newTypeParams, getWorld());
                }
        }
 
@@ -2190,38 +1992,29 @@ public abstract class ResolvedType extends UnresolvedType implements
         * @return true if assignable to java.lang.Exception
         */
        public boolean isException() {
-               return (world.getCoreType(UnresolvedType.JAVA_LANG_EXCEPTION)
-                               .isAssignableFrom(this));
+               return (world.getCoreType(UnresolvedType.JAVA_LANG_EXCEPTION).isAssignableFrom(this));
        }
 
        /**
-        * @return true if it is an exception and it is a checked one, false
-        *         otherwise.
+        * @return true if it is an exception and it is a checked one, false otherwise.
         */
        public boolean isCheckedException() {
                if (!isException())
                        return false;
-               if (world.getCoreType(UnresolvedType.RUNTIME_EXCEPTION)
-                               .isAssignableFrom(this))
+               if (world.getCoreType(UnresolvedType.RUNTIME_EXCEPTION).isAssignableFrom(this))
                        return false;
                return true;
        }
 
        /**
-        * Determines if variables of this type could be assigned values of another
-        * with lots of help. java.lang.Object is convertable from all types. A
-        * primitive type is convertable from X iff it's assignable from X. A
-        * reference type is convertable from X iff it's coerceable from X. In other
-        * words, X isConvertableFrom Y iff the compiler thinks that _some_ value of
-        * Y could be assignable to a variable of type X without loss of precision.
+        * Determines if variables of this type could be assigned values of another with lots of help. java.lang.Object is convertable
+        * from all types. A primitive type is convertable from X iff it's assignable from X. A reference type is convertable from X iff
+        * it's coerceable from X. In other words, X isConvertableFrom Y iff the compiler thinks that _some_ value of Y could be
+        * assignable to a variable of type X without loss of precision.
         * 
-        * @param other
-        *            the other type
-        * @param world
-        *            the {@link World} in which the possible assignment should be
-        *            checked.
-        * @return true iff variables of this type could be assigned values of other
-        *         with possible conversion
+        * @param other the other type
+        * @param world the {@link World} in which the possible assignment should be checked.
+        * @return true iff variables of this type could be assigned values of other with possible conversion
         */
        public final boolean isConvertableFrom(ResolvedType other) {
 
@@ -2241,8 +2034,7 @@ public abstract class ResolvedType extends UnresolvedType implements
                                // and the
                                // other
                                // isnt
-                               if (validBoxing.contains(this.getSignature()
-                                               + other.getSignature()))
+                               if (validBoxing.contains(this.getSignature() + other.getSignature()))
                                        return true;
                        }
                }
@@ -2252,32 +2044,26 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * Determines if the variables of this type could be assigned values of
-        * another type without casting. This still allows for assignment conversion
-        * as per JLS 2ed 5.2. For object types, this means supertypeOrEqual(THIS,
-        * OTHER).
+        * Determines if the variables of this type could be assigned values of another type without casting. This still allows for
+        * assignment conversion as per JLS 2ed 5.2. For object types, this means supertypeOrEqual(THIS, OTHER).
         * 
-        * @param other
-        *            the other type
-        * @param world
-        *            the {@link World} in which the possible assignment should be
-        *            checked.
-        * @return true iff variables of this type could be assigned values of other
-        *         without casting
-        * @throws NullPointerException
-        *             if other is null
+        * @param other the other type
+        * @param world the {@link World} in which the possible assignment should be checked.
+        * @return true iff variables of this type could be assigned values of other without casting
+        * @throws NullPointerException if other is null
         */
        public abstract boolean isAssignableFrom(ResolvedType other);
 
-       public abstract boolean isAssignableFrom(ResolvedType other,
-                       boolean allowMissing);
+       public abstract boolean isAssignableFrom(ResolvedType other, boolean allowMissing);
 
        /**
-        * Determines if values of another type could possibly be cast to this type.
-        * The rules followed are from JLS 2ed 5.5, "Casting Conversion". <p/>
+        * Determines if values of another type could possibly be cast to this type. The rules followed are from JLS 2ed 5.5,
+        * "Casting Conversion".
+        * <p/>
         * <p>
-        * This method should be commutative, i.e., for all UnresolvedType a, b and
-        * all World w: <p/> <blockquote>
+        * This method should be commutative, i.e., for all UnresolvedType a, b and all World w:
+        * <p/>
+        * <blockquote>
         * 
         * <pre>
         * a.isCoerceableFrom(b, w) == b.isCoerceableFrom(a, w)
@@ -2285,14 +2071,10 @@ public abstract class ResolvedType extends UnresolvedType implements
         * 
         * </blockquote>
         * 
-        * @param other
-        *            the other type
-        * @param world
-        *            the {@link World} in which the possible coersion should be
-        *            checked.
+        * @param other the other type
+        * @param world the {@link World} in which the possible coersion should be checked.
         * @return true iff values of other could possibly be cast to this type.
-        * @throws NullPointerException
-        *             if other is null.
+        * @throws NullPointerException if other is null.
         */
        public abstract boolean isCoerceableFrom(ResolvedType other);
 
@@ -2308,8 +2090,8 @@ public abstract class ResolvedType extends UnresolvedType implements
        private FuzzyBoolean parameterizedWithTypeVariable = FuzzyBoolean.MAYBE;
 
        /**
-        * return true if the parameterization of this type includes a member type
-        * variable. Member type variables occur in generic methods/ctors.
+        * return true if the parameterization of this type includes a member type variable. Member type variables occur in generic
+        * methods/ctors.
         */
        public boolean isParameterizedWithTypeVariable() {
                // MAYBE means we haven't worked it out yet...
@@ -2354,12 +2136,9 @@ public abstract class ResolvedType extends UnresolvedType implements
                                                boolean b = false;
                                                UnresolvedType upperBound = boundedRT.getUpperBound();
                                                if (upperBound.isParameterizedType()) {
-                                                       b = ((ResolvedType) upperBound)
-                                                                       .isParameterizedWithTypeVariable();
+                                                       b = ((ResolvedType) upperBound).isParameterizedWithTypeVariable();
                                                } else if (upperBound.isTypeVariableReference()
-                                                               && ((TypeVariableReference) upperBound)
-                                                                               .getTypeVariable()
-                                                                               .getDeclaringElementKind() == TypeVariable.METHOD) {
+                                                               && ((TypeVariableReference) upperBound).getTypeVariable().getDeclaringElementKind() == TypeVariable.METHOD) {
                                                        b = true;
                                                }
                                                if (b) {
@@ -2372,12 +2151,9 @@ public abstract class ResolvedType extends UnresolvedType implements
                                                boolean b = false;
                                                UnresolvedType lowerBound = boundedRT.getLowerBound();
                                                if (lowerBound.isParameterizedType()) {
-                                                       b = ((ResolvedType) lowerBound)
-                                                                       .isParameterizedWithTypeVariable();
+                                                       b = ((ResolvedType) lowerBound).isParameterizedWithTypeVariable();
                                                } else if (lowerBound.isTypeVariableReference()
-                                                               && ((TypeVariableReference) lowerBound)
-                                                                               .getTypeVariable()
-                                                                               .getDeclaringElementKind() == TypeVariable.METHOD) {
+                                                               && ((TypeVariableReference) lowerBound).getTypeVariable().getDeclaringElementKind() == TypeVariable.METHOD) {
                                                        b = true;
                                                }
                                                if (b) {
@@ -2416,8 +2192,7 @@ public abstract class ResolvedType extends UnresolvedType implements
        }
 
        /**
-        * Returns the path to the jar or class file from which this binary aspect
-        * came or null if not a binary aspect
+        * Returns the path to the jar or class file from which this binary aspect came or null if not a binary aspect
         */
        public String getBinaryPath() {
                return binaryPath;
index ea3a891f27aecc25c203e6904f1a27d3c9df25d7..778631d6379723cec5d518ed9cb4f7f796c8e7e0 100644 (file)
@@ -13,7 +13,6 @@
 package org.aspectj.weaver;
 
 import java.io.DataInputStream;
-import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -22,17 +21,13 @@ import java.util.Iterator;
 import java.util.List;
 import java.util.Set;
 
-import org.aspectj.asm.IRelationship;
 import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.ISourceLocation;
-import org.aspectj.bridge.Message;
 import org.aspectj.bridge.MessageUtil;
-import org.aspectj.bridge.WeaveMessage;
 import org.aspectj.lang.JoinPoint;
 import org.aspectj.util.PartialOrder;
 import org.aspectj.util.TypeSafeEnum;
 import org.aspectj.weaver.ast.Var;
-import org.aspectj.weaver.model.AsmRelationshipProvider;
 
 /*
  * The superclass of anything representing a the shadow of a join point.  A shadow represents
@@ -597,161 +592,13 @@ public abstract class Shadow {
                throw new RuntimeException("Generic shadows cannot be prepared");
        }
 
-       /*
-        * Ensure we report a nice source location - particular in the case where the source info is missing (binary weave).
-        */
-       private String beautifyLocation(ISourceLocation isl) {
-               StringBuffer nice = new StringBuffer();
-               if (isl == null || isl.getSourceFile() == null || isl.getSourceFile().getName().indexOf("no debug info available") != -1) {
-                       nice.append("no debug info available");
-               } else {
-                       // can't use File.getName() as this fails when a Linux box encounters a path created on Windows and vice-versa
-                       int takeFrom = isl.getSourceFile().getPath().lastIndexOf('/');
-                       if (takeFrom == -1) {
-                               takeFrom = isl.getSourceFile().getPath().lastIndexOf('\\');
-                       }
-                       int binary = isl.getSourceFile().getPath().lastIndexOf('!');
-                       if (binary != -1 && binary < takeFrom) {
-                               // we have been woven by a binary aspect
-                               String pathToBinaryLoc = isl.getSourceFile().getPath().substring(0, binary + 1);
-                               if (pathToBinaryLoc.indexOf(".jar") != -1) {
-                                       // only want to add the extra info if we're from a jar file
-                                       int lastSlash = pathToBinaryLoc.lastIndexOf('/');
-                                       if (lastSlash == -1) {
-                                               lastSlash = pathToBinaryLoc.lastIndexOf('\\');
-                                       }
-                                       nice.append(pathToBinaryLoc.substring(lastSlash + 1));
-                               }
-                       }
-                       nice.append(isl.getSourceFile().getPath().substring(takeFrom + 1));
-                       if (isl.getLine() != 0)
-                               nice.append(":").append(isl.getLine());
-                       // if it's a binary file then also want to give the file name
-                       if (isl.getSourceFileName() != null)
-                               nice.append("(from " + isl.getSourceFileName() + ")");
-               }
-               return nice.toString();
-       }
-
-       /*
-        * Report a message about the advice weave that has occurred. Some messing about to make it pretty ! This code is just asking
-        * for an NPE to occur ...
-        */
-       private void reportWeavingMessage(ShadowMunger munger) {
-               Advice advice = (Advice) munger;
-               AdviceKind aKind = advice.getKind();
-               // Only report on interesting advice kinds ...
-               if (aKind == null || advice.getConcreteAspect() == null) {
-                       // We suspect someone is programmatically driving the weaver
-                       // (e.g. IdWeaveTestCase in the weaver testcases)
-                       return;
-               }
-               if (!(aKind.equals(AdviceKind.Before) || aKind.equals(AdviceKind.After) || aKind.equals(AdviceKind.AfterReturning)
-                               || aKind.equals(AdviceKind.AfterThrowing) || aKind.equals(AdviceKind.Around) || aKind.equals(AdviceKind.Softener)))
-                       return;
-
-               // synchronized blocks are implemented with multiple monitor_exit instructions in the bytecode
-               // (one for normal exit from the method, one for abnormal exit), we only want to tell the user
-               // once we have advised the end of the sync block, even though under the covers we will have
-               // woven both exit points
-               if (this.kind == Shadow.SynchronizationUnlock) {
-                       if (advice.lastReportedMonitorExitJoinpointLocation == null) {
-                               // this is the first time through, let's continue...
-                               advice.lastReportedMonitorExitJoinpointLocation = getSourceLocation();
-                       } else {
-                               if (areTheSame(getSourceLocation(), advice.lastReportedMonitorExitJoinpointLocation)) {
-                                       // Don't report it again!
-                                       advice.lastReportedMonitorExitJoinpointLocation = null;
-                                       return;
-                               }
-                               // hmmm, this means some kind of nesting is going on, urgh
-                               advice.lastReportedMonitorExitJoinpointLocation = getSourceLocation();
-                       }
-               }
-
-               String description = advice.getKind().toString();
-               String advisedType = this.getEnclosingType().getName();
-               String advisingType = advice.getConcreteAspect().getName();
-               Message msg = null;
-               if (advice.getKind().equals(AdviceKind.Softener)) {
-                       msg = WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_SOFTENS, new String[] { advisedType,
-                                       beautifyLocation(getSourceLocation()), advisingType, beautifyLocation(munger.getSourceLocation()) },
-                                       advisedType, advisingType);
-               } else {
-                       boolean runtimeTest = advice.hasDynamicTests();
-                       String joinPointDescription = this.toString();
-                       msg = WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_ADVISES, new String[] { joinPointDescription,
-                                       advisedType, beautifyLocation(getSourceLocation()), description, advisingType,
-                                       beautifyLocation(munger.getSourceLocation()), (runtimeTest ? " [with runtime test]" : "") }, advisedType,
-                                       advisingType);
-                       // Boolean.toString(runtimeTest)});
-               }
-               getIWorld().getMessageHandler().handleMessage(msg);
-       }
-
-       private boolean areTheSame(ISourceLocation locA, ISourceLocation locB) {
-               if (locA == null)
-                       return locB == null;
-               if (locB == null)
-                       return false;
-               if (locA.getLine() != locB.getLine())
-                       return false;
-               File fA = locA.getSourceFile();
-               File fB = locA.getSourceFile();
-               if (fA == null)
-                       return fB == null;
-               if (fB == null)
-                       return false;
-               return fA.getName().equals(fB.getName());
-       }
-
-       public IRelationship.Kind determineRelKind(ShadowMunger munger) {
-               AdviceKind ak = ((Advice) munger).getKind();
-               if (ak.getKey() == AdviceKind.Before.getKey())
-                       return IRelationship.Kind.ADVICE_BEFORE;
-               else if (ak.getKey() == AdviceKind.After.getKey())
-                       return IRelationship.Kind.ADVICE_AFTER;
-               else if (ak.getKey() == AdviceKind.AfterThrowing.getKey())
-                       return IRelationship.Kind.ADVICE_AFTERTHROWING;
-               else if (ak.getKey() == AdviceKind.AfterReturning.getKey())
-                       return IRelationship.Kind.ADVICE_AFTERRETURNING;
-               else if (ak.getKey() == AdviceKind.Around.getKey())
-                       return IRelationship.Kind.ADVICE_AROUND;
-               else if (ak.getKey() == AdviceKind.CflowEntry.getKey() || ak.getKey() == AdviceKind.CflowBelowEntry.getKey()
-                               || ak.getKey() == AdviceKind.InterInitializer.getKey() || ak.getKey() == AdviceKind.PerCflowEntry.getKey()
-                               || ak.getKey() == AdviceKind.PerCflowBelowEntry.getKey() || ak.getKey() == AdviceKind.PerThisEntry.getKey()
-                               || ak.getKey() == AdviceKind.PerTargetEntry.getKey() || ak.getKey() == AdviceKind.Softener.getKey()
-                               || ak.getKey() == AdviceKind.PerTypeWithinEntry.getKey()) {
-                       // System.err.println("Dont want a message about this: "+ak);
-                       return null;
-               }
-               throw new RuntimeException("Shadow.determineRelKind: What the hell is it? " + ak);
-       }
-
        /** Actually implement the (non-empty) mungers associated with this shadow */
        private void implementMungers() {
                World world = getIWorld();
                for (Iterator iter = mungers.iterator(); iter.hasNext();) {
                        ShadowMunger munger = (ShadowMunger) iter.next();
                        munger.implementOn(this);
-
-                       if (world.getCrossReferenceHandler() != null) {
-                               world.getCrossReferenceHandler().addCrossReference(munger.getSourceLocation(), // What is being applied
-                                               this.getSourceLocation(), // Where is it being applied
-                                               determineRelKind(munger), // What kind of advice?
-                                               ((Advice) munger).hasDynamicTests() // Is a runtime test being stuffed in the code?
-                                               );
-                       }
-
-                       // TAG: WeavingMessage
-                       if (!getIWorld().getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) {
-                               reportWeavingMessage(munger);
-                       }
-
-                       if (world.getModel() != null) {
-                               // System.err.println("munger: " + munger + " on " + this);
-                               AsmRelationshipProvider.getDefault().adviceMunger(world.getModel(), this, munger);
-                       }
+                       world.reportMatch(munger, this);
                }
        }
 
index c69589b29e6d9c3d5b10f657f26b8203445c1174..bc6e3982caa2d79a465645747bd394be8989a00d 100644 (file)
 package org.aspectj.weaver;
 
 import java.io.File;
-import java.util.ArrayList;
 import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
 import java.util.Map;
 
-import org.aspectj.asm.AsmManager;
-import org.aspectj.asm.IProgramElement;
-import org.aspectj.asm.internal.ProgramElement;
 import org.aspectj.bridge.ISourceLocation;
 import org.aspectj.bridge.SourceLocation;
 import org.aspectj.util.PartialOrder;
-import org.aspectj.weaver.model.AsmRelationshipUtils;
-import org.aspectj.weaver.patterns.DeclareErrorOrWarning;
 import org.aspectj.weaver.patterns.PerClause;
 import org.aspectj.weaver.patterns.Pointcut;
 
@@ -48,7 +40,7 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH
        private ISourceLocation sourceLocation;
        private ISourceLocation binarySourceLocation;
        private File binaryFile;
-       private String handle = null;
+       public String handle = null;
        private ResolvedType declaringType; // the type that declared this munger.
 
        public ShadowMunger(Pointcut pointcut, int start, int end, ISourceContext sourceContext) {
@@ -100,17 +92,6 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH
                return sourceLocation;
        }
 
-       public String getHandle(AsmManager asm) {
-               if (null == handle) {
-                       ISourceLocation sl = getSourceLocation();
-                       if (sl != null) {
-                               IProgramElement ipe = asm.getHierarchy().findElementForSourceLine(sl);
-                               handle = asm.getHandleProvider().createHandleIdentifier(ipe);
-                       }
-               }
-               return handle;
-       }
-
        // ---- fields
 
        public static final ShadowMunger[] NONE = new ShadowMunger[0];
@@ -150,158 +131,12 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH
         */
        public abstract boolean mustCheckExceptions();
 
-       /**
-        * Creates the hierarchy for binary aspects
-        */
-       public void createHierarchy(AsmManager asm) {
-               if (!isBinary())
-                       return;
-
-               IProgramElement sourceFileNode = asm.getHierarchy().findElementForSourceLine(getSourceLocation());
-               // the call to findElementForSourceLine(ISourceLocation) returns a file
-               // node
-               // if it can't find a node in the hierarchy for the given
-               // sourcelocation.
-               // Therefore, if this is returned, we know we can't find one and have to
-               // continue to fault in the model.
-               if (!sourceFileNode.getKind().equals(IProgramElement.Kind.FILE_JAVA)) {
-                       return;
-               }
-
-               ResolvedType aspect = getDeclaringType();
-
-               // create the class file node
-               IProgramElement classFileNode = new ProgramElement(asm, sourceFileNode.getName(), IProgramElement.Kind.FILE,
-                               getBinarySourceLocation(aspect.getSourceLocation()), 0, null, null);
-
-               // create package ipe if one exists....
-               IProgramElement root = asm.getHierarchy().getRoot();
-               IProgramElement binaries = asm.getHierarchy().findElementForLabel(root, IProgramElement.Kind.SOURCE_FOLDER, "binaries");
-               if (binaries == null) {
-                       binaries = new ProgramElement(asm, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList());
-                       root.addChild(binaries);
-               }
-               // if (aspect.getPackageName() != null) {
-               String packagename = aspect.getPackageName() == null ? "" : aspect.getPackageName();
-               // check that there doesn't already exist a node with this name
-               IProgramElement pkgNode = asm.getHierarchy().findElementForLabel(binaries, IProgramElement.Kind.PACKAGE, packagename);
-               // note packages themselves have no source location
-               if (pkgNode == null) {
-                       pkgNode = new ProgramElement(asm, packagename, IProgramElement.Kind.PACKAGE, new ArrayList());
-                       binaries.addChild(pkgNode);
-                       pkgNode.addChild(classFileNode);
-               } else {
-                       // need to add it first otherwise the handle for classFileNode
-                       // may not be generated correctly if it uses information from
-                       // it's parent node
-                       pkgNode.addChild(classFileNode);
-                       for (Iterator iter = pkgNode.getChildren().iterator(); iter.hasNext();) {
-                               IProgramElement element = (IProgramElement) iter.next();
-                               if (!element.equals(classFileNode) && element.getHandleIdentifier().equals(classFileNode.getHandleIdentifier())) {
-                                       // already added the classfile so have already
-                                       // added the structure for this aspect
-                                       pkgNode.removeChild(classFileNode);
-                                       return;
-                               }
-                       }
-               }
-               // } else {
-               // // need to add it first otherwise the handle for classFileNode
-               // // may not be generated correctly if it uses information from
-               // // it's parent node
-               // root.addChild(classFileNode);
-               // for (Iterator iter = root.getChildren().iterator(); iter.hasNext();) {
-               // IProgramElement element = (IProgramElement) iter.next();
-               // if (!element.equals(classFileNode) && element.getHandleIdentifier().equals(classFileNode.getHandleIdentifier())) {
-               // // already added the sourcefile so have already
-               // // added the structure for this aspect
-               // root.removeChild(classFileNode);
-               // return;
-               // }
-               // }
-               // }
-
-               // add and create empty import declaration ipe
-               classFileNode.addChild(new ProgramElement(asm, "import declarations", IProgramElement.Kind.IMPORT_REFERENCE, null, 0, null,
-                               null));
-
-               // add and create aspect ipe
-               IProgramElement aspectNode = new ProgramElement(asm, aspect.getSimpleName(), IProgramElement.Kind.ASPECT,
-                               getBinarySourceLocation(aspect.getSourceLocation()), aspect.getModifiers(), null, null);
-               classFileNode.addChild(aspectNode);
-
-               addChildNodes(asm, aspectNode, aspect.getDeclaredPointcuts());
-
-               addChildNodes(asm, aspectNode, aspect.getDeclaredAdvice());
-               addChildNodes(asm, aspectNode, aspect.getDeclares());
-       }
-
-       private void addChildNodes(AsmManager asm, IProgramElement parent, ResolvedMember[] children) {
-               for (int i = 0; i < children.length; i++) {
-                       ResolvedMember pcd = children[i];
-                       if (pcd instanceof ResolvedPointcutDefinition) {
-                               ResolvedPointcutDefinition rpcd = (ResolvedPointcutDefinition) pcd;
-                               ISourceLocation sLoc = rpcd.getPointcut().getSourceLocation();
-                               if (sLoc == null) {
-                                       sLoc = rpcd.getSourceLocation();
-                               }
-                               parent.addChild(new ProgramElement(asm, pcd.getName(), IProgramElement.Kind.POINTCUT,
-                                               getBinarySourceLocation(sLoc), pcd.getModifiers(), null, Collections.EMPTY_LIST));
-                       }
-               }
-       }
-
-       private void addChildNodes(AsmManager asm, IProgramElement parent, Collection children) {
-               int deCtr = 1;
-               int dwCtr = 1;
-               for (Iterator iter = children.iterator(); iter.hasNext();) {
-                       Object element = iter.next();
-                       if (element instanceof DeclareErrorOrWarning) {
-                               DeclareErrorOrWarning decl = (DeclareErrorOrWarning) element;
-                               int counter = 0;
-                               if (decl.isError()) {
-                                       counter = deCtr++;
-                               } else {
-                                       counter = dwCtr++;
-                               }
-                               parent.addChild(createDeclareErrorOrWarningChild(asm, decl, counter));
-                       } else if (element instanceof Advice) {
-                               Advice advice = (Advice) element;
-                               parent.addChild(createAdviceChild(asm, advice));
-                       }
-               }
-       }
-
-       private IProgramElement createDeclareErrorOrWarningChild(AsmManager asm, DeclareErrorOrWarning decl, int count) {
-               IProgramElement deowNode = new ProgramElement(asm, decl.getName(), decl.isError() ? IProgramElement.Kind.DECLARE_ERROR
-                               : IProgramElement.Kind.DECLARE_WARNING, getBinarySourceLocation(decl.getSourceLocation()), decl.getDeclaringType()
-                               .getModifiers(), null, null);
-               deowNode.setDetails("\"" + AsmRelationshipUtils.genDeclareMessage(decl.getMessage()) + "\"");
-               if (count != -1) {
-                       deowNode.setBytecodeName(decl.getName() + "_" + count);
-               }
-               return deowNode;
-       }
-
-       private IProgramElement createAdviceChild(AsmManager asm, Advice advice) {
-               IProgramElement adviceNode = new ProgramElement(asm, advice.kind.getName(), IProgramElement.Kind.ADVICE,
-                               getBinarySourceLocation(advice.getSourceLocation()), advice.signature.getModifiers(), null, Collections.EMPTY_LIST);
-               adviceNode.setDetails(AsmRelationshipUtils.genPointcutDetails(advice.getPointcut()));
-               adviceNode.setBytecodeName(advice.getSignature().getName());
-               // String nn = advice.getSignature().getName();
-               // if (counter != 1) {
-               // adviceNode.setBytecodeName(advice.getKind().getName() + "$"
-               // + counter + "$");
-               // }
-               return adviceNode;
-       }
-
        /**
         * Returns the binarySourceLocation for the given sourcelocation. This isn't cached because it's used when faulting in the
         * binary nodes and is called with ISourceLocations for all advice, pointcuts and deows contained within the
         * resolvedDeclaringAspect.
         */
-       private ISourceLocation getBinarySourceLocation(ISourceLocation sl) {
+       public ISourceLocation getBinarySourceLocation(ISourceLocation sl) {
                if (sl == null)
                        return null;
                String sourceFileName = null;
@@ -339,7 +174,7 @@ public abstract class ShadowMunger implements PartialOrder.PartialComparable, IH
         * Returns whether or not this shadow munger came from a binary aspect - keep a record of whether or not we've checked if we're
         * binary otherwise we keep caluclating the same thing many times
         */
-       protected boolean isBinary() {
+       public boolean isBinary() {
                if (!checkedIsBinary) {
                        ResolvedType rt = getDeclaringType();
                        if (rt != null) {
index 4feedae1ac428750d035cd3c01b65ede43aa0d58..25f8cc73bcf14286a4955860825ba91c72a7e135 100644 (file)
@@ -1276,4 +1276,11 @@ public abstract class World implements Dump.INode {
                return pointcutDesignators;
        }
 
+       public void reportMatch(ShadowMunger munger, Shadow shadow) {
+
+       }
+
+       public void reportCheckerMatch(Checker checker, Shadow shadow) {
+       }
+
 }
\ No newline at end of file
index 0179887df377a021b0ed829d4a49ef0b2f546bb4..d5d36f9932322562de58def7115f20f8df04022f 100644 (file)
@@ -38,10 +38,18 @@ import org.aspectj.apache.bcel.util.ClassLoaderRepository;
 import org.aspectj.apache.bcel.util.ClassPath;
 import org.aspectj.apache.bcel.util.NonCachingClassLoaderRepository;
 import org.aspectj.apache.bcel.util.Repository;
+import org.aspectj.asm.IRelationship;
+import org.aspectj.bridge.IMessage;
 import org.aspectj.bridge.IMessageHandler;
+import org.aspectj.bridge.ISourceLocation;
+import org.aspectj.bridge.Message;
+import org.aspectj.bridge.WeaveMessage;
+import org.aspectj.weaver.Advice;
+import org.aspectj.weaver.AdviceKind;
 import org.aspectj.weaver.AnnotationAJ;
 import org.aspectj.weaver.AnnotationOnTypeMunger;
 import org.aspectj.weaver.BCException;
+import org.aspectj.weaver.Checker;
 import org.aspectj.weaver.ICrossReferenceHandler;
 import org.aspectj.weaver.IWeavingSupport;
 import org.aspectj.weaver.Member;
@@ -54,9 +62,12 @@ import org.aspectj.weaver.ResolvedMember;
 import org.aspectj.weaver.ResolvedMemberImpl;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.ResolvedTypeMunger;
+import org.aspectj.weaver.Shadow;
+import org.aspectj.weaver.ShadowMunger;
 import org.aspectj.weaver.UnresolvedType;
 import org.aspectj.weaver.WeakClassLoaderReference;
 import org.aspectj.weaver.World;
+import org.aspectj.weaver.model.AsmRelationshipProvider;
 import org.aspectj.weaver.patterns.DeclareAnnotation;
 import org.aspectj.weaver.patterns.DeclareParents;
 import org.aspectj.weaver.tools.Trace;
@@ -79,6 +90,157 @@ public class BcelWorld extends World implements Repository {
                this(makeDefaultClasspath(cp), IMessageHandler.THROW, null);
        }
 
+       public IRelationship.Kind determineRelKind(ShadowMunger munger) {
+               AdviceKind ak = ((Advice) munger).getKind();
+               if (ak.getKey() == AdviceKind.Before.getKey())
+                       return IRelationship.Kind.ADVICE_BEFORE;
+               else if (ak.getKey() == AdviceKind.After.getKey())
+                       return IRelationship.Kind.ADVICE_AFTER;
+               else if (ak.getKey() == AdviceKind.AfterThrowing.getKey())
+                       return IRelationship.Kind.ADVICE_AFTERTHROWING;
+               else if (ak.getKey() == AdviceKind.AfterReturning.getKey())
+                       return IRelationship.Kind.ADVICE_AFTERRETURNING;
+               else if (ak.getKey() == AdviceKind.Around.getKey())
+                       return IRelationship.Kind.ADVICE_AROUND;
+               else if (ak.getKey() == AdviceKind.CflowEntry.getKey() || ak.getKey() == AdviceKind.CflowBelowEntry.getKey()
+                               || ak.getKey() == AdviceKind.InterInitializer.getKey() || ak.getKey() == AdviceKind.PerCflowEntry.getKey()
+                               || ak.getKey() == AdviceKind.PerCflowBelowEntry.getKey() || ak.getKey() == AdviceKind.PerThisEntry.getKey()
+                               || ak.getKey() == AdviceKind.PerTargetEntry.getKey() || ak.getKey() == AdviceKind.Softener.getKey()
+                               || ak.getKey() == AdviceKind.PerTypeWithinEntry.getKey()) {
+                       // System.err.println("Dont want a message about this: "+ak);
+                       return null;
+               }
+               throw new RuntimeException("Shadow.determineRelKind: What the hell is it? " + ak);
+       }
+
+       public void reportMatch(ShadowMunger munger, Shadow shadow) {
+               if (getCrossReferenceHandler() != null) {
+                       getCrossReferenceHandler().addCrossReference(munger.getSourceLocation(), // What is being applied
+                                       shadow.getSourceLocation(), // Where is it being applied
+                                       determineRelKind(munger), // What kind of advice?
+                                       ((Advice) munger).hasDynamicTests() // Is a runtime test being stuffed in the code?
+                                       );
+               }
+
+               // TAG: WeavingMessage
+               if (!getMessageHandler().isIgnoring(IMessage.WEAVEINFO)) {
+                       reportWeavingMessage(munger, shadow);
+               }
+
+               if (getModel() != null) {
+                       // System.err.println("munger: " + munger + " on " + this);
+                       AsmRelationshipProvider.adviceMunger(getModel(), shadow, munger);
+               }
+       }
+
+       /*
+        * Report a message about the advice weave that has occurred. Some messing about to make it pretty ! This code is just asking
+        * for an NPE to occur ...
+        */
+       private void reportWeavingMessage(ShadowMunger munger, Shadow shadow) {
+               Advice advice = (Advice) munger;
+               AdviceKind aKind = advice.getKind();
+               // Only report on interesting advice kinds ...
+               if (aKind == null || advice.getConcreteAspect() == null) {
+                       // We suspect someone is programmatically driving the weaver
+                       // (e.g. IdWeaveTestCase in the weaver testcases)
+                       return;
+               }
+               if (!(aKind.equals(AdviceKind.Before) || aKind.equals(AdviceKind.After) || aKind.equals(AdviceKind.AfterReturning)
+                               || aKind.equals(AdviceKind.AfterThrowing) || aKind.equals(AdviceKind.Around) || aKind.equals(AdviceKind.Softener)))
+                       return;
+
+               // synchronized blocks are implemented with multiple monitor_exit instructions in the bytecode
+               // (one for normal exit from the method, one for abnormal exit), we only want to tell the user
+               // once we have advised the end of the sync block, even though under the covers we will have
+               // woven both exit points
+               if (shadow.getKind() == Shadow.SynchronizationUnlock) {
+                       if (advice.lastReportedMonitorExitJoinpointLocation == null) {
+                               // this is the first time through, let's continue...
+                               advice.lastReportedMonitorExitJoinpointLocation = shadow.getSourceLocation();
+                       } else {
+                               if (areTheSame(shadow.getSourceLocation(), advice.lastReportedMonitorExitJoinpointLocation)) {
+                                       // Don't report it again!
+                                       advice.lastReportedMonitorExitJoinpointLocation = null;
+                                       return;
+                               }
+                               // hmmm, this means some kind of nesting is going on, urgh
+                               advice.lastReportedMonitorExitJoinpointLocation = shadow.getSourceLocation();
+                       }
+               }
+
+               String description = advice.getKind().toString();
+               String advisedType = shadow.getEnclosingType().getName();
+               String advisingType = advice.getConcreteAspect().getName();
+               Message msg = null;
+               if (advice.getKind().equals(AdviceKind.Softener)) {
+                       msg = WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_SOFTENS, new String[] { advisedType,
+                                       beautifyLocation(shadow.getSourceLocation()), advisingType, beautifyLocation(munger.getSourceLocation()) },
+                                       advisedType, advisingType);
+               } else {
+                       boolean runtimeTest = advice.hasDynamicTests();
+                       String joinPointDescription = shadow.toString();
+                       msg = WeaveMessage.constructWeavingMessage(WeaveMessage.WEAVEMESSAGE_ADVISES, new String[] { joinPointDescription,
+                                       advisedType, beautifyLocation(shadow.getSourceLocation()), description, advisingType,
+                                       beautifyLocation(munger.getSourceLocation()), (runtimeTest ? " [with runtime test]" : "") }, advisedType,
+                                       advisingType);
+                       // Boolean.toString(runtimeTest)});
+               }
+               getMessageHandler().handleMessage(msg);
+       }
+
+       private boolean areTheSame(ISourceLocation locA, ISourceLocation locB) {
+               if (locA == null)
+                       return locB == null;
+               if (locB == null)
+                       return false;
+               if (locA.getLine() != locB.getLine())
+                       return false;
+               File fA = locA.getSourceFile();
+               File fB = locA.getSourceFile();
+               if (fA == null)
+                       return fB == null;
+               if (fB == null)
+                       return false;
+               return fA.getName().equals(fB.getName());
+       }
+
+       /*
+        * Ensure we report a nice source location - particular in the case where the source info is missing (binary weave).
+        */
+       private String beautifyLocation(ISourceLocation isl) {
+               StringBuffer nice = new StringBuffer();
+               if (isl == null || isl.getSourceFile() == null || isl.getSourceFile().getName().indexOf("no debug info available") != -1) {
+                       nice.append("no debug info available");
+               } else {
+                       // can't use File.getName() as this fails when a Linux box encounters a path created on Windows and vice-versa
+                       int takeFrom = isl.getSourceFile().getPath().lastIndexOf('/');
+                       if (takeFrom == -1) {
+                               takeFrom = isl.getSourceFile().getPath().lastIndexOf('\\');
+                       }
+                       int binary = isl.getSourceFile().getPath().lastIndexOf('!');
+                       if (binary != -1 && binary < takeFrom) {
+                               // we have been woven by a binary aspect
+                               String pathToBinaryLoc = isl.getSourceFile().getPath().substring(0, binary + 1);
+                               if (pathToBinaryLoc.indexOf(".jar") != -1) {
+                                       // only want to add the extra info if we're from a jar file
+                                       int lastSlash = pathToBinaryLoc.lastIndexOf('/');
+                                       if (lastSlash == -1) {
+                                               lastSlash = pathToBinaryLoc.lastIndexOf('\\');
+                                       }
+                                       nice.append(pathToBinaryLoc.substring(lastSlash + 1));
+                               }
+                       }
+                       nice.append(isl.getSourceFile().getPath().substring(takeFrom + 1));
+                       if (isl.getLine() != 0)
+                               nice.append(":").append(isl.getLine());
+                       // if it's a binary file then also want to give the file name
+                       if (isl.getSourceFileName() != null)
+                               nice.append("(from " + isl.getSourceFileName() + ")");
+               }
+               return nice.toString();
+       }
+
        private static List makeDefaultClasspath(String cp) {
                List classPath = new ArrayList();
                classPath.addAll(getPathEntries(cp));
@@ -393,9 +555,8 @@ public class BcelWorld extends World implements Repository {
        }
 
        /**
-        * Retrieve a bcel delegate for an aspect - this will return NULL if the
-        * delegate is an EclipseSourceType and not a BcelObjectType - this happens
-        * quite often when incrementally compiling.
+        * Retrieve a bcel delegate for an aspect - this will return NULL if the delegate is an EclipseSourceType and not a
+        * BcelObjectType - this happens quite often when incrementally compiling.
         */
        public static BcelObjectType getBcelObjectType(ResolvedType concreteAspect) {
                ReferenceTypeDelegate rtDelegate = ((ReferenceType) concreteAspect).getDelegate();
@@ -442,9 +603,8 @@ public class BcelWorld extends World implements Repository {
        }
 
        /**
-        * The aim of this method is to make sure a particular type is 'ok'. Some
-        * operations on the delegate for a type modify it and this method is
-        * intended to undo that... see pr85132
+        * The aim of this method is to make sure a particular type is 'ok'. Some operations on the delegate for a type modify it and
+        * this method is intended to undo that... see pr85132
         */
        public void validateType(UnresolvedType type) {
                ResolvedType result = typeMap.get(type.getSignature());
@@ -524,8 +684,8 @@ public class BcelWorld extends World implements Repository {
        }
 
        /**
-        * Checks for an @target() on the annotation and if found ensures it allows
-        * the annotation to be attached to the target type that matched.
+        * Checks for an @target() on the annotation and if found ensures it allows the annotation to be attached to the target type
+        * that matched.
         */
        private boolean checkTargetOK(DeclareAnnotation decA, ResolvedType onType, AnnotationAJ annoX) {
                if (annoX.specifiesTarget()) {
@@ -601,4 +761,23 @@ public class BcelWorld extends World implements Repository {
                return bcelWeavingSupport;
        }
 
+       public void reportCheckerMatch(Checker checker, Shadow shadow) {
+               IMessage iMessage = new Message(checker.getMessage(), shadow.toString(), checker.isError() ? IMessage.ERROR
+                               : IMessage.WARNING, shadow.getSourceLocation(), null, new ISourceLocation[] { checker.getSourceLocation() }, true,
+                               0, -1, -1);
+
+               getMessageHandler().handleMessage(iMessage);
+
+               if (getCrossReferenceHandler() != null) {
+                       getCrossReferenceHandler().addCrossReference(checker.getSourceLocation(), shadow.getSourceLocation(),
+                                       (checker.isError() ? IRelationship.Kind.DECLARE_ERROR : IRelationship.Kind.DECLARE_WARNING), false);
+
+               }
+
+               if (getModel() != null) {
+                       AsmRelationshipProvider.checkerMunger(getModel(), shadow, checker);
+               }
+
+       }
+
 }
\ No newline at end of file
index 9d10f0ab4a6ad8eb17992222805fd919e3b8a21f..6035eee39dfeebf3a6b148dab48a699b4a3f0668 100644 (file)
@@ -12,6 +12,9 @@
 
 package org.aspectj.weaver.model;
 
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
 import java.util.Iterator;
 
 import org.aspectj.asm.AsmManager;
@@ -28,13 +31,14 @@ import org.aspectj.weaver.Checker;
 import org.aspectj.weaver.Lint;
 import org.aspectj.weaver.Member;
 import org.aspectj.weaver.ResolvedMember;
+import org.aspectj.weaver.ResolvedPointcutDefinition;
 import org.aspectj.weaver.ResolvedType;
 import org.aspectj.weaver.ResolvedTypeMunger;
 import org.aspectj.weaver.Shadow;
 import org.aspectj.weaver.ShadowMunger;
 import org.aspectj.weaver.UnresolvedType;
 import org.aspectj.weaver.World;
-import org.aspectj.weaver.Lint.Kind;
+import org.aspectj.weaver.patterns.DeclareErrorOrWarning;
 
 public class AsmRelationshipProvider {
 
@@ -54,14 +58,14 @@ public class AsmRelationshipProvider {
        public static final String ANNOTATES = "annotates";
        public static final String ANNOTATED_BY = "annotated by";
 
-       public void checkerMunger(AsmManager asm, Shadow shadow, Checker checker) {
+       public static void checkerMunger(AsmManager asm, Shadow shadow, Checker checker) {
                if (asm == null) // !AsmManager.isCreatingModel())
                        return;
                if (shadow.getSourceLocation() == null || checker.getSourceLocation() == null)
                        return;
 
                if (World.createInjarHierarchy) {
-                       checker.createHierarchy(asm);
+                       createHierarchy(asm, checker);
                }
 
                // Ensure a node for the target exists
@@ -187,7 +191,166 @@ public class AsmRelationshipProvider {
                }
        }
 
-       public void adviceMunger(AsmManager asm, Shadow shadow, ShadowMunger munger) {
+       /**
+        * Creates the hierarchy for binary aspects
+        */
+       public static void createHierarchy(AsmManager asm, ShadowMunger munger) {
+               if (!munger.isBinary())
+                       return;
+
+               IProgramElement sourceFileNode = asm.getHierarchy().findElementForSourceLine(munger.getSourceLocation());
+               // the call to findElementForSourceLine(ISourceLocation) returns a file
+               // node
+               // if it can't find a node in the hierarchy for the given
+               // sourcelocation.
+               // Therefore, if this is returned, we know we can't find one and have to
+               // continue to fault in the model.
+               if (!sourceFileNode.getKind().equals(IProgramElement.Kind.FILE_JAVA)) {
+                       return;
+               }
+
+               ResolvedType aspect = munger.getDeclaringType();
+
+               // create the class file node
+               IProgramElement classFileNode = new ProgramElement(asm, sourceFileNode.getName(), IProgramElement.Kind.FILE, munger
+                               .getBinarySourceLocation(aspect.getSourceLocation()), 0, null, null);
+
+               // create package ipe if one exists....
+               IProgramElement root = asm.getHierarchy().getRoot();
+               IProgramElement binaries = asm.getHierarchy().findElementForLabel(root, IProgramElement.Kind.SOURCE_FOLDER, "binaries");
+               if (binaries == null) {
+                       binaries = new ProgramElement(asm, "binaries", IProgramElement.Kind.SOURCE_FOLDER, new ArrayList());
+                       root.addChild(binaries);
+               }
+               // if (aspect.getPackageName() != null) {
+               String packagename = aspect.getPackageName() == null ? "" : aspect.getPackageName();
+               // check that there doesn't already exist a node with this name
+               IProgramElement pkgNode = asm.getHierarchy().findElementForLabel(binaries, IProgramElement.Kind.PACKAGE, packagename);
+               // note packages themselves have no source location
+               if (pkgNode == null) {
+                       pkgNode = new ProgramElement(asm, packagename, IProgramElement.Kind.PACKAGE, new ArrayList());
+                       binaries.addChild(pkgNode);
+                       pkgNode.addChild(classFileNode);
+               } else {
+                       // need to add it first otherwise the handle for classFileNode
+                       // may not be generated correctly if it uses information from
+                       // it's parent node
+                       pkgNode.addChild(classFileNode);
+                       for (Iterator iter = pkgNode.getChildren().iterator(); iter.hasNext();) {
+                               IProgramElement element = (IProgramElement) iter.next();
+                               if (!element.equals(classFileNode) && element.getHandleIdentifier().equals(classFileNode.getHandleIdentifier())) {
+                                       // already added the classfile so have already
+                                       // added the structure for this aspect
+                                       pkgNode.removeChild(classFileNode);
+                                       return;
+                               }
+                       }
+               }
+               // } else {
+               // // need to add it first otherwise the handle for classFileNode
+               // // may not be generated correctly if it uses information from
+               // // it's parent node
+               // root.addChild(classFileNode);
+               // for (Iterator iter = root.getChildren().iterator(); iter.hasNext();) {
+               // IProgramElement element = (IProgramElement) iter.next();
+               // if (!element.equals(classFileNode) && element.getHandleIdentifier().equals(classFileNode.getHandleIdentifier())) {
+               // // already added the sourcefile so have already
+               // // added the structure for this aspect
+               // root.removeChild(classFileNode);
+               // return;
+               // }
+               // }
+               // }
+
+               // add and create empty import declaration ipe
+               classFileNode.addChild(new ProgramElement(asm, "import declarations", IProgramElement.Kind.IMPORT_REFERENCE, null, 0, null,
+                               null));
+
+               // add and create aspect ipe
+               IProgramElement aspectNode = new ProgramElement(asm, aspect.getSimpleName(), IProgramElement.Kind.ASPECT, munger
+                               .getBinarySourceLocation(aspect.getSourceLocation()), aspect.getModifiers(), null, null);
+               classFileNode.addChild(aspectNode);
+
+               addChildNodes(asm, munger, aspectNode, aspect.getDeclaredPointcuts());
+
+               addChildNodes(asm, munger, aspectNode, aspect.getDeclaredAdvice());
+               addChildNodes(asm, munger, aspectNode, aspect.getDeclares());
+       }
+
+       private static void addChildNodes(AsmManager asm, ShadowMunger munger, IProgramElement parent, ResolvedMember[] children) {
+               for (int i = 0; i < children.length; i++) {
+                       ResolvedMember pcd = children[i];
+                       if (pcd instanceof ResolvedPointcutDefinition) {
+                               ResolvedPointcutDefinition rpcd = (ResolvedPointcutDefinition) pcd;
+                               ISourceLocation sLoc = rpcd.getPointcut().getSourceLocation();
+                               if (sLoc == null) {
+                                       sLoc = rpcd.getSourceLocation();
+                               }
+                               parent.addChild(new ProgramElement(asm, pcd.getName(), IProgramElement.Kind.POINTCUT, munger
+                                               .getBinarySourceLocation(sLoc), pcd.getModifiers(), null, Collections.EMPTY_LIST));
+                       }
+               }
+       }
+
+       private static void addChildNodes(AsmManager asm, ShadowMunger munger, IProgramElement parent, Collection children) {
+               int deCtr = 1;
+               int dwCtr = 1;
+               for (Iterator iter = children.iterator(); iter.hasNext();) {
+                       Object element = iter.next();
+                       if (element instanceof DeclareErrorOrWarning) {
+                               DeclareErrorOrWarning decl = (DeclareErrorOrWarning) element;
+                               int counter = 0;
+                               if (decl.isError()) {
+                                       counter = deCtr++;
+                               } else {
+                                       counter = dwCtr++;
+                               }
+                               parent.addChild(createDeclareErrorOrWarningChild(asm, munger, decl, counter));
+                       } else if (element instanceof Advice) {
+                               Advice advice = (Advice) element;
+                               parent.addChild(createAdviceChild(asm, advice));
+                       }
+               }
+       }
+
+       private static IProgramElement createDeclareErrorOrWarningChild(AsmManager asm, ShadowMunger munger,
+                       DeclareErrorOrWarning decl, int count) {
+               IProgramElement deowNode = new ProgramElement(asm, decl.getName(), decl.isError() ? IProgramElement.Kind.DECLARE_ERROR
+                               : IProgramElement.Kind.DECLARE_WARNING, munger.getBinarySourceLocation(decl.getSourceLocation()), decl
+                               .getDeclaringType().getModifiers(), null, null);
+               deowNode.setDetails("\"" + AsmRelationshipUtils.genDeclareMessage(decl.getMessage()) + "\"");
+               if (count != -1) {
+                       deowNode.setBytecodeName(decl.getName() + "_" + count);
+               }
+               return deowNode;
+       }
+
+       private static IProgramElement createAdviceChild(AsmManager asm, Advice advice) {
+               IProgramElement adviceNode = new ProgramElement(asm, advice.getKind().getName(), IProgramElement.Kind.ADVICE, advice
+                               .getBinarySourceLocation(advice.getSourceLocation()), advice.getSignature().getModifiers(), null,
+                               Collections.EMPTY_LIST);
+               adviceNode.setDetails(AsmRelationshipUtils.genPointcutDetails(advice.getPointcut()));
+               adviceNode.setBytecodeName(advice.getSignature().getName());
+               // String nn = advice.getSignature().getName();
+               // if (counter != 1) {
+               // adviceNode.setBytecodeName(advice.getKind().getName() + "$"
+               // + counter + "$");
+               // }
+               return adviceNode;
+       }
+
+       public static String getHandle(Advice advice, AsmManager asm) {
+               if (null == advice.handle) {
+                       ISourceLocation sl = advice.getSourceLocation();
+                       if (sl != null) {
+                               IProgramElement ipe = asm.getHierarchy().findElementForSourceLine(sl);
+                               advice.handle = asm.getHandleProvider().createHandleIdentifier(ipe);
+                       }
+               }
+               return advice.handle;
+       }
+
+       public static void adviceMunger(AsmManager asm, Shadow shadow, ShadowMunger munger) {
                if (asm == null) // !AsmManager.isCreatingModel())
                        return;
                if (munger instanceof Advice) {
@@ -199,7 +362,7 @@ public class AsmRelationshipProvider {
                        }
 
                        if (World.createInjarHierarchy) {
-                               munger.createHierarchy(asm);
+                               createHierarchy(asm, advice);
                        }
 
                        IRelationshipMap mapper = asm.getRelationshipMap();
@@ -211,7 +374,7 @@ public class AsmRelationshipProvider {
                        // Work out extra info to inform interested UIs !
                        IProgramElement.ExtraInformation ai = new IProgramElement.ExtraInformation();
 
-                       String adviceHandle = advice.getHandle(asm);
+                       String adviceHandle = getHandle(advice, asm);
                        if (adviceHandle == null)
                                return;
 
@@ -252,7 +415,7 @@ public class AsmRelationshipProvider {
                }
        }
 
-       protected IProgramElement getNode(AsmManager model, Shadow shadow) {
+       protected static IProgramElement getNode(AsmManager model, Shadow shadow) {
                Member enclosingMember = shadow.getEnclosingCodeSignature();
 
                IProgramElement enclosingNode = lookupMember(model.getHierarchy(), enclosingMember);
@@ -274,7 +437,7 @@ public class AsmRelationshipProvider {
                }
        }
 
-       private boolean sourceLinesMatch(ISourceLocation loc1, ISourceLocation loc2) {
+       private static boolean sourceLinesMatch(ISourceLocation loc1, ISourceLocation loc2) {
                if (loc1.getLine() != loc2.getLine())
                        return false;
                return true;
@@ -292,7 +455,8 @@ public class AsmRelationshipProvider {
         * consistent over incremental builds. All aspects are compiled up front and any new aspect created will force a full build.
         * Moreover, if the body of the enclosingShadow is changed, then the model for this is rebuilt from scratch.
         */
-       private IProgramElement findOrCreateCodeNode(AsmManager asm, IProgramElement enclosingNode, Member shadowSig, Shadow shadow) {
+       private static IProgramElement findOrCreateCodeNode(AsmManager asm, IProgramElement enclosingNode, Member shadowSig,
+                       Shadow shadow) {
                for (Iterator it = enclosingNode.getChildren().iterator(); it.hasNext();) {
                        IProgramElement node = (IProgramElement) it.next();
                        int excl = node.getBytecodeName().lastIndexOf('!');
@@ -329,13 +493,13 @@ public class AsmRelationshipProvider {
                return peNode;
        }
 
-       protected IProgramElement lookupMember(IHierarchy model, Member member) {
+       protected static IProgramElement lookupMember(IHierarchy model, Member member) {
                UnresolvedType declaringType = member.getDeclaringType();
                IProgramElement classNode = model.findElementForType(declaringType.getPackageName(), declaringType.getClassName());
                return findMemberInClass(classNode, member);
        }
 
-       protected IProgramElement findMemberInClass(IProgramElement classNode, Member member) {
+       protected static IProgramElement findMemberInClass(IProgramElement classNode, Member member) {
                if (classNode == null)
                        return null; // XXX remove this check
                for (Iterator it = classNode.getChildren().iterator(); it.hasNext();) {