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.

InnerMethods.java 590B

12345678910111213141516171819202122232425262728293031323334
  1. import org.aspectj.testing.Tester;
  2. public class InnerMethods {
  3. public static void main(String[] args) {
  4. Tester.checkEqual(new Sub().new SubInner().f(2), 21);
  5. Tester.check("ran before calls advice");
  6. }
  7. }
  8. class Super {
  9. protected int m(int j) { return j*10; }
  10. }
  11. interface I {
  12. int x = 1;
  13. }
  14. class Sub extends Super implements I {
  15. protected int m(int i) { return i; }
  16. class SubInner extends Super {
  17. int f(int jj) {
  18. return this.m(jj) + x;
  19. }
  20. }
  21. }
  22. aspect A {
  23. before (): call(int Super.m(int)) {
  24. Tester.note("ran before calls advice");
  25. }
  26. }