From 024421468c163588ec7d2d2d5dfa13b8dea4bb1e Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 4 Dec 2008 16:29:18 +0000 Subject: [PATCH] commented out solution to mixin problem --- .../aspectj/weaver/bcel/AtAjAttributes.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java index be2bc45e8..36c1ee6f1 100644 --- a/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java +++ b/weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java @@ -52,6 +52,7 @@ import org.aspectj.weaver.MethodDelegateTypeMunger; import org.aspectj.weaver.NameMangler; import org.aspectj.weaver.ReferenceType; import org.aspectj.weaver.ResolvedMember; +import org.aspectj.weaver.ResolvedMemberImpl; import org.aspectj.weaver.ResolvedPointcutDefinition; import org.aspectj.weaver.ResolvedType; import org.aspectj.weaver.UnresolvedType; @@ -711,8 +712,21 @@ public class AtAjAttributes { // return false; // } hasAtLeastOneMethod = true; - MethodDelegateTypeMunger mdtm = new MethodDelegateTypeMunger(method, struct.enclosingType, - defaultImplClassName, typePattern); + // What we are saying here: + // We have this method 'method' and we want to put a forwarding method into a type that matches + // typePattern that should delegate to the version of the method in 'defaultImplClassName' + + // Now the method may be from a supertype but the declaring type of the method we pass into the type + // munger is what is used to determine the type of the field that hosts the delegate instance. + // So here we create a modified method with an alternative declaring type so that we lookup + // the right field. See pr164016. Generics will probably break this horribly +/* + ResolvedMemberImpl methodWithAlteredDeclaringType = new ResolvedMemberImpl(method.getKind(), fieldType, + method.getModifiers(), method.getReturnType(), method.getName(), method.getParameterTypes(), + method.getExceptions()); +*/ + MethodDelegateTypeMunger mdtm = new MethodDelegateTypeMunger(method, + struct.enclosingType, defaultImplClassName, typePattern); mdtm.setSourceLocation(struct.enclosingType.getSourceLocation()); struct.ajAttributes.add(new AjAttribute.TypeMunger(mdtm)); } -- 2.39.5