aboutsummaryrefslogtreecommitdiffstats
path: root/tests/pureJava/anonInnerClass/Driver.java
blob: f278f4b1746faffeadb01bcdbb6ad2967fc91586 (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
import org.aspectj.testing.Tester;
import java.util.Iterator;

// PR#294 anonymous inner class

public class Driver {
    
    public static void main(String[] args){
        C c = new C();
        String s = (String)c.result();
        Tester.checkEqual(s, "-anon", "");
    }
}

class C {
    public String result() {
        return getIt(new Iterator() {
            public Object next() {
            return "-anon";
            }
            public boolean hasNext() { return true; }
            public void remove() {} 
            });
    }
    
    public String getIt(Iterator u) {
        return (String)u.next();
    }
}