소스 검색

declareMixin

tags/pre268419
aclement 15 년 전
부모
커밋
9a65e1e9ff
2개의 변경된 파일54개의 추가작업 그리고 0개의 파일을 삭제
  1. 27
    0
      tests/multiIncremental/mixin/base/src/CaseA.java
  2. 27
    0
      tests/multiIncremental/mixin/inc1/src/CaseA.java

+ 27
- 0
tests/multiIncremental/mixin/base/src/CaseA.java 파일 보기

@@ -0,0 +1,27 @@
// TESTING: Very basics with a simple static factory method
import org.aspectj.lang.annotation.*;

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

aspect X {
@DeclareMixin("CaseA")
public static 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");
}
}

+ 27
- 0
tests/multiIncremental/mixin/inc1/src/CaseA.java 파일 보기

@@ -0,0 +1,27 @@
// TESTING: Very basics with a simple static factory method
import org.aspectj.lang.annotation.*;
public class CaseA {
public static void main(String[]argv) {
CaseA ca = new CaseA();
((I)ca).methodOne(); // will only succeed if mixin applied
}
}

aspect X {
@DeclareMixin("CaseA")
public static 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");
}
}

Loading…
취소
저장