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

Thu, 23 Oct 2008 17:59:43 +0100

author
mcimadamore
date
Thu, 23 Oct 2008 17:59:43 +0100
changeset 155
4d2d8b6459e1
child 384
ed31953ca025
permissions
-rw-r--r--

6711619: javac doesn't allow access to protected members in intersection types
Summary: Accordingly to new accessibility rules all members of intersection types (but private ones) should be accessible
Reviewed-by: jjg

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

mercurial