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

« back to all changes in this revision

Viewing changes to org.aspectj/modules/tests/design/intro/Overriding.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
 
import org.aspectj.testing.Tester;
2
 
 
3
 
public class Overriding {
4
 
    public static void main(String[] args) {
5
 
        SuperC sc = new C();
6
 
 
7
 
        Tester.checkEqual(sc.m(), "A2");
8
 
        Tester.checkEqual(A3.getMi(sc), "A3.I2");
9
 
        Tester.checkEqual(A4.getMi(sc), "A4.I2");
10
 
        Tester.checkEqual(A3.getM2(sc), "A3.Inner");
11
 
        Tester.checkEqual(A4.getM2(sc), "A4.Inner");
12
 
    }
13
 
}
14
 
 
15
 
abstract class SuperC { }
16
 
class C extends SuperC {}
17
 
class SubC extends C {}
18
 
 
19
 
aspect A1 {
20
 
    abstract String SuperC.m();
21
 
}
22
 
 
23
 
 
24
 
aspect A2 {
25
 
    String C.m() {
26
 
        return "A2";
27
 
    }
28
 
}
29
 
 
30
 
class A3 {
31
 
    static aspect I1 {
32
 
        private abstract String SuperC.mi();
33
 
    }
34
 
 
35
 
    static aspect I2 {
36
 
        private String C.mi() {
37
 
            return "A3.I2";
38
 
        }
39
 
    }
40
 
 
41
 
    public static String getMi(SuperC sc) {
42
 
        return sc.mi();
43
 
    }
44
 
 
45
 
 
46
 
    static aspect Inner {
47
 
        private abstract String SuperC.m2();
48
 
        private String C.m2() {
49
 
            return "A3.Inner";
50
 
        }
51
 
    }
52
 
    public static String getM2(SuperC sc) {
53
 
        return sc.m2();
54
 
    }
55
 
}
56
 
 
57
 
class A4 {
58
 
    static aspect I1 {
59
 
        private abstract String SuperC.mi();
60
 
    }
61
 
 
62
 
    static aspect I2 {
63
 
        private String C.mi() {
64
 
            return "A4.I2";
65
 
        }
66
 
    }
67
 
 
68
 
    public static String getMi(SuperC sc) {
69
 
        return sc.mi();
70
 
    }
71
 
 
72
 
    static aspect Inner {
73
 
        private abstract String SuperC.m2();
74
 
        private String C.m2() {
75
 
            return "A4.Inner";
76
 
        }
77
 
    }
78
 
    public static String getM2(SuperC sc) {
79
 
        return sc.m2();
80
 
    }
81
 
 
82
 
}