blob: 5ec3515fe835aec4750fab61c2de1f6942f118b6 (
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
|
import org.aspectj.testing.Tester;
import java.lang.reflect.*;
public class SynchroInterface {
public static void main(String[] args) {
try {
new SynchroInterface().realMain(args);
} catch (Throwable t) {
Tester.check(false, "uh oh " + t);
} finally {
Tester.check(Consts.ran, "method didn't run");
}
}
public void realMain(String[] args) throws Throwable {
Class.forName("EmptyClass").getMethod("method", new Class[]{}).invoke(new EmptyClass(), new Class[]{});
}
}
class Consts {
public static boolean ran = false;
}
class EmptyClass {
}
interface EmptyInterface {
}
aspect IntroType {
introduction EmptyClass {
implements EmptyInterface;
}
}
aspect IntroMethod {
introduction EmptyInterface {
public synchronized void method() {
Consts.ran = true;
}
}
}
|