blob: 9611f343473af3432d26544f7e86d752f13f42da (
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
|
import java.lang.reflect.*;
public class SynchronizedInterfaceMethods {
public static void main(String[] args) throws NoSuchMethodException {
Class myClass = SynchronizedInterfaceMethods.class;
Method m = myClass.getMethod("foo");
if (!Modifier.isSynchronized(m.getModifiers())) throw new RuntimeException("Expecting method on class to be synchronized");
Class iClass = I.class;
Method im = iClass.getMethod("foo");
if (Modifier.isSynchronized(im.getModifiers())) throw new RuntimeException("Interface method must NOT be synchronized");
}
}
interface I {}
aspect A {
public synchronized void I.foo() {}
declare parents : SynchronizedInterfaceMethods implements I;
}
|