From f2b05dfae18ecb754c4cb963bfef2e54ef5bafe9 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 2 Nov 2009 17:59:47 +0000 Subject: [PATCH] generics --- .../aspectj/weaver/ResolvedMemberImpl.java | 25 ++++--------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java index 0c62fa7f2..9120ab045 100644 --- a/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java +++ b/org.aspectj.matcher/src/org/aspectj/weaver/ResolvedMemberImpl.java @@ -127,8 +127,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno accumulateTypesInBetween(originalDeclaringType, firstDefiningType, declaringTypes); Set memberSignatures = new HashSet(); for (ResolvedType declaringType : declaringTypes) { - ResolvedMember member = firstDefiningMember.withSubstituteDeclaringType(declaringType); - memberSignatures.add(member); + memberSignatures.add(new JoinPointSignature(firstDefiningMember, declaringType)); } if (shouldWalkUpHierarchyFor(firstDefiningMember)) { @@ -137,7 +136,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno // every type between the firstDefiningMember and the root defining // member. Iterator superTypeIterator = firstDefiningType.getDirectSupertypes(); - List typesAlreadyVisited = new ArrayList(); + List typesAlreadyVisited = new ArrayList(); accumulateMembersMatching(firstDefiningMember, superTypeIterator, typesAlreadyVisited, memberSignatures, false); } @@ -196,8 +195,7 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno accumulateTypesInBetween(toLookIn, resolvedDeclaringType, declaringTypes); for (ResolvedType declaringType : declaringTypes) { // typesAlreadyVisited.add(declaringType); - ResolvedMember member = foundMember.withSubstituteDeclaringType(declaringType); - foundMembers.add(member); + foundMembers.add(new JoinPointSignature(foundMember, declaringType)); } if (!ignoreGenerics && toLookIn.isParameterizedType() && (foundMember.backingGenericMember != null)) { foundMembers.add(new JoinPointSignature(foundMember.backingGenericMember, foundMember.declaringType @@ -919,31 +917,18 @@ public class ResolvedMemberImpl extends MemberImpl implements IHasPosition, Anno returnType = UnresolvedType.OBJECTARRAY; } - /** - * Returns a copy of this member but with the declaring type swapped. Copy only needs to be shallow. - * - * @param newDeclaringType - */ - public JoinPointSignature withSubstituteDeclaringType(ResolvedType newDeclaringType) { - JoinPointSignature ret = new JoinPointSignature(this, newDeclaringType); - return ret; - } - /** * Returns true if this member matches the other. The matching takes into account name and parameter types only. When comparing * parameter types, we allow any type variable to match any other type variable regardless of bounds. */ public boolean matches(ResolvedMember aCandidateMatch, boolean ignoreGenerics) { - // if (this.getName().equals("get")) { - // System.out.println("In RMI.matches() this=" + this + " candidate=" + aCandidateMatch); - // } ResolvedMemberImpl candidateMatchImpl = (ResolvedMemberImpl) aCandidateMatch; if (!getName().equals(aCandidateMatch.getName())) { return false; } - UnresolvedType[] myParameterTypes = getGenericParameterTypes(); + UnresolvedType[] parameterTypes = getGenericParameterTypes(); UnresolvedType[] candidateParameterTypes = aCandidateMatch.getGenericParameterTypes(); - if (myParameterTypes.length != candidateParameterTypes.length) { + if (parameterTypes.length != candidateParameterTypes.length) { return false; } boolean b = false; -- 2.39.5