aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/InnerInterfaceNames.java
blob: 249b7bb1339ebe96ea001c65218a60616b01b4e4 (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
import org.aspectj.testing.*;

/** @testcase PR#685 subaspect method declaration on superaspect inner interface (names) */
public class InnerInterfaceNames {
    public static void main (String[] args) {
        Object o = new C().getThis();
        Tester.check(null != o, 
                     "null != new C().getThis()");
        ConcreteAspect cc = ConcreteAspect.aspectOf();
        Tester.check(null != cc, 
                     "null != ConcreteAspect.aspectOf()");
        Object p = cc.getField();
        Tester.check(null != p, "null != cc.getField()");
    } 
}
class C implements AbstractAspect.InnerInterface {}

abstract aspect AbstractAspect {    
    /** bug iff interface defined in abstract aspect 
     * - not outer or subaspect 
     */
    interface InnerInterface {}
    
    public Object publicField = new Object();

    Object getField() {
        return publicField; // bad CE "no instance available"
    }
} 

aspect ConcreteAspect extends AbstractAspect {
    /** bug iff method declaration on parent inner interface */
    public Object InnerInterface.getThis() {
        return this; // bug: no instance available
    } 
}


/*
abstract aspect Composition {    
    interface Component {}
    
    public Object publicField = new Object();

    Object test() {
        return publicField; // bad CE "no instance available"
    }
 
} 
aspect SampleComposition extends Composition {
      public Object Component.getThis() {
          return this;
      } 
}
*/