aboutsummaryrefslogtreecommitdiffstats
path: root/tests/java5/annotations/declare/DecaDecpInteractions3.aj
blob: 6002c930c76ecbb5d57ab731d2860a39317dbed0 (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 java.lang.annotation.*;

interface Marker {}

@Retention(RetentionPolicy.RUNTIME) @interface Color { String value();}

// Put the marker interface on a particular type and add the annotation on 
// types with that interface.
// deca specified first
public aspect DecaDecpInteractions3 {

  declare @type: Marker+ : @Color("red");

  declare parents: A* implements Marker;
}

aspect X {
  before(): execution(* *(..)) && this(Marker) {
    System.err.println("Marker interface identified on "+thisJoinPoint);
  }
  before(): execution(* *(..)) && @this(Color) {
    System.err.println("Color annotation identified on "+thisJoinPoint);
  }
}