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.

Driver.java 644B

12345678910111213141516171819202122232425262728293031323334
  1. //only register things once.
  2. import org.aspectj.testing.Tester;
  3. public class Driver {
  4. public static void test() {
  5. A a = new A();
  6. B b = new B();
  7. // instances of A, B are created (the instanceof Aspect isn't counted for timing reasons)
  8. Tester.checkEqual(Aspect.count, 2, "instance count");
  9. }
  10. public static void main(String[] args) { test(); }
  11. }
  12. class A {
  13. public A() {}
  14. public void foo() {}
  15. }
  16. class B extends A {
  17. public B() {}
  18. public void bar() {}
  19. }
  20. aspect Aspect {
  21. public static int count = 0;
  22. after() returning(): /*target(*) &&*/ call(new()) {
  23. count++;
  24. }
  25. }