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.

SuperToIntro.java 738B

123456789101112131415161718192021222324252627
  1. // from Bug#: 29959
  2. import org.aspectj.testing.Tester;
  3. aspect Foo {
  4. String A.onlyA() { return "onlyA"; }
  5. String A.foo() { return "Afoo"; }
  6. String B.foo() { return super.foo() + ":" + onlyA() + ":" + super.getName(); }
  7. }
  8. class A {
  9. String getName() { return "A"; }
  10. }
  11. class B extends A {
  12. String getName() { return "B"; }
  13. String onB1() { return foo() + ":" + onlyA() + ":" + getName(); }
  14. String onB2() { return super.foo() + ":" + super.onlyA() + ":" + super.getName(); }
  15. }
  16. public class SuperToIntro {
  17. public static void main(String[] args) {
  18. B b = new B();
  19. Tester.checkEqual(b.foo(), "Afoo:onlyA:A");
  20. Tester.checkEqual(b.onB1(), "Afoo:onlyA:A:onlyA:B");
  21. Tester.checkEqual(b.onB2(), "Afoo:onlyA:A");
  22. }
  23. }