~ubuntu-branches/ubuntu/natty/aspectj/natty

« back to all changes in this revision

Viewing changes to org.aspectj/modules/tests/new/CflowOfFieldInitAnonMethods.java

  • Committer: Bazaar Package Importer
  • Author(s): Damien Raude-Morvan
  • Date: 2009-10-04 16:37:23 UTC
  • mfrom: (1.1.3 upstream) (3.1.3 sid)
  • Revision ID: james.westby@ubuntu.com-20091004163723-ck4y7j7fhjxskkie
Tags: 1.6.6+dfsg-1
* New upstream release.
  - Update 02_use_gjdoc.diff patch
* Update my email address

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
 
2
 
import org.aspectj.testing.Tester;
3
 
 
4
 
/** @testcase PR#755 ajc dies on cflow into field init anon class */
5
 
public class CflowOfFieldInitAnonMethods {
6
 
    public static void main(String[] args) {
7
 
        new CflowOfFieldInitAnonMethods().r.run(); // field initializer
8
 
        // no bug on static field initializers or with non-anonymous class
9
 
        // or when not calling another method 
10
 
        //XXX test should check, but that's for leter
11
 
        //Tester.checkAllEvents();
12
 
    }
13
 
 
14
 
    Runnable r = new Runnable() {
15
 
            public void run() { calc(1); }
16
 
            public void calc(int i) {}
17
 
        };
18
 
}
19
 
 
20
 
aspect ThreadTracer {
21
 
        pointcut safe(): !within(ThreadTracer);
22
 
        
23
 
    before(): safe() && cflow(call(void Runnable.run())) {
24
 
        Tester.event("before(): cflow(call(void Runnable.run()))");
25
 
    }
26
 
    before(): safe() && cflowbelow(call(void Runnable.run())) {
27
 
        Tester.event("before(): cflowbelow(call(void Runnable.run()))");
28
 
    }
29
 
    before(): safe() && cflow(execution(void Runnable.run())) {
30
 
        Tester.event("before(): cflow(execution(void Runnable.run()))");
31
 
    }
32
 
    before(): safe() && cflowbelow(execution(void Runnable.run())) {
33
 
        Tester.event("before(): cflowbelow(execution(void Runnable.run()))");
34
 
    }
35
 
    before(): execution(void Runnable.run()) { // no bug here
36
 
        Tester.event("before(): execution(void Runnable.run())");
37
 
    }
38
 
    static {
39
 
        Tester.expectEvent("before(): cflow(call(void Runnable.run()))");
40
 
        Tester.expectEvent("before(): cflowbelow(call(void Runnable.run()))");
41
 
        Tester.expectEvent("before(): cflow(execution(void Runnable.run()))");
42
 
        Tester.expectEvent("before(): cflowbelow(execution(void Runnable.run()))");
43
 
        Tester.expectEvent("before(): execution(void Runnable.run())");
44
 
    }
45
 
}
46