Bug 321243 - @DeclareMixin handles method annotations but not parameter annotations.
Summary: @DeclareMixin handles method annotations but not parameter annotations.
Status: NEW
Alias: None
Product: AspectJ
Classification: Tools
Component: Compiler (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows Vista
: P3 normal with 3 votes (vote)
Target Milestone: ---   Edit
Assignee: aspectj inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-07-29 11:48 EDT by matthias.buse CLA
Modified: 2013-06-24 11:06 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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