Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Inheritance between @DeclareMixin woven classes

Hi,
I developed a little javaee 1.6 framework that, mainly using some
annotations, decorates classes with some business logic.
The starting aspect is a @DeclareMixin one with this shape:

package a.package;
@Aspect
public class anAspect {
  @DeclareMixin("@an.annotation.package.* *")
  public AnInteface magicMethod(Object anInstance) {
    return new AnIntefaceImpl(instance);
  }
}

where AnInterfaceImpl is an implementation of AnInterface with the
constructor that reflective analyze the actual parameter anInstance and in
the package an.annotation.package there are two type annotations @A and @B
with runtime retention policy. After that I have other aspects that enable
all the rest of my runtime logic. I weave the aspects at compile-time via
the aspectj-maven-plugin-1.4, specifying as dependencies (for my project and
for plugin) the 1.7.3 version of aspectjrt and aspectjtools.

Everything works fine until a colleague creates this kind of test:
1 - Create a maven project with a @A annotated class called AFirstClass;
2 - Build in maven, installing the woven class in his repo;
3 - Create a second maven project that depends on the previous one whit
another @A annotated class that extends AFirstClass called ASecondClass;
4 - Run the maven build, but during the aspect compiling phase, the compiler
complains due to the incapacity of the ASecondClass class inherited woven
methods of implementing the abstracts methods declared in AnInterface.

In my opinion one possible solution is to "refine" the @DeclareMixin value
with a more precise condition about inherithed such "enable magicMethod()
only and only if the class has an annotation in an.annotation.package
package and doesn't have, as parent, an implementation of AnInterface".

Is it possible to state this? Have someone any idea about this problem?
Thanks for reading this,
Dario.

P.S.
Tomorrow at work, if there's a need of some more precise informations about
the problems (as error logs thrown by the aspect compiler), I'll be able to
attach to this thread.



--
View this message in context: http://aspectj.2085585.n4.nabble.com/Inheritance-between-DeclareMixin-woven-classes-tp4651003.html
Sent from the AspectJ - users mailing list archive at Nabble.com.


Back to the top