~ubuntu-branches/ubuntu/natty/aspectj/natty

« back to all changes in this revision

Viewing changes to org.aspectj/modules/tests/features151/ataround/A7.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2009-10-04 16:37:23 UTC
  • mfrom: (1.1.3 upstream) (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20091004163723-ck4y7j7fhjxskkie
Tags: 1.6.6+dfsg-1
* New upstream release.
  - Update 02_use_gjdoc.diff patch
* Update my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
// Bind the this on a call and change it with proceed... makes no difference
2
 
import org.aspectj.lang.ProceedingJoinPoint;
3
 
import org.aspectj.lang.annotation.*;
4
 
 
5
 
@Aspect
6
 
public class A7 {
7
 
  N newN = new N();
8
 
 
9
 
  @Around("call(void M.method(String)) && args(p) && this(t)")
10
 
  public void a( ProceedingJoinPoint pjp, N t,String p) throws Throwable {
11
 
    System.err.println("advice from ataj aspect");
12
 
    pjp.proceed(new Object[]{newN,"faked"});
13
 
  }
14
 
 
15
 
  public static void main(String []argv) {
16
 
    N.main(argv);
17
 
  }
18
 
}
19
 
 
20
 
class N {
21
 
 public static void main( String[] args ) {
22
 
   N n = new N();
23
 
   n.methodCaller("real");
24
 
 }
25
 
 
26
 
 
27
 
 public void methodCaller(String param) {
28
 
   M m = new M("1");
29
 
   m.method(param);
30
 
 }
31
 
 
32
 
}
33
 
 
34
 
 
35
 
class M {
36
 
 String prefix;
37
 
 public M(String prefix) { this.prefix = prefix; }
38
 
 public void method(String s) { System.err.println(prefix+s); }
39
 
}
40
 
 
41
 
/*
42
 
class M {
43
 
 
44
 
 String prefix;
45
 
 
46
 
 public M(String prefix) { this.prefix = prefix; }
47
 
 
48
 
 public static void main( String[] args ) {
49
 
   M m = new M("1");
50
 
   m.methodCaller("real");
51
 
 }
52
 
 
53
 
 public void methodCaller(String param) {
54
 
   method(param);
55
 
 }
56
 
 
57
 
 public void method(String s) { System.err.println(prefix+s); }
58
 
 
59
 
}
60
 
*/