summaryrefslogtreecommitdiffstats
path: root/tests/bugs150
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-12-19 12:22:26 +0000
committeracolyer <acolyer>2005-12-19 12:22:26 +0000
commit4676acbde531b3c00f5572ff4053435e9ba9b1eb (patch)
tree965cf14b15fe462f62de90df4091c311b40d0e3c /tests/bugs150
parentbc1fcf9581621da51498b251f053b29fb70b9c05 (diff)
downloadaspectj-4676acbde531b3c00f5572ff4053435e9ba9b1eb.tar.gz
aspectj-4676acbde531b3c00f5572ff4053435e9ba9b1eb.zip
merge of changes from 1.5.0 branch into HEAD
Diffstat (limited to 'tests/bugs150')
-rw-r--r--tests/bugs150/pr121197.aj57
1 files changed, 57 insertions, 0 deletions
diff --git a/tests/bugs150/pr121197.aj b/tests/bugs150/pr121197.aj
new file mode 100644
index 000000000..29fed9c52
--- /dev/null
+++ b/tests/bugs150/pr121197.aj
@@ -0,0 +1,57 @@
+import java.util.concurrent.locks.ReadWriteLock;
+import java.util.concurrent.locks.ReentrantReadWriteLock;
+
+import org.aspectj.lang.annotation.After;
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.annotation.Pointcut;
+
+@Aspect( "perthis( readOperations() || writeOperations() )" )
+public abstract class pr121197 {
+ @Pointcut( "" )
+ protected abstract void readOperations();
+
+ @Pointcut( "" )
+ protected abstract void writeOperations();
+
+ private ReadWriteLock _lock = new ReentrantReadWriteLock();
+
+ @Before( "readOperations()" )
+ public void beforeReading() {
+ _lock.readLock().lock();
+ }
+
+ @After( "readOperations()" )
+ public void afterReading() {
+ _lock.readLock().unlock();
+ }
+
+ @Before( "writeOperations()" )
+ public void beforeWriting() {
+ _lock.writeLock().lock();
+ }
+
+ @After( "writeOperations()" )
+ public void afterWriting() {
+ _lock.writeLock().unlock();
+ }
+
+}
+
+@Aspect
+class ModelThreadSafety extends pr121197 {
+ @Pointcut( "execution( * C.read*(..) )" )
+ @Override
+ protected void readOperations() {}
+
+ @Pointcut( "execution( * C.write*(..) )" )
+ @Override
+ protected void writeOperations() { }
+}
+
+class C {
+
+ public void readSomething() {}
+ public void writeSomething() {}
+
+}