aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs1920/github_24/FuzzilyMatchingAspect.aj
blob: b40c13c629a20d1b37328f826a64da4d1c6e0ca2 (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
39
public aspect FuzzilyMatchingAspect {

  pointcut returnRefTypeSimpleOrArray() : execution(public MaybeMissing* MaybeMissing*.*());
  pointcut return1DimRefTypeArray() : execution(public MaybeMissing*[] MaybeMissing*.*());
  pointcut return2DimRefTypeArray() : execution(public MaybeMissing*[][] MaybeMissing*.*());

  // Return type 'MaybeMissing*' also matches array types due to the '*' at the end.
  // Therefore, explicitly exclude array pointcuts in order to only match the method returning the simple type.
  after() : returnRefTypeSimpleOrArray() && !return1DimRefTypeArray() && !return2DimRefTypeArray() {
    System.out.println(thisJoinPoint);
  }

  after() : return1DimRefTypeArray() {
    System.out.println(thisJoinPoint);
  }

  after() : return2DimRefTypeArray() {
    System.out.println(thisJoinPoint);
  }

  pointcut returnPrimitiveTypeSimpleOrArray() : execution(public in* MaybeMissing*.*());
  pointcut return1DimPrimitiveTypeArray() : execution(public in*[] MaybeMissing*.*());
  pointcut return2DimPrimitiveTypeArray() : execution(public in*[][] MaybeMissing*.*());

  // Return type 'in*' also matches array types due to the '*' at the end.
  // Therefore, explicitly exclude array pointcuts in order to only match the method returning the simple type.
  after() : returnPrimitiveTypeSimpleOrArray() && !return1DimPrimitiveTypeArray() && !return2DimPrimitiveTypeArray() {
    System.out.println(thisJoinPoint);
  }

  after() : return1DimPrimitiveTypeArray() {
    System.out.println(thisJoinPoint);
  }

  after() : return2DimPrimitiveTypeArray() {
    System.out.println(thisJoinPoint);
  }

}