]> source.dussan.org Git - aspectj.git/commitdiff
164016, 258788: test and fix
authoraclement <aclement>
Tue, 6 Jan 2009 23:53:55 +0000 (23:53 +0000)
committeraclement <aclement>
Tue, 6 Jan 2009 23:53:55 +0000 (23:53 +0000)
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java
weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java

index c20334350cd8a19fb7b2c899808a3d689bbdd524..413c71c2e3e319707a01fa49a2d98ab7423b560c 100644 (file)
@@ -744,14 +744,10 @@ public class AtAjAttributes {
                                                        // 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());
-                                                        */
+                                                       // the right field. See pr164016.
                                                        MethodDelegateTypeMunger mdtm = new MethodDelegateTypeMunger(method, struct.enclosingType,
                                                                        defaultImplClassName, typePattern);
+                                                       mdtm.setFieldType(fieldType);
                                                        mdtm.setSourceLocation(struct.enclosingType.getSourceLocation());
                                                        struct.ajAttributes.add(new AjAttribute.TypeMunger(mdtm));
                                                }
@@ -759,9 +755,9 @@ public class AtAjAttributes {
                                        // successfull so far, we thus need a bcel type munger to have
                                        // a field hosting the mixin in the target type
                                        if (hasAtLeastOneMethod && defaultImplClassName != null) {
+                                               ResolvedMember fieldHost = AjcMemberMaker.itdAtDeclareParentsField(null, fieldType, struct.enclosingType);
                                                struct.ajAttributes.add(new AjAttribute.TypeMunger(new MethodDelegateTypeMunger.FieldHostTypeMunger(
-                                                               AjcMemberMaker.itdAtDeclareParentsField(null,// prototyped
-                                                                               fieldType, struct.enclosingType), struct.enclosingType, typePattern)));
+                                                               fieldHost, struct.enclosingType, typePattern)));
                                        }
 
                                        return true;
index 524fa1e28142ce60f1f27e5aa560f24a04c291e4..d34571af20c164bdb651fcb48d1f52c07456604d 100644 (file)
@@ -90,7 +90,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
                        changed = mungeNewField(weaver, (NewFieldTypeMunger) munger);
                } else if (munger.getKind() == ResolvedTypeMunger.Method) {
                        changed = mungeNewMethod(weaver, (NewMethodTypeMunger) munger);
-               } else if (munger.getKind() == ResolvedTypeMunger.MethodDelegate) {
+               } else if (munger.getKind() == ResolvedTypeMunger.MethodDelegate2) {
                        changed = mungeMethodDelegate(weaver, (MethodDelegateTypeMunger) munger);
                } else if (munger.getKind() == ResolvedTypeMunger.FieldHost) {
                        changed = mungeFieldHost(weaver, (MethodDelegateTypeMunger.FieldHostTypeMunger) munger);
@@ -302,7 +302,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger {
                                                                                satisfiedByITD = true;
                                                                        }
                                                                }
-                                                       } else if (m.getMunger() != null && m.getMunger().getKind() == ResolvedTypeMunger.MethodDelegate) {
+                                                       } else if (m.getMunger() != null && m.getMunger().getKind() == ResolvedTypeMunger.MethodDelegate2) {
                                                                satisfiedByITD = true;// AV - that should be
                                                                // enough, no need to
                                                                // check more