author | sogoel |
Fri, 29 Aug 2014 00:42:42 -0700 | |
changeset 26274 | 02a5b23ee21c |
parent 24393 | 381ade32a034 |
permissions | -rw-r--r-- |
24393
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
1 |
/* |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
2 |
* Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
4 |
* |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
8 |
* |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
13 |
* accompanied this code). |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
14 |
* |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
18 |
* |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
21 |
* questions. |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
22 |
*/ |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
23 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
24 |
/** |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
25 |
* @test |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
26 |
* @bug 8041663 |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
27 |
*/ |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
28 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
29 |
public class AmbiguityErrorTest { |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
30 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
31 |
public interface A { } |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
32 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
33 |
public interface B extends A { } |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
34 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
35 |
public interface C { |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
36 |
A m(B strategy); |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
37 |
} |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
38 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
39 |
public interface D { |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
40 |
A m(A strategy); |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
41 |
A m(B strategy); |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
42 |
} |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
43 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
44 |
public interface T1 extends C, D { } |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
45 |
public interface T2 extends D, C { } |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
46 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
47 |
int count; |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
48 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
49 |
class T1Impl implements T1, T2 { |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
50 |
public A m(B strategy) { |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
51 |
count++; |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
52 |
return null; |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
53 |
} |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
54 |
public A m(A strategy) { |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
55 |
throw new AssertionError("Should not get here."); |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
56 |
} |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
57 |
} |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
58 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
59 |
public static void main(String... args) { |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
60 |
new AmbiguityErrorTest().test(); |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
61 |
} |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
62 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
63 |
void test() { |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
64 |
T1 t1 = new T1Impl(); |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
65 |
T2 t2 = new T1Impl(); |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
66 |
final B b = new B() { }; |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
67 |
t1.m(b); |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
68 |
t2.m(b); |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
69 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
70 |
if (count != 2) { |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
71 |
throw new IllegalStateException("Did not call the methods properly"); |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
72 |
} |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
73 |
} |
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
74 |
|
381ade32a034
8041663: Sensitive dependence on location of nested interface
jlahoda
parents:
diff
changeset
|
75 |
} |