summaryrefslogtreecommitdiffstats
path: root/tests/features152/synchronization/ThisJoinPointUnlock.java
blob: 46bee3da5a7c54fcd3be40123976ac2058d88e24 (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
import org.aspectj.lang.reflect.*;

aspect TJPAspect {
	before(): withincode(void ThisJoinPointUnlock.nonStaticMethod()) {
		if (thisJoinPoint.getSignature() instanceof UnlockSignature) {
			System.err.println("match.toString(): "+thisJoinPoint.toString());
			System.err.println("match.toShortString(): "+thisJoinPoint.toShortString());
			System.err.println("match.toLongString(): "+thisJoinPoint.toLongString());
		}
		
		// SHORT => shorttypenames, no args, no throws, no modifiers, short type names
		// MIDDLE=> args included
		// LONG  => modifiers included
    }
	
//	before(): withincode(void ThisJoinPointLock.nonStaticMethod()) {
//		if (thisJoinPoint.getSignature() instanceof MethodSignature) {
//			System.err.println("match.toString(): "+thisJoinPoint.toString());
//			System.err.println("match.toShortString(): "+thisJoinPoint.toShortString());
//			System.err.println("match.toLongString(): "+thisJoinPoint.toLongString());
//		}
//		
//		// SHORT => shorttypenames, no args, no throws, no modifiers, short type names
//		// MIDDLE=> args included
//		// LONG  => modifiers included
//    }

}

public class ThisJoinPointUnlock {
	public static void main(String[] args) {
		ThisJoinPointUnlock b = new ThisJoinPointUnlock();
		b.nonStaticMethod();
		b.staticMethod();
	}
	
	public void nonStaticMethod() {
		synchronized (this) {
			staticMethod();
		}
	}

	public void staticMethod() {
		synchronized (ThisJoinPointUnlock.class) {
		}
	}
	
}