author | jlahoda |
Wed, 09 Dec 2015 14:26:56 +0100 | |
changeset 34565 | 627464b87753 |
permissions | -rw-r--r-- |
34565
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
1 |
/* |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
4 |
* |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
8 |
* |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
13 |
* accompanied this code). |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
14 |
* |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
18 |
* |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
21 |
* questions. |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
22 |
*/ |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
23 |
|
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
24 |
/* |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
25 |
* @test |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
26 |
* @bug 8071453 |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
27 |
* @summary Verify that generics work with private method in interface |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
28 |
*/ |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
29 |
|
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
30 |
public class PrivateGenerics { |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
31 |
|
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
32 |
interface I<T> { |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
33 |
private T foo() { return null; }; |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
34 |
default void m(T t) { |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
35 |
T t1 = t; |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
36 |
T t2 = foo(); |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
37 |
} |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
38 |
} |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
39 |
|
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
40 |
interface J { |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
41 |
private <M> M foo() { return null; } |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
42 |
default <N> void m(N n) { |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
43 |
N n1 = n; |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
44 |
N n2 = foo(); |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
45 |
} |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
46 |
} |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
47 |
|
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
48 |
public static void main(String[] args) { |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
49 |
I<String> i = new I<>() {}; |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
50 |
i.m("string"); |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
51 |
String s = i.foo(); |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
52 |
|
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
53 |
J j = new J() {}; |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
54 |
j.m("string"); |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
55 |
s = j.foo(); |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
56 |
} |
627464b87753
8080641: JEP-JDK-8042880 : Implement new tests on Project Coin
jlahoda
parents:
diff
changeset
|
57 |
} |