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.

AfterConstructorCalls.java 512B

123456789101112131415161718192021222324
  1. import org.aspectj.testing.Tester;
  2. public class AfterConstructorCalls {
  3. public static void main(String[] args) {
  4. new Foo().bar();
  5. }
  6. }
  7. class Foo {
  8. int bar() { return 0; }
  9. }
  10. aspect A {
  11. pointcut nimboCut() :
  12. call(Foo.new(..));
  13. /*static*/ after() returning (Object o): nimboCut() {
  14. Tester.check(o != null && o instanceof Foo, o + " !instanceof Foo");
  15. }
  16. /*static*/ after() returning (int i): call(int Foo.*(..)) {
  17. Tester.checkEqual(i, 0);
  18. }
  19. }