Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Advice did not match

I might need to see where you are applying it?

I created this tiny thing and your aspect worked just fine:

class Foo {
	@Updates void foo(String s) {}
}

The advice did not match indicates that during the build of the code
containing the aspect it didn't find anything to apply it to.  If that
is because you are building it into an aspect library to use later,
you can just ignore the warning.  If you expected it to match
something though - I'd need to see what it isn't matching.  If it
isn't matching you can break it into smaller pieces to determine which
piece is causing the problem.

cheers
Andy

On 17 May 2012 11:40, hart404 <hart404@xxxxxxxxx> wrote:
> Can anyone tell me why I'm getting "Advice did not match" on the after advice
> in the following code, please?
>
> package edu.uat.cs2011.observerpattern;
>
> import java.util.ArrayList;
> import java.util.List;
>
> public aspect ObservableAspect {
>
>        declare parents: hasmethod(@Updates * *.*(..)) implements Observable;
>
>        private List<Observer> observers = new ArrayList<Observer>();
>
>        public void addObserver(Observer observer) {
>                observers.add(observer);
>        }
>
>        public void removeObserver(Observer observer) {
>                observers.remove(observer);
>        }
>
>        public void notifyObservers() {
>                for (Observer observer : observers) {
>                        observer.update();
>                }
>        }
>
>        public pointcut mutations(Observable observable) : execution(@Updates *
> *.*(..)) && this(observable);
>
>        after(Observable observable) : mutations(observable) {
>                for (Observer observer : observers) {
>                        observer.update();
>                }
>        }
>
> }
>
> --
> View this message in context: http://aspectj.2085585.n4.nabble.com/Advice-did-not-match-tp4643399.html
> Sent from the AspectJ - users mailing list archive at Nabble.com.
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top