test/tools/javac/T8029002/MultipleUpperBoundsIncorporationTest.java

Wed, 18 Jun 2014 12:56:12 -0700

author
asaha
date
Wed, 18 Jun 2014 12:56:12 -0700
changeset 2469
c8b8cabfc922
parent 0
959103a6100f
permissions
-rw-r--r--

Merge

     1 /*
     2  * Copyright (c) 2014, Oracle and/or its affiliates. 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 Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
    20  * or visit www.oracle.com if you need additional information or have any
    21  * questions.
    22  */
    24 /*
    25  * @test
    26  * @bug 8029002
    27  * @summary javac should take multiple upper bounds into account in incorporation
    28  * @compile MultipleUpperBoundsIncorporationTest.java
    29  */
    31 import java.util.ArrayList;
    32 import java.util.List;
    34 public class MultipleUpperBoundsIncorporationTest {
    36     static class TestCase1 {
    37         interface Task<E extends Exception> {}
    39         class Comparator<T> {}
    41         class CustomException extends Exception {}
    43         class TaskQueue<E extends Exception, T extends Task<E>> {}
    45         abstract class Test {
    46             abstract <E extends Exception, T extends Task<E>> TaskQueue<E, T> create(Comparator<? super T> comparator);
    48             void f(Comparator<Task<CustomException>> comp) {
    49                 TaskQueue<CustomException, Task<CustomException>> queue = create(comp);
    50                 queue.getClass();
    51             }
    52         }
    53     }
    55     static class TestCase2 {
    56         public <T, E extends List<T>> E typedNull() {
    57             return null;
    58         }
    60         public void call() {
    61             ArrayList<String> list = typedNull();
    62         }
    63     }
    65     static class TestCase3 {
    66         interface I extends Iterable<String> {}
    68         <T, Exp extends Iterable<T>> Exp typedNull() { return null; }
    69         I i = typedNull();
    70     }
    72 }

mercurial