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.

AnonymousSelfReference.java 642B

1234567891011121314151617181920212223
  1. import org.aspectj.testing.Tester;
  2. /** @testcase PR#774 interface self-reference by anonymous instance */
  3. public class AnonymousSelfReference {
  4. public static void main (String[] args) {
  5. Tester.expectEvent("run");
  6. Tester.expectEvent("im");
  7. I it = new I() { public void im() { Tester.event("im");} };
  8. it.runnable.run();
  9. Tester.checkAllEvents();
  10. }
  11. }
  12. interface I { public void im(); }
  13. aspect A {
  14. Runnable I.runnable = new Runnable() {
  15. public void run() {
  16. im(); // comment out to avoid VerifyError
  17. Tester.event("run");
  18. }
  19. };
  20. }