Ver código fonte

declareMixin

tags/pre268419
aclement 15 anos atrás
pai
commit
9a65e1e9ff

+ 27
- 0
tests/multiIncremental/mixin/base/src/CaseA.java Ver arquivo

@@ -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 Ver arquivo

@@ -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");
}
}

Carregando…
Cancelar
Salvar