From 33a2182c54c63d67dab2bd28215fd05de9958d15 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 2 Nov 2009 17:49:58 +0000 Subject: [PATCH] 293620: --- .../weaver/JoinPointSignatureIterator.java | 38 +++++++++---------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignatureIterator.java b/org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignatureIterator.java index b2a057c51..fbade1212 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignatureIterator.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/JoinPointSignatureIterator.java @@ -26,9 +26,10 @@ import java.util.Set; */ public class JoinPointSignatureIterator implements Iterator { + ResolvedType firstDefiningType; + private Member signaturesOfMember; private ResolvedMember firstDefiningMember; - ResolvedType firstDefiningType; private World world; private List discoveredSignatures = new ArrayList(); private List additionalSignatures = Collections.emptyList(); @@ -86,9 +87,10 @@ public class JoinPointSignatureIterator implements Iterator throw new UnsupportedOperationException("can't remove from JoinPointSignatureIterator"); } + /** + * Walk up the hierarchy creating one member for each type up to and including the first defining type. + */ private void addSignaturesUpToFirstDefiningMember() { - // Walk up hierarchy creating one member for each type up to and including the - // first defining type ResolvedType originalDeclaringType = signaturesOfMember.getDeclaringType().resolve(world); ResolvedType superType = originalDeclaringType.getSuperclass(); if (superType != null && superType.equals(jlrProxy)) { @@ -97,9 +99,8 @@ public class JoinPointSignatureIterator implements Iterator isProxy = true; } - if (world.isJoinpointArrayConstructionEnabled() && originalDeclaringType.isArray()) { // Aha, this must be the array - // constructor call join point - a - // 'special'... + // is it the array constructor join point? + if (world.isJoinpointArrayConstructionEnabled() && originalDeclaringType.isArray()) { Member m = signaturesOfMember; ResolvedMember rm = new ResolvedMemberImpl(m.getKind(), m.getDeclaringType(), m.getModifiers(), m.getReturnType(), m .getName(), m.getParameterTypes()); @@ -140,13 +141,13 @@ public class JoinPointSignatureIterator implements Iterator /** * Build a list containing every type between subtype and supertype, inclusively. */ - private void accumulateTypesInBetween(ResolvedType subType, ResolvedType superType, List types) { + private void accumulateTypesInBetween(ResolvedType subType, ResolvedType superType, List types) { types.add(subType); if (subType == superType) { return; } else { - for (Iterator iter = subType.getDirectSupertypes(); iter.hasNext();) { - ResolvedType parent = (ResolvedType) iter.next(); + for (Iterator iter = subType.getDirectSupertypes(); iter.hasNext();) { + ResolvedType parent = iter.next(); if (superType.isAssignableFrom(parent, true)) { accumulateTypesInBetween(parent, superType, types); } @@ -175,7 +176,7 @@ public class JoinPointSignatureIterator implements Iterator if (superTypeIterator.hasNext()) { ResolvedType superType = superTypeIterator.next(); if (isProxy && (superType.isGenericType() || superType.isParameterizedType())) { - superType = (ResolvedType) superType.getRawType(); + superType = superType.getRawType(); } if (visitedSuperTypes.contains(superType)) { return findSignaturesFromSupertypes(); @@ -190,24 +191,21 @@ public class JoinPointSignatureIterator implements Iterator ResolvedMemberImpl foundMember = (ResolvedMemberImpl) superType.lookupResolvedMember(firstDefiningMember, true, isProxy); if (foundMember != null && isVisibleTo(firstDefiningMember, foundMember)) { - List declaringTypes = new ArrayList(); + List declaringTypes = new ArrayList(); // declaring type can be unresolved if the member can from an ITD... ResolvedType resolvedDeclaringType = foundMember.getDeclaringType().resolve(world); accumulateTypesInBetween(superType, resolvedDeclaringType, declaringTypes); - for (Iterator iter = declaringTypes.iterator(); iter.hasNext();) { - ResolvedType declaringType = (ResolvedType) iter.next(); + for (ResolvedType declaringType : declaringTypes) { JoinPointSignature member = null; if (isProxy) { if (declaringType.isGenericType() || declaringType.isParameterizedType()) { - declaringType = (ResolvedType) declaringType.getRawType(); + declaringType = declaringType.getRawType(); } - member = foundMember.withSubstituteDeclaringType(declaringType); - } else { - member = foundMember.withSubstituteDeclaringType(declaringType); } + member = new JoinPointSignature(foundMember, declaringType); discoveredSignatures.add(member); // for next time we are reset if (additionalSignatures == Collections.EMPTY_LIST) { - additionalSignatures = new ArrayList(); + additionalSignatures = new ArrayList(); } additionalSignatures.add(member); // for this time } @@ -217,12 +215,12 @@ public class JoinPointSignatureIterator implements Iterator foundMember.declaringType.resolve(world)); discoveredSignatures.add(member); // for next time we are reset if (additionalSignatures == Collections.EMPTY_LIST) { - additionalSignatures = new ArrayList(); + additionalSignatures = new ArrayList(); } additionalSignatures.add(member); // for this time } if (yetToBeProcessedSuperMembers == null) { - yetToBeProcessedSuperMembers = new ArrayList(); + yetToBeProcessedSuperMembers = new ArrayList(); } yetToBeProcessedSuperMembers.add(new SearchPair(foundMember, superType)); return true; -- 2.39.5