Procházet zdrojové kódy

failure when lock()/unlock() used in XML defined pointcut and would require synchronization transform of a method

tags/pre_pr_153572
aclement před 18 roky
rodič
revize
d15e56b459

+ 8
- 0
tests/features152/synchronization/transformed/CaptureLock.aj Zobrazit soubor

@@ -0,0 +1,8 @@
public abstract aspect CaptureLock {

abstract pointcut lockPC();

before(): lockPC() {
System.out.println("Before a lock or unlock");
}
}

+ 35
- 0
tests/features152/synchronization/transformed/Program.java Zobrazit soubor

@@ -0,0 +1,35 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class Program {
public static void main(String[] args) {
new Program().b();
new Program().c();
new Program().d();
}
// ... that does something ...
public synchronized void b() {
System.out.println("hello from b()");
}
// ... that includes try/catch ...
public synchronized void c() {
try {
File f = new File("fred");
FileInputStream fis = new FileInputStream(f);
} catch (IOException ioe) {
System.out.println("bang in c()");
}
}
// ... with nested synchronized blocks ...
public synchronized void d() {
System.out.println("hello from d()");
synchronized (new String()) {
System.out.println("hello from block in d()");
}
}

}

+ 12
- 0
tests/features152/synchronization/transformed/aop1.xml Zobrazit soubor

@@ -0,0 +1,12 @@
<aspectj>
<aspects>
<concrete-aspect name="G8"
extends="CaptureLock">
<pointcut name="lockPC" expression="(within(*) AND (lock() || unlock()))" />
</concrete-aspect>
</aspects>

<weaver options="-verbose -showWeaveInfo -Xjoinpoints:synchronization"/>
</aspectj>

Načítá se…
Zrušit
Uložit