summaryrefslogtreecommitdiffstats
path: root/tests/bugs/lazyTjpXLintWarning/LazyTjpTest2.java
blob: 422c8eed708bf937b1e14b54ac7790a74a9c9da9 (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
public class LazyTjpTest2 {

  public void test1 () { }
  public void test2 () { }
  public void test3 () { }
  
  private static aspect Aspect1 {

    private static boolean enabled = true;
    
    // OK, has an if() but doesnt use tjp anyway!
    before () : if(enabled) && execution(public void LazyTjpTest2.test1()) {
    }

    // Not ok, cant apply because no if() used
    before () : execution(public void LazyTjpTest2.test2()) {
      System.out.println(thisJoinPoint);
    }

    // OK, doesnt use tjp
    before () : execution(public void LazyTjpTest2.test3()) {
    }

    // OK, uses tjp but also has if()
    before () : if(enabled) && execution(public void LazyTjpTest2.test1()) {
      System.err.println(thisJoinPoint);
    }
  }

}