From 211806608a60557fb6180d55f9c9802a79ab490d Mon Sep 17 00:00:00 2001 From: aclement Date: Mon, 8 Aug 2005 09:54:54 +0000 Subject: Fix for pr98901: copying annotations to new members created via ITD !! --- .../internal/compiler/ast/InterTypeMethodDeclaration.java | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'org.aspectj.ajdt.core') diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java index 21c5f2106..cac14243d 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/InterTypeMethodDeclaration.java @@ -156,9 +156,10 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration { classFile.extraAttributes.add(new EclipseAttributeAdapter(makeAttribute())); if (!Modifier.isAbstract(declaredModifiers)) { - super.generateCode(classScope, classFile); + super.generateCode(classScope, classFile); // this makes the interMethodBody } + // annotations on the ITD declaration get put on this method generateDispatchMethod(classScope, classFile); } @@ -176,7 +177,13 @@ public class InterTypeMethodDeclaration extends InterTypeDeclaration { classFile.generateMethodInfoHeader(dispatchBinding); int methodAttributeOffset = classFile.contentsOffset; - int attributeNumber = classFile.generateMethodInfoAttribute(dispatchBinding, + + + // Watch out! We are passing in 'binding' here (instead of dispatchBinding) so that + // the dispatch binding attributes will include the annotations from the 'binding'. + // There is a chance that something else on the binding (e.g. throws clause) might + // damage the attributes generated for the dispatch binding. + int attributeNumber = classFile.generateMethodInfoAttribute(binding, false, makeEffectiveSignatureAttribute(signature, Shadow.MethodCall, false)); int codeAttributeOffset = classFile.contentsOffset; -- cgit v1.2.3