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.

CflowOfFieldInitAnonMethods.java 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import org.aspectj.testing.Tester;
  2. /** @testcase PR#755 ajc dies on cflow into field init anon class */
  3. public class CflowOfFieldInitAnonMethods {
  4. public static void main(String[] args) {
  5. new CflowOfFieldInitAnonMethods().r.run(); // field initializer
  6. // no bug on static field initializers or with non-anonymous class
  7. // or when not calling another method
  8. //XXX test should check, but that's for leter
  9. //Tester.checkAllEvents();
  10. }
  11. Runnable r = new Runnable() {
  12. public void run() { calc(1); }
  13. public void calc(int i) {}
  14. };
  15. }
  16. aspect ThreadTracer {
  17. pointcut safe(): !within(ThreadTracer);
  18. before(): safe() && cflow(call(void Runnable.run())) {
  19. Tester.event("before(): cflow(call(void Runnable.run()))");
  20. }
  21. before(): safe() && cflowbelow(call(void Runnable.run())) {
  22. Tester.event("before(): cflowbelow(call(void Runnable.run()))");
  23. }
  24. before(): safe() && cflow(execution(void Runnable.run())) {
  25. Tester.event("before(): cflow(execution(void Runnable.run()))");
  26. }
  27. before(): safe() && cflowbelow(execution(void Runnable.run())) {
  28. Tester.event("before(): cflowbelow(execution(void Runnable.run()))");
  29. }
  30. before(): execution(void Runnable.run()) { // no bug here
  31. Tester.event("before(): execution(void Runnable.run())");
  32. }
  33. static {
  34. Tester.expectEvent("before(): cflow(call(void Runnable.run()))");
  35. Tester.expectEvent("before(): cflowbelow(call(void Runnable.run()))");
  36. Tester.expectEvent("before(): cflow(execution(void Runnable.run()))");
  37. Tester.expectEvent("before(): cflowbelow(execution(void Runnable.run()))");
  38. Tester.expectEvent("before(): execution(void Runnable.run())");
  39. }
  40. }