test/tools/javac/generics/6711619/T6711619b.java

changeset 155
4d2d8b6459e1
child 384
ed31953ca025
equal deleted inserted replaced
154:6508d7e812e1 155:4d2d8b6459e1
1 /*
2 * Copyright 2008 Sun Microsystems, Inc. All Rights Reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
20 * CA 95054 USA or visit www.sun.com if you need additional information or
21 * have any questions.
22 */
23
24 /*
25 * @test
26 * @bug 6711619
27 *
28 * @summary javac doesn't allow access to protected members in intersection types
29 * @author Maurizio Cimadamore
30 *
31 * @compile/fail/ref=T6711619b.out -XDrawDiagnostics T6711619b.java
32 */
33
34 class T6711619b {
35 static class X1<E extends X1<E>> {
36 private int i;
37 E e;
38 int f() {
39 return e.i;
40 }
41 }
42
43 static class X2<E extends X2<E>> {
44 static private int i;
45 int f() {
46 return E.i;
47 }
48 }
49
50 static class X3<E extends X3<E> & java.io.Serializable> {
51 private int i;
52 E e;
53 int f() {
54 return e.i;
55 }
56 }
57
58 static class X4<E extends X4<E> & java.io.Serializable> {
59 static private int i;
60 int f() {
61 return E.i;
62 }
63 }
64 }

mercurial