diff options
Diffstat (limited to 'tests/bugs150/pr117681/MoodIndicator.java')
-rw-r--r-- | tests/bugs150/pr117681/MoodIndicator.java | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/bugs150/pr117681/MoodIndicator.java b/tests/bugs150/pr117681/MoodIndicator.java new file mode 100644 index 000000000..ec420ad86 --- /dev/null +++ b/tests/bugs150/pr117681/MoodIndicator.java @@ -0,0 +1,42 @@ +import org.aspectj.lang.annotation.*; + +class Mood { + public final static Mood HAPPY=new Mood(); +} + // this interface can be outside of the aspect + interface Moody { + Mood getMood(int i); + }; + + // this implementation can be outside of the aspect + class MoodyImpl implements Moody { + private Mood mood = Mood.HAPPY; + + public Mood getMood(int i) { + return mood; + } + } +@Aspect +public class MoodIndicator { + + + // here is the actual ITD syntax when using @AspectJ + // public static is mandatory + // the field type must be the introduced interface. It can't be a class. + @DeclareParents("C") + public static Moody introduced = new MoodyImpl(); + +// @Before("execution(* *.*(..)) && this(m)") +// public void feelingMoody(Moody m) { +// System.out.println("I'm feeling " + m.getMood()); +// } + + public static void main(String []argv) { + ((Moody)new C()).getMood(7); + } +} + + +class C { + +} |