[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [aspectj-users] Advice around with fields
|
Hi
In
System.out.println("=" + c.i + "=");
There is one field get instruction, this one then triggers all your
advices. Their messages gets printed.
The field value is then put on the stack: 34
Then there is some string concatenation.
The string "=34=" then gets on the stack
And then there is only after that, a call to System.out.println()
(actually I should say that there is a static field get on System.out
and then a call to println() off course).
This call thus print:
"=34="
So what you see in your output is really what happens in your program flow.
Alex
On 6/23/05, ujuarez71@xxxxxxxxxxxx <ujuarez71@xxxxxxxxxxxx> wrote:
>
>
> Hi.
>
> I have the next code for my class:
>
> public class Campo {
> int i = 5;
>
> public static void main(String[] args) {
> Campo c = new Campo();
> System.out.println("=" + c.i + "=");
> }
> }
>
> and the following aspect:
>
> public aspect CampoAspect {
> pointcut campo():
> get(int Campo.i);
>
> before(): campo() {
> System.out.println("before: " + thisJoinPoint);
> }
> int around(): campo() {
> System.out.println("around: " + thisJoinPoint);
> return 34;
> }
> after(): campo() {
> System.out.println("after : " + thisJoinPoint);
> }
> }
>
> The output is:
>
> before: get(int Campo.i)
> around: get(int Campo.i)
> after : get(int Campo.i)
> =34=
>
>
> I confused. All advices work "before", could you tell me why? What's
> incorrect?I thought my output would be:
>
>
> =before: get(int Campo.i)
> around: get(int Campo.i)34
> after : get(int Campo.i)=
>
> Regards.
> Ulises J. M. ________________________________
> Switch to Netscape Internet Service.
> As low as $9.95 a month -- Sign up today at
> http://isp.netscape.com/register
>
> Netscape. Just the Net You Need.
>
> New! Netscape Toolbar for Internet Explorer
> Search from anywhere on the Web and block those annoying pop-ups.
> Download now at
> http://channels.netscape.com/ns/search/install.jsp
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>
>