Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [aspectj-users] advice on introduced default implementation

I am not sure I have the answer, but I think your does the declaration of the bar() method really need to be something like:

public void bar() {
		System.out.println("bar");
	}

Notice the missing Bar.

Just a thought!

-----Original Message-----
From: aspectj-users-bounces@xxxxxxxxxxx on behalf of Vincenz Braun
Sent: Sat 11/11/2006 1:02 PM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] advice on introduced default implementation
 
Hello,

i have stumbled upon an aspectj behaviour that I have no explanation  
for.
Could someone please be so kind and have a look at this short example
and give me a hint?

public interface Foo {

	public void foo();
	
}

public interface Bar extends Foo {

	public void bar();
}

public class FooImpl implements Foo {

	public void foo() {
		System.out.println("foo");
	}
}

public class BarImpl implements Bar {

	public void bar() {
		System.out.println("bar");
	}
	
	public void foo() {
		System.out.println("foo");
	}
}

public aspect BarAspect {

	public void Bar.bar() {
		System.out.println("bar");
	}

	declare parents: FooImpl implements Bar;
	
	pointcut test(): execution(public void Bar.bar());
	
	before(): test() {
		System.out.println(thisJoinPoint);
	}
}


The BarAspect test() advice advises only BarImpl.bar() and not
the default implementation provided in BarAspect. So the execution
of new FooImpl().bar() gets not advised.

Is this intended? And why behaves aspectj this way.

Thank you very much,
Vincenz

_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users

<<winmail.dat>>


Back to the top