diff options
author | aclement <aclement> | 2006-05-24 07:15:42 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-05-24 07:15:42 +0000 |
commit | b2247654a3b35eb26731fac20247fc3007612eab (patch) | |
tree | 3b3bc6d6e2833e1d62aaf4506b1e8e3f4d12f51d /tests/features152/synchronization/ThisJoinPointLock.java | |
parent | 917a3a70f5c09f16151200f13eb89283c4bb2abf (diff) | |
download | aspectj-b2247654a3b35eb26731fac20247fc3007612eab.tar.gz aspectj-b2247654a3b35eb26731fac20247fc3007612eab.zip |
synchronization joinpoints: testcode
Diffstat (limited to 'tests/features152/synchronization/ThisJoinPointLock.java')
-rw-r--r-- | tests/features152/synchronization/ThisJoinPointLock.java | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/features152/synchronization/ThisJoinPointLock.java b/tests/features152/synchronization/ThisJoinPointLock.java new file mode 100644 index 000000000..ed5376a79 --- /dev/null +++ b/tests/features152/synchronization/ThisJoinPointLock.java @@ -0,0 +1,48 @@ +import org.aspectj.lang.reflect.*; + +aspect TJPAspect { + before(): withincode(void ThisJoinPointLock.nonStaticMethod()) { + if (thisJoinPoint.getSignature() instanceof LockSignature) { + 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 ThisJoinPointLock { + public static void main(String[] args) { + ThisJoinPointLock b = new ThisJoinPointLock(); + b.nonStaticMethod(); + b.staticMethod(); + } + + public void nonStaticMethod() { + synchronized (this) { + staticMethod(); + } + } + + public void staticMethod() { + synchronized (ThisJoinPointLock.class) { + } + } + +} |