blob: 1da2bd117baf3afe86fe51171e1308d02c8b48c5 (
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
29
30
31
32
33
34
35
36
37
38
|
package example;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.DeclareParents;
public class Main {
public static void main(String[] args) {
Bar bar = new Bar();
((Foo)bar).doFoo();
bar.doBar();
}
}
interface Foo {
public void doFoo();
}
class DefaultFoo implements Foo {
// Uncommenting the following fixes the error
// public DefaultFoo() {
// }
public void doFoo() {
System.out.println("In doFoo " + this.getClass());
}
}
class Bar {
public void doBar() {
System.out.println("Bar");
}
}
@Aspect
class Introduce {
@DeclareParents(value="example.Bar", defaultImpl=DefaultFoo.class)
private Foo mixin;
}
|