You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SynchronizedInterfaceMethods.aj 696B

12345678910111213141516171819202122232425
  1. import java.lang.reflect.*;
  2. public class SynchronizedInterfaceMethods {
  3. public static void main(String[] args) throws NoSuchMethodException {
  4. Class myClass = SynchronizedInterfaceMethods.class;
  5. Method m = myClass.getMethod("foo");
  6. if (!Modifier.isSynchronized(m.getModifiers())) throw new RuntimeException("Expecting method on class to be synchronized");
  7. Class iClass = I.class;
  8. Method im = iClass.getMethod("foo");
  9. if (Modifier.isSynchronized(im.getModifiers())) throw new RuntimeException("Interface method must NOT be synchronized");
  10. }
  11. }
  12. interface I {}
  13. aspect A {
  14. public synchronized void I.foo() {}
  15. declare parents : SynchronizedInterfaceMethods implements I;
  16. }