Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] Advice around with fields

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

Back to the top