Bug 321243

Summary: @DeclareMixin handles method annotations but not parameter annotations.
Product: [Tools] AspectJ Reporter: matthias.buse
Component: CompilerAssignee: aspectj inbox <aspectj-inbox>
Status: NEW --- QA Contact:
Severity: normal    
Priority: P3 CC: aclement, matthias.buse
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows Vista   
Whiteboard:

Description matthias.buse CLA 2010-07-29 11:48:14 EDT
Build Identifier: AspectJ Compiler 1.6.7 built on Friday Jan 1, 2010 at 03:49:38 GMT

I want to use the @DeclareMixin annotation to let a predefined bean class implement the following interface:

public interface Rateable {

  @Action("rating")
  public void doRating(@Binding("value") int value);
}

The annotations @Action and @Binding are both annotation with RetentionPolicy.RUNTIME which are used by another framework.

My aspect-related code looks like this:

public class RateableMixin implements Rateable {
  public void doRating(int value);
}

@Aspect
public class RateableAspect {
  @DeclareMixin("my.package.MyBean")
  public static Rateable createMixin() {
     return new RateableMixin();
  }
}

The code is compiled using the org.codehaus.mojo::aspectj-maven-plugin version 1.3

The result is a bean that really implement Rateable but unfortunatelly the annotations of the parameter disappeared:

public MyBean implements Rateable {

  @Action("rating")
  public void doRating(int value) { ... }
}

Unfortunatelly that breaks my code. The framework I am using expects that either @Action and @Binding are both located in the implementation or they are both in the interface. (actually I would prefer the latter version).

Any workarounds for this?



Reproducible: Always

Steps to Reproduce:
See the code in my 'Details'.
Comment 1 Andrew Clement CLA 2010-07-29 15:42:06 EDT
I can't think of a workaround unfortunately.  Hopefully i'll get to fixing this soon.
Comment 2 matthias.buse CLA 2010-07-30 05:26:50 EDT
I found a workaround, which solves the issue in my project.
I simply switched from Annotation/Java-style to the 'native' AspectJ Language. Then the Method-Annotation is not copied to the 'parent'.
Comment 3 Andrew Clement CLA 2013-06-24 11:06:00 EDT
unsetting the target field which is currently set for something already released