NestedCapture.java revision 3819:49170d831308
11590Srgrimes/* 21590Srgrimes * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. 31590Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 41590Srgrimes * 51590Srgrimes * This code is free software; you can redistribute it and/or modify it 61590Srgrimes * under the terms of the GNU General Public License version 2 only, as 71590Srgrimes * published by the Free Software Foundation. 81590Srgrimes * 91590Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT 101590Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 111590Srgrimes * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 121590Srgrimes * version 2 for more details (a copy is included in the LICENSE file that 131590Srgrimes * accompanied this code). 141590Srgrimes * 151590Srgrimes * You should have received a copy of the GNU General Public License version 161590Srgrimes * 2 along with this work; if not, write to the Free Software Foundation, 171590Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 181590Srgrimes * 191590Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 201590Srgrimes * or visit www.oracle.com if you need additional information or have any 211590Srgrimes * questions. 221590Srgrimes */ 231590Srgrimes 241590Srgrimes/* 251590Srgrimes * @test 261590Srgrimes * @bug 8039214 271590Srgrimes * @summary Capture variable passed through multiple levels of nested inference 281590Srgrimes * @compile NestedCapture.java 291590Srgrimes * @compile -Xlint:-options -source 7 NestedCapture.java 301590Srgrimes */ 311590Srgrimes 321590Srgrimesabstract class NestedCapture { 331590Srgrimes interface List<T> {} 341590Srgrimes abstract <T> List<T> copyOf(List<? extends T> lx); 351590Srgrimes abstract <E> List<E> filter(List<E> lx); 361590Srgrimes 3762833Swsanchez <U> void test1(List<U> lx) { 3862833Swsanchez copyOf(filter(lx)); 391590Srgrimes } 401590Srgrimes 4162833Swsanchez void test2(List<?> lx) { 4294587Sobrien copyOf(filter(lx)); 431590Srgrimes } 441590Srgrimes 451590Srgrimes} 461590Srgrimes