From 999d3836f0b541f619f50580d2aca8316485ecb7 Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 9 May 2011 22:41:38 +0000 Subject: [PATCH] 345172 --- .../aspectj/weaver/bcel/BcelClassWeaver.java | 37 +++++++++++++++++-- 1 file changed, 33 insertions(+), 4 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java index ffb0469ed..57fb89a97 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -2897,6 +2897,37 @@ class BcelClassWeaver implements IClassWeaver { return null; } + /** + * Find the specified member in the specified type. + * + * @param type the type to search for the member + * @param methodName the name of the method to find + * @param Class[] the method parameters that the discovered method should have + */ + private ResolvedMember findResolvedMemberNamed(ResolvedType type, String methodName, UnresolvedType[] params) { + ResolvedMember[] allMethods = type.getDeclaredMethods(); + for (int i = 0; i < allMethods.length; i++) { + ResolvedMember candidate = allMethods[i]; + if (candidate.getName().equals(methodName)) { + UnresolvedType[] candidateParams = candidate.getParameterTypes(); + if (candidateParams.length == params.length) { + // boolean allOK = true; // this checking all breaks down with generics in the mix, unfortunately, dont have + // time to fix it up right now + // for (int p = 0; p < candidateParams.length; p++) { + // if (!candidateParams[p].getErasureSignature().equals(params[p].getErasureSignature())) { + // allOK = false; + // break; + // } + // } + // if (allOK) { + return candidate; + // } + } + } + } + return null; + } + /** * For a given resolvedmember, this will discover the real annotations for it. Should only be used when the resolvedmember is * the contents of an effective signature attribute, as thats the only time when the annotations aren't stored directly in the @@ -2963,10 +2994,8 @@ class BcelClassWeaver implements IClassWeaver { } else { ResolvedMember realthing = AjcMemberMaker.interMethodDispatcher(rm.resolve(world), memberHostType).resolve( world); - // ResolvedMember resolvedDooberry = - // world.resolve(realthing); - ResolvedMember theRealMember = findResolvedMemberNamed(memberHostType.resolve(world), realthing.getName()); - // AMC temp guard for M4 + ResolvedMember theRealMember = findResolvedMemberNamed(memberHostType.resolve(world), realthing.getName(), + realthing.getParameterTypes()); if (theRealMember == null) { throw new UnsupportedOperationException( "Known limitation in M4 - can't find ITD members when type variable is used as an argument and has upper bound specified"); -- 2.39.5