test/langtools/tools/javac/T8203486/SkipInferenceForNonFunctionalInterfTest.java
author vromero
Mon, 21 May 2018 12:27:21 -0700
changeset 50200 9ce050c4711b
permissions -rw-r--r--
8203486: skip type inference for non functional interface components of intersection types Reviewed-by: mcimadamore
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
50200
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
     1
/*
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
     2
 * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
     4
 *
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
     7
 * published by the Free Software Foundation.
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
     8
 *
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    13
 * accompanied this code).
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    14
 *
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    18
 *
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    21
 * questions.
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    22
 */
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    23
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    24
/*
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    25
 * @test
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    26
 * @bug 8203486
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    27
 * @summary skip type inference for non functional interface components of intersection types
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    28
 * @compile SkipInferenceForNonFunctionalInterfTest.java
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    29
 */
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    30
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    31
class SkipInferenceForNonFunctionalInterfTest {
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    32
    class U1 {}
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    33
    class U2 {}
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    34
    class U3 {}
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    35
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    36
    interface SAM<P1 extends U1, P2 extends U2, P3 extends U3> {
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    37
        P3 m(P1 p1, P2 p2);
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    38
    }
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    39
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    40
    interface I<T> {}
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    41
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    42
    class Tester {
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    43
        Object method(SAM<U1, U2, U3> sam) {
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    44
            return null;
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    45
        }
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    46
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    47
        Object run() {
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    48
            return method((SAM<U1, U2, U3> & I<?>) (U1 u1, U2 u2) -> { return new U3(); });
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    49
        }
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    50
    }
9ce050c4711b 8203486: skip type inference for non functional interface components of intersection types
vromero
parents:
diff changeset
    51
}