aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs193/543657/MoodIndicator.java
blob: b42b2bce60ce7060cda3d4e43ce2a1f848452d59 (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
import org.aspectj.lang.annotation.*;

enum Mood {HAPPY,SAD}
@Aspect
public class MoodIndicator {

  public interface Moody { Mood getMood(); };

  public static class MoodyImpl implements Moody {
    private Mood mood = Mood.HAPPY;

    public Mood getMood() { return mood; }
  }

  @DeclareMixin("Code*")
  public static Moody createMoodyImplementation() {
    return new MoodyImpl();
  }

  @Before("!within(MoodIndicator*) && execution(* *.run(..)) && this(m)")
  public void feelingMoody(Moody m) {
    System.out.println("I'm feeling " + m.getMood());
  }
}