summaryrefslogtreecommitdiffstats
path: root/tests/bugs150/Pr103157.aj
blob: f9d41cf4bd38358b5683d3e3ca5b8d61037655d6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
public aspect Pr103157 {
	
	// verify after returning behaviour with join points that have no "return" value
	
	// these are: 
	// ConstructorExecution
	// FieldSet
	// StaticInitialization
	// Initialization
	// PreInitialization
	// ExceptionHandler  -- but handler can't have after returning advice anyway
	// arguably all adviceexecution join points except for around, but allow this for now
	
	after() returning(Object obj) : execution(C.new(..)) {
		System.out.println("returning obj on cons exe " + obj);
	}
	
	after() returning : execution(C.new(..)) {
		System.out.println("returning from cons exe");
	}
	
	after() returning(Object obj) : set(* C.*) {
		System.out.println("returning obj on set " + obj);		
	}
	
	after() returning : set(* C.*) {
		System.out.println("returning from set");		
	}
	
	after() returning(Object obj) : staticinitialization(C) {
		System.out.println("returning obj on staticinit " + obj);		
	}
	
	after() returning : staticinitialization(C) {
		System.out.println("returning from staticinit");		
	}	
	
	after() returning(Object obj) : initialization(C.new(..)) {
		System.out.println("returning obj on init " + obj);
	}
	
	after() returning : initialization(C.new(..)) {
		System.out.println("returning from init");
	}

	after() returning(Object obj) : preinitialization(C.new(..)) {
		System.out.println("returning obj on preinit " + obj);
	}
	
	after() returning : preinitialization(C.new(..)) {
		System.out.println("returning from preinit");
	}
	
	public static void main(String[] args) {
		new C();
	}

}

class C {

	String s;
	
	public C() { this.s = "xxx"; }
	
}