From 8152279f8751b7f3222705f4560837e72337b7df Mon Sep 17 00:00:00 2001 From: aclement Date: Thu, 10 Nov 2005 14:15:48 +0000 Subject: [PATCH] fix for binary weaving declare parents that involve parameterized times when requiring changes to super calls (phew) --- .../aspectj/weaver/bcel/BcelTypeMunger.java | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java index 6f92b5c03..4f219457d 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -384,6 +384,7 @@ public class BcelTypeMunger extends ConcreteTypeMunger { */ public boolean attemptToModifySuperCalls(BcelClassWeaver weaver,LazyClassGen newParentTarget, ResolvedType newParent) { String currentParent = newParentTarget.getSuperClassname(); + if (newParent.getGenericType()!=null) newParent = newParent.getGenericType(); // target new super calls at the generic type if its raw or parameterized List mgs = newParentTarget.getMethodGens(); // Look for ctors to modify @@ -1402,11 +1403,9 @@ public class BcelTypeMunger extends ConcreteTypeMunger { private boolean mungeNewField(BcelClassWeaver weaver, NewFieldTypeMunger munger) { /*ResolvedMember initMethod = */munger.getInitMethod(aspectType); - LazyClassGen gen = weaver.getLazyClassGen(); ResolvedMember field = munger.getSignature(); - ResolvedType onType = weaver.getWorld().resolve(field.getDeclaringType(),munger.getSourceLocation()); if (onType.isRawType()) onType = onType.getGenericType(); @@ -1422,7 +1421,6 @@ public class BcelTypeMunger extends ConcreteTypeMunger { return false; } - ResolvedMember interMethodBody = munger.getInitMethod(aspectType); AnnotationX annotationsOnRealMember[] = null; @@ -1471,25 +1469,26 @@ public class BcelTypeMunger extends ConcreteTypeMunger { if (field.isStatic()) throw new RuntimeException("unimplemented"); weaver.addInitializer(this); //System.err.println("impl body on " + gen.getType() + " for " + munger); + + Type fieldType = BcelWorld.makeBcelType(field.getType()); - + FieldGen fg = makeFieldGen(gen,AjcMemberMaker.interFieldInterfaceField(field, onType, aspectType)); - - - if (annotationsOnRealMember!=null) { - for (int i = 0; i < annotationsOnRealMember.length; i++) { - AnnotationX annotationX = annotationsOnRealMember[i]; - Annotation a = annotationX.getBcelAnnotation(); - AnnotationGen ag = new AnnotationGen(a,weaver.getLazyClassGen().getConstantPoolGen(),true); - fg.addAnnotation(ag); + + if (annotationsOnRealMember!=null) { + for (int i = 0; i < annotationsOnRealMember.length; i++) { + AnnotationX annotationX = annotationsOnRealMember[i]; + Annotation a = annotationX.getBcelAnnotation(); + AnnotationGen ag = new AnnotationGen(a,weaver.getLazyClassGen().getConstantPoolGen(),true); + fg.addAnnotation(ag); + } } - } - - gen.addField(fg.getField(),getSourceLocation()); + + gen.addField(fg.getField(),getSourceLocation()); //this uses a shadow munger to add init method to constructors //weaver.getShadowMungers().add(makeInitCallShadowMunger(initMethod)); - - ResolvedMember itdfieldGetter = AjcMemberMaker.interFieldInterfaceGetter(field, gen.getType()/*onType*/, aspectType); + + ResolvedMember itdfieldGetter = AjcMemberMaker.interFieldInterfaceGetter(field, gen.getType()/*onType*/, aspectType); LazyMethodGen mg = makeMethodGen(gen, itdfieldGetter); InstructionList il = new InstructionList(); InstructionFactory fact = gen.getFactory(); -- 2.39.5