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.

DominatesTypePattern.java 599B

123456789101112131415161718192021
  1. import org.aspectj.testing.Tester;
  2. /** @testcase subtype pattern in dominates should pick out aspect subtypes */
  3. public class DominatesTypePattern {
  4. public static void main (String[] args) {
  5. String s = new C().method();
  6. Tester.check("pass".equals(s),
  7. "\"pass\".equals(\"" + s + "\")");
  8. }
  9. }
  10. class C {}
  11. // works if A is specified explicitly
  12. abstract aspect AA { declare precedence: AA, (AA+ && !AA); // error: should dominate A
  13. public String C.method() { return "pass"; }
  14. }
  15. aspect A extends AA {
  16. public String C.method() { return "fail"; }
  17. }