[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[List Home]
|
Re: [aspectj-users] suspicious super call interception
|
- From: Andy Clement <andrew.clement@xxxxxxxxx>
- Date: Mon, 28 Sep 2009 08:26:17 -0700
- Delivered-to: aspectj-users@eclipse.org
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=4KFlTEhODzZo1Jx0gXEYOapTIdU35PiKupcgeuZmj08=; b=Bde8SmFRhraBBhxurMrIAPcXyt53DIzujC7i4/BFvIkoXBoybEcA0rP+Kq5hmW59G6 J/Wq48FlvXH8IBFlR2TW+5EzqWgGQ4GzbLV9OlThQz7oACKDvqiiTL5jhL2cj9udW9xh YVjHWcU8MUaYi8/ikmHtMpAnCoWJ23hgheSq8=
- Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=ffF3XsMsaRTFUzxrEchz6R6qZb7OVnqps0yJQW+LJObqYZ/5zvqQIEhdM16+iDyUhm cP2YP5Bc+OYCBdvL3EhMzthJfifyQGViBiesjtxpWs3GMwYD6ml2ccTgQ0WXQLhuaCsn rQWnkjRMzqSKhFdf/O9fDD4+Xz5jCqytfaEdQ=
public class A {
public static void main(String []argv) {
B b = new B();
b.run();
}
}
class Base {
public void getPort() {
System.out.println("Base.getPort()");
}
}
class B extends Base {
public void run() {
super.getPort();
getPort();
}
public void getPort() {
System.out.println("B.getPort()");
}
}
javac A.java
java A
Base.getPort()
B.getPort()
they can do different things. If your question is why your advice
didn't match, it is because super calls are not join points. And that
is probably a hangover from the old days of source weaving I think,
which has just never been revisited.
Andy
2009/9/28 Kristof Jozsa <kristof.jozsa@xxxxxxxxx>:
> Sample code:
>
> public aspect WSPortFixerInterceptor {
> pointcut wsGetPortCall() :
> call(Object javax.xml.ws.Service+.getPort(..));
>
> Object around() : wsGetPortCall() {
> return WsClientTool.getInstance().fixWebServicePort(proceed()); //
> never mind this line
> }
>
>
> /** private inner class to verify correct interception */
> @SuppressWarnings("unused")
> private static class TestFixer {
> {
> new Service(null, null) {
>
> @SuppressWarnings("unused")
> public void boo() {
> super.getPort(null); // (1)
> getPort(null); // (2)
> }
> };
> }
> }
> }
>
> To my best knowledge, the two calls at (1) and (2) does the very same in
> Java, but appearently (2) gets intercepted by this aspect and (1) does not..
> what's the explanation for this behaviour?
>
> thanks,
> K
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>