summaryrefslogtreecommitdiffstats
path: root/tests/bugs150/pr105479part2.aj
blob: 0a2d3943811c5414a684643377681874bfff07d3 (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
import java.util.HashSet;
import java.util.Set;

aspect ReturnTypeTest {
  private interface Test {
    Object getId();
    int hashCode();
  }
 
  public int Test.hashCode() {
	System.out.println("in Test.hashCode()");
    return getId().hashCode();
  }
 
  declare parents : ReturnTypeTester implements Test;
}

class ReturnTypeTester {
  static Set<ReturnTypeTester> set = new HashSet<ReturnTypeTester>();
  static {
    ReturnTypeTester tester = new ReturnTypeTester();
    set.add(tester);
  }
 
  public String getId() {
    return "id";
  }
}

public class pr105479part2 {
	
	public static void main(String[] args) {
		ReturnTypeTester rtt = new ReturnTypeTester();
		rtt.hashCode();
		System.out.println(rtt.getId());
		if (rtt.hashCode() != "id".hashCode()) throw new RuntimeException("dispatch failure");
	}
	
}