langtools/test/tools/javac/inference/EagerReturnTypeResolution/EagerReturnTypeResolutionTesta.java
changeset 25037 aab9af9818ae
parent 25036 b199d4267ef0
parent 24615 74eb0778e4f2
child 25038 cb2bdbbfbb2d
equal deleted inserted replaced
25036:b199d4267ef0 25037:aab9af9818ae
     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.  Oracle designates this
       
     8  * particular file as subject to the "Classpath" exception as provided
       
     9  * by Oracle in the LICENSE file that accompanied this code.
       
    10  *
       
    11  * This code is distributed in the hope that it will be useful, but WITHOUT
       
    12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
       
    13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
       
    14  * version 2 for more details (a copy is included in the LICENSE file that
       
    15  * accompanied this code).
       
    16  *
       
    17  * You should have received a copy of the GNU General Public License version
       
    18  * 2 along with this work; if not, write to the Free Software Foundation,
       
    19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
       
    20  *
       
    21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
       
    22  * or visit www.oracle.com if you need additional information or have any
       
    23  * questions.
       
    24  */
       
    25 
       
    26 /*
       
    27  * @test
       
    28  * @bug 8030741
       
    29  * @summary Inference: implement eager resolution of return types, consistent with JDK-8028800
       
    30  * @compile EagerReturnTypeResolutionTesta.java
       
    31  */
       
    32 
       
    33 public class EagerReturnTypeResolutionTesta {
       
    34 
       
    35     abstract class Test1<T>{
       
    36         abstract <S> S foo(S x, S y);
       
    37         <S extends Number & Comparable<? extends Number>> void baz(Test1<S> a){}
       
    38 
       
    39         void bar(Test1<Long> x, Test1<Integer> y){
       
    40             baz(foo(x, y));
       
    41         }
       
    42     }
       
    43 
       
    44     abstract class Test2<T>{
       
    45         abstract <S> S foo(S x, S y);
       
    46         abstract <S1> void baz(Test2<S1> a);
       
    47 
       
    48         void bar(Test2<Integer> y, Test2<Long> x){
       
    49              baz(foo(x, y));
       
    50         }
       
    51     }
       
    52 
       
    53     abstract class Test3<T>{
       
    54         abstract <S> S foo(S x, S y);
       
    55         <T extends Number & Comparable<?>,
       
    56                 S extends Number & Comparable<? extends T>> void baz(Test3<S> a){}
       
    57 
       
    58         void bar(Test3<Long> x, Test3<Integer> y){
       
    59             baz(foo(x, y));
       
    60         }
       
    61     }
       
    62 
       
    63     abstract class Test4 {
       
    64         abstract class A0<T> {}
       
    65 
       
    66         abstract class A1<T> extends A0<T> {}
       
    67 
       
    68         abstract class A2<T> extends A0<T> {}
       
    69 
       
    70         abstract <S> S foo(S x, S y);
       
    71         abstract <S1> void baz(A0<S1> a);
       
    72 
       
    73         void bar(A2<Integer> y, A1<Long> x){
       
    74              baz(foo(x, y));
       
    75         }
       
    76     }
       
    77 
       
    78 }