aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs162/pr198341/AnnotationAspect.java
blob: a67c2641b73cd4759b07b858bcdefc708317416c (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
import java.lang.annotation.*;

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@interface TestAnnotation1 {}

@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@interface TestAnnotation2{}

@TestAnnotation1
class Annotated {}

interface Marker {}

public aspect AnnotationAspect {

  declare @type: @TestAnnotation1 *: @TestAnnotation2;

  // of cource this matches
  // declare parents: (@TestAnnotation1 *)  implements Marker;
  // this matches, too
  // declare parents: (@TestAnnotation2 *)  implements Marker;

  // this does not match on Annotated
  declare parents: (@TestAnnotation2 *) && !java.lang.annotation.Annotation implements Marker;
  // but this does match on annotated
  // declare parents: (@TestAnnotation1 *) && !java.lang.annotation.Annotation implements Marker;
}