langtools/test/tools/javac/lambda/MostSpecific15.java
author duke
Wed, 05 Jul 2017 23:01:50 +0200
changeset 44228 e46434c65a2b
parent 43033 c37b643739a7
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
34995
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
     1
/*
43033
c37b643739a7 8148100: Convert lambda most specific positive tests to check runtime behavior
vromero
parents: 34995
diff changeset
     2
 * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
34995
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
     4
 *
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
     7
 * published by the Free Software Foundation.
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
     8
 *
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    13
 * accompanied this code).
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    14
 *
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    18
 *
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    21
 * questions.
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    22
 */
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    23
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    24
/*
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    25
 * @test
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    26
 * @bug 8143852
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    27
 * @summary Rename functional interface method type parameters during most specific test
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    28
 */
43033
c37b643739a7 8148100: Convert lambda most specific positive tests to check runtime behavior
vromero
parents: 34995
diff changeset
    29
public class MostSpecific15 {
c37b643739a7 8148100: Convert lambda most specific positive tests to check runtime behavior
vromero
parents: 34995
diff changeset
    30
    public static void main(String[] args) {
c37b643739a7 8148100: Convert lambda most specific positive tests to check runtime behavior
vromero
parents: 34995
diff changeset
    31
        new MostSpecific15().test();
c37b643739a7 8148100: Convert lambda most specific positive tests to check runtime behavior
vromero
parents: 34995
diff changeset
    32
    }
c37b643739a7 8148100: Convert lambda most specific positive tests to check runtime behavior
vromero
parents: 34995
diff changeset
    33
34995
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    34
    interface F1 { <X> Object apply(X arg); }
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    35
    interface F2 { <Y> String apply(Y arg); }
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    36
43033
c37b643739a7 8148100: Convert lambda most specific positive tests to check runtime behavior
vromero
parents: 34995
diff changeset
    37
    static void m1(F1 f) {
c37b643739a7 8148100: Convert lambda most specific positive tests to check runtime behavior
vromero
parents: 34995
diff changeset
    38
        throw new AssertionError("Less-specific method invocation.");
c37b643739a7 8148100: Convert lambda most specific positive tests to check runtime behavior
vromero
parents: 34995
diff changeset
    39
    }
34995
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    40
    static void m1(F2 f) {}
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    41
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    42
    static String foo(Object in) { return "a"; }
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    43
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    44
    void test() {
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    45
        m1(MostSpecific15::foo);
e4e19f521ee7 8143852: Implement type variable renaming for functional interface most specific test
dlsmith
parents:
diff changeset
    46
    }
43033
c37b643739a7 8148100: Convert lambda most specific positive tests to check runtime behavior
vromero
parents: 34995
diff changeset
    47
}