summaryrefslogtreecommitdiffstats
path: root/tests/new/IntroducingPrivateMethodsOnInterfaces.java
blob: f1340f143f818269c9f4946403070ae75397dfb7 (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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import org.aspectj.testing.Tester;
import org.aspectj.testing.Tester; 
public class IntroducingPrivateMethodsOnInterfaces {
    public static void main(String[] args) {
        AA.go();
    }
    static {
        Tester.expectEvent("private_private");
        Tester.expectEvent("private_package");
        Tester.expectEvent("private_public");
        Tester.expectEvent("package_private");
        Tester.expectEvent("package_package");
        Tester.expectEvent("package_public");
        Tester.expectEvent("public_private");
        Tester.expectEvent("public_package");
        Tester.expectEvent("public_public");        
    }
}

interface I {}
class C {

//      private     void _private(String s)   { Tester.event("private_"+s);   }
//      /*package*/ void _package(String s)   { Tester.event("package_"+s);   }
//      public      void _public(String s)    { Tester.event("public_"+s);    }
    
//      private void private_private() { _private("private"); }
//      private void private_package() { _package("private"); }
//      private void private_public()  { _public("private");  }

//      /*package*/ void package_private() { _private("package"); }
//      /*package*/ void package_package() { _package("package"); }
//      /*package*/ void package_public()  { _public("package");  }

//      public void public_private() { _private("public"); }
//      public void public_package() { _package("public"); }
//      public void public_public()  { _public("public");  }    

}

aspect AA {
    
    public static void go() {
        I c = new C();
        c.private_private();
        c.private_package();
        c.private_public();
        
        c.package_private();
        c.package_package();
        c.package_public();

        c.public_private();
        c.public_package();
        c.public_public();
    }
    
    private     void I._private(String s)   { Tester.event("private_"+s);   }
    /*package*/ void I._package(String s)   { Tester.event("package_"+s);   }
    public      void I._public(String s)    { Tester.event("public_"+s);    }
    
    private void I.private_private() { _private("private"); }
    private void I.private_package() { _package("private"); }
    private void I.private_public()  { _public("private");  }

    /*package*/ void I.package_private() { _private("package"); }
    /*package*/ void I.package_package() { _package("package"); }
    /*package*/ void I.package_public()  { _public("package");  }

    public void I.public_private() { _private("public"); }
    public void I.public_package() { _package("public"); }
    public void I.public_public()  { _public("public");  }
}

aspect A {
    declare parents: C implements I;
}