Mon, 02 May 2011 12:05:41 +0100
7040883: Compilation error: "length in Array is defined in an inaccessible class or interface"
Summary: Fix of 7034511 (now backed out) is causing spurious accessibility errors
Reviewed-by: jjg
1.1 --- a/src/share/classes/com/sun/tools/javac/code/Types.java Mon May 02 02:13:02 2011 -0700 1.2 +++ b/src/share/classes/com/sun/tools/javac/code/Types.java Mon May 02 12:05:41 2011 +0100 1.3 @@ -2314,7 +2314,7 @@ 1.4 if (elemtype == t.elemtype) 1.5 return t; 1.6 else 1.7 - return new ArrayType(elemtype, t.tsym); 1.8 + return new ArrayType(upperBound(elemtype), t.tsym); 1.9 } 1.10 1.11 @Override
2.1 --- a/test/tools/javac/generics/7034511/T7034511a.java Mon May 02 02:13:02 2011 -0700 2.2 +++ b/test/tools/javac/generics/7034511/T7034511a.java Mon May 02 12:05:41 2011 +0100 2.3 @@ -1,6 +1,7 @@ 2.4 /* 2.5 * @test /nodynamiccopyright/ 2.6 - * @bug 7034511 2.7 + * @ignore backing out 7034511, see 7040883 2.8 + * @bug 7034511 7040883 2.9 * @summary Loophole in typesafety 2.10 * @compile/fail/ref=T7034511a.out -XDrawDiagnostics T7034511a.java 2.11 */
3.1 --- a/test/tools/javac/generics/7034511/T7034511b.java Mon May 02 02:13:02 2011 -0700 3.2 +++ b/test/tools/javac/generics/7034511/T7034511b.java Mon May 02 12:05:41 2011 +0100 3.3 @@ -1,6 +1,7 @@ 3.4 /* 3.5 * @test /nodynamiccopyright/ 3.6 - * @bug 7034511 3.7 + * @ignore backing out 7034511, see 7040883 3.8 + * @bug 7034511 7040883 3.9 * @summary Loophole in typesafety 3.10 * @compile/fail/ref=T7034511b.out -XDrawDiagnostics T7034511b.java 3.11 */
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/test/tools/javac/generics/typevars/T7040883.java Mon May 02 12:05:41 2011 +0100 4.3 @@ -0,0 +1,38 @@ 4.4 +/* 4.5 + * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved. 4.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4.7 + * 4.8 + * This code is free software; you can redistribute it and/or modify it 4.9 + * under the terms of the GNU General Public License version 2 only, as 4.10 + * published by the Free Software Foundation. 4.11 + * 4.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 4.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 4.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 4.15 + * version 2 for more details (a copy is included in the LICENSE file that 4.16 + * accompanied this code). 4.17 + * 4.18 + * You should have received a copy of the GNU General Public License version 4.19 + * 2 along with this work; if not, write to the Free Software Foundation, 4.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 4.21 + * 4.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 4.23 + * or visit www.oracle.com if you need additional information or have any 4.24 + * questions. 4.25 + */ 4.26 + 4.27 +/* 4.28 + * @test 4.29 + * @bug 7040883 7034511 4.30 + * @summary Compilation error: "length in Array is defined in an inaccessible class or interface" 4.31 + * @compile T7040883.java 4.32 + */ 4.33 + 4.34 +public class T7040883 { 4.35 + 4.36 + <Z> Z[] getListeners(Class<Z> z) { return null; } 4.37 + 4.38 + void test(String s) { 4.39 + int i = getListeners(s.getClass()).length; 4.40 + } 4.41 +}