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.

RunnableSub.java 956B

12345678910111213141516171819202122232425262728293031323334
  1. public class RunnableSub {
  2. public static void main (String[] args) {
  3. Target.main(args);
  4. }
  5. }
  6. interface MyRunner extends Runnable {}
  7. aspect Aspect {
  8. static final String[] SIGNALS = new String[]
  9. { "around - start"
  10. , "around - run - before proceed"
  11. , "around - run - after proceed"
  12. };
  13. // introduced field on interface
  14. int MyRunner.result;
  15. /** @testcase PR#620 around advice inner Runnable (subinterface) running proceed and writing field introduced on subinterface */
  16. int around(): Target.pointcutTarget() {
  17. MyRunner runner = new MyRunner() {
  18. public void run() {
  19. Common.signal(SIGNALS[1]);
  20. result = proceed(); // remove to avoid bug
  21. Common.signal(SIGNALS[2]);
  22. }
  23. };
  24. runner.run();
  25. Common.signal(SIGNALS[0]);
  26. return runner.result; // remove to avoid bug
  27. }
  28. }