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.

IntroducedModifiers.java 1.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. import org.aspectj.testing.Tester;
  2. import java.lang.reflect.*;
  3. public class IntroducedModifiers {
  4. public static void main(String[] args) throws Exception {
  5. Field f = C.class.getField("cf");
  6. Tester.check(Modifier.isVolatile(f.getModifiers()), "volatile");
  7. Tester.check(Modifier.isTransient(f.getModifiers()), "transient");
  8. Method m = C.class.getMethod("m", new Class[0]);
  9. Tester.check(Modifier.isSynchronized(m.getModifiers()), "synchronized");
  10. Tester.check(Modifier.isStrict(m.getModifiers()), "strictfp");
  11. f = C.class.getField("scf");
  12. Tester.check(Modifier.isVolatile(f.getModifiers()), "volatile");
  13. Tester.check(Modifier.isTransient(f.getModifiers()), "transient");
  14. Tester.check(Modifier.isStatic(f.getModifiers()), "static");
  15. //XXX this name depends on implementation details for field intro on interfaces
  16. try {
  17. f = C.class.getField("ajc$interField$A$I$iField");
  18. } catch (NoSuchFieldException e) {
  19. f = C.class.getField("iField");
  20. }
  21. Tester.check(Modifier.isVolatile(f.getModifiers()), "volatile");
  22. Tester.check(Modifier.isTransient(f.getModifiers()), "transient");
  23. m = C.class.getMethod("im", new Class[0]);
  24. Tester.check(Modifier.isSynchronized(m.getModifiers()), "synchronized");
  25. Tester.check(Modifier.isStrict(m.getModifiers()), "strictfp");
  26. }
  27. }
  28. interface I {
  29. }
  30. class C implements I {
  31. }
  32. aspect A {
  33. public transient volatile int C.cf = 0;
  34. public synchronized strictfp int C.m() { return 0; }
  35. public transient volatile static int C.scf = 0;
  36. public synchronized strictfp int I.im() { return 0; }
  37. public transient volatile int I.iField = 1;
  38. }