equal
deleted
inserted
replaced
|
1 /* |
|
2 * @test /nodynamiccopyright/ |
|
3 * @bug 8071453 |
|
4 * @author sadayapalam |
|
5 * @summary Various tests for private methods in interfaces. |
|
6 * @compile/fail/ref=Private03.out -XDrawDiagnostics Private03.java |
|
7 */ |
|
8 |
|
9 |
|
10 public class Private03 { |
|
11 interface I { |
|
12 private void foo(int x) {} |
|
13 private void goo(int x) {} |
|
14 } |
|
15 |
|
16 interface J extends I { |
|
17 // Verify that we are able to declare a public abstract method with the same signature as a private method in super type. |
|
18 void foo(int x); |
|
19 // Verify that we are able to declare a public default method with the same signature as a private method in super type. |
|
20 default void goo(int x) {} |
|
21 } |
|
22 |
|
23 interface K extends J { |
|
24 private void foo(int x) {} // Error, cannot reduce visibility |
|
25 private void goo(int x) {} // Ditto. |
|
26 } |
|
27 } |