Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] LTW and pointcut not matched with @target and inheritance

I'm attaching a junit testcase to demostrate the problem.

i didn't include aspectj jar files: just untar the tgz, create an externals/ directory inside the ltwtest and launch ant compile test.

the archive contains 4 classes and 1 aspect:
-Service
   it provides a print(String) method;
-AnnotatedService
it extends Service interface, without adding any method: it has a marker annotation of type MemberOfMonitoredSet;
- AnnotatedServiceImpl
   it implements the AnnotatedService interface;
-MemberOfMonitoredSet
a custom marker annotation, with rentention policy set to RUNTIME: its target is EelementType.TYPE;

-MonitorAspect
a named pointcut "callOnAnnotatedInterface" is declared, to match against calls on any method declared on implementations of the AnnotatedService or subtypes AND where the target object is annotated with the MemberOfMonitoredSet;
   a single before advice for the callOnAnnotatedInterface pointcut;

The META-INF/aop.xml describes the concrete aspect to be used by the LTW mechanism.
With the settings above, the advice is never used.

But, if the marker annotation is removed from the AnnotatedService interface, and the concrete implementation AnnotatedServiceImpl is annotated with the MemberOfMonitoredSet, WITHOUT changing in any way the MonitorAspect, then the advice is properly invoked.

If this is a known bug, i'll arise a bug in bugzilla. If not....help :-)

cheers,
Valerio

Attachment: ltwtest.tgz
Description: GNU Unix tar archive


Back to the top