Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Marker Interface and Abstract Pointcut

AspectJ does not allow pointcut overriding, and your concrete synchCall 
pointcut has a different signature to (overrides the) abstract synchCall 
pointcut.  If you change the definition to:

pointcut synchCall(Synch a) : target(a) && target(AbstractPublisher) && 
execution(public void addSubscriber(TransactionSubscriber))

then things should work as expected. The target(a) expression binds the 
Synch object expected by the synchCall contract, the second target 
expression adds the extra condition that we're only interested in targets 
which are AbstractPublishers. If you don't need that latter restriction, 
just drop the second target expression.

-- Adrian
Adrian_Colyer@xxxxxxxxxx



Irum Godil <softwarengineer2004@xxxxxxxxx> 
Sent by: aspectj-users-bounces@xxxxxxxxxxx
17/05/2005 17:48
Please respond to
aspectj-users@xxxxxxxxxxx


To
aspectj-users@xxxxxxxxxxx
cc

Subject
[aspectj-users] Marker Interface and Abstract Pointcut






Hi, 
I want a few of my classes to implement the same advice, so I created an 
aspect with a marker interface and an abstract pointcut as follows:
 
abstract public aspect SynchMethods {
 
          public interface Synch {} 
          abstract pointcut synchCall(Synch s);
...
}
 
Now, in a another aspect where I want to concretize the pointcut, I am 
doing:
 
declare parents: AbstractPublisher implements SynchMethods.Synch;
 
pointcut synchCall(AbstractPublisher a) : target(a) && execution(public 
void addSubscriber(TransactionSubscriber))
 
However, I keep getting the following compile error: 
 
 
can't override pointcut 
aspects.multithread.weave.SynchMethods.synchCall(aspects.multithread.weave.SynchMethods$Synch) 
with pointcut 
aspects.multithread.weave.ThreadAbstractPublisher.synchCall(org.prevayler.implementation.publishing.AbstractPublisher) 
parameter types don't match ThreadAbstractPublisher.aj 
I am not sure why I am getting this error when I have declared 
AbstractPublisher to implement the Synch interface. Any help on this will 
be greatly appreciated. 
 
Thanks.
Sincerely,
Irum Godil. 
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com _______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users




Back to the top