aboutsummaryrefslogtreecommitdiffstats
path: root/tests/features164/declareMixin/CaseB.java
blob: 160220f59c08cc97c850f0900cb660fe68f6671a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import org.aspectj.lang.annotation.*;

public class CaseB {
  public static void main(String[]argv) {
    CaseB cb = new CaseB();
    ((I)cb).methodOne(); // will only succeed if mixin applied
  }
}

aspect X {
  // TESTING: non static factory method, will need aspectOf() calling on 
  // the aspect before the factory is called
  @DeclareMixin("CaseB")
  public I createImplementation() {
    System.out.println("Delegate factory invoked");
    return new Implementation();
  }
}

interface I {
  void methodOne();
}

class Implementation implements I {
  public void methodOne() {
    System.out.println("methodOne running");
  }
}