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.

MethodSelfReference.java 589B

1234567891011121314151617181920212223242526
  1. import org.aspectj.testing.Tester;
  2. /** @testcase PR#776 self-reference from (aspect-declared) method-local class */
  3. public class MethodSelfReference {
  4. public static void main (String[] args) {
  5. I it = new I() { public void im() { } };
  6. it.start();
  7. }
  8. }
  9. interface I { public void im(); }
  10. aspect A {
  11. Runnable I.runnable;
  12. void I.start() {
  13. class Runner implements Runnable {
  14. I ri;
  15. Runner(I i) { ri = i; }
  16. public void run() { ri.im(); }
  17. }
  18. runnable = new Runner(this);
  19. runnable.run();
  20. }
  21. }