mcimadamore@1510: /* ksrini@2227: * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved. mcimadamore@1510: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. mcimadamore@1510: * mcimadamore@1510: * This code is free software; you can redistribute it and/or modify it mcimadamore@1510: * under the terms of the GNU General Public License version 2 only, as mcimadamore@1510: * published by the Free Software Foundation. mcimadamore@1510: * mcimadamore@1510: * This code is distributed in the hope that it will be useful, but WITHOUT mcimadamore@1510: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or mcimadamore@1510: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License mcimadamore@1510: * version 2 for more details (a copy is included in the LICENSE file that mcimadamore@1510: * accompanied this code). mcimadamore@1510: * mcimadamore@1510: * You should have received a copy of the GNU General Public License version mcimadamore@1510: * 2 along with this work; if not, write to the Free Software Foundation, mcimadamore@1510: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. mcimadamore@1510: * mcimadamore@1510: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA mcimadamore@1510: * or visit www.oracle.com if you need additional information or have any mcimadamore@1510: * questions. mcimadamore@1510: */ mcimadamore@1510: mcimadamore@1510: /* mcimadamore@1510: * @test mcimadamore@1562: * @bug 8005244 mcimadamore@1562: * @summary Implement overload resolution as per latest spec EDR mcimadamore@1562: * smoke test for combinator-like stuck analysis mcimadamore@1510: * @author Maurizio Cimadamore mcimadamore@1510: * @compile TargetType51.java mcimadamore@1510: */ mcimadamore@1510: mcimadamore@1510: import java.util.Comparator; mcimadamore@1510: mcimadamore@1510: class TargetType51 { mcimadamore@1510: mcimadamore@1510: interface SimpleMapper { mcimadamore@1510: T map(U t); mcimadamore@1510: } mcimadamore@1510: mcimadamore@1510: interface SimpleList { mcimadamore@1510: SimpleList sort(Comparator c); mcimadamore@1510: } mcimadamore@1510: mcimadamore@1510: static class Person { mcimadamore@1510: String getName() { return ""; } mcimadamore@1510: } mcimadamore@1510: mcimadamore@1510: > Comparator comparing(SimpleMapper mapper) { return null; } mcimadamore@1510: mcimadamore@1510: static class F, T> { mcimadamore@1510: F(SimpleMapper f) { } mcimadamore@1510: } mcimadamore@1510: mcimadamore@1510: void testAssignmentContext(SimpleList list, boolean cond) { mcimadamore@1510: SimpleList p1 = list.sort(comparing(Person::getName)); mcimadamore@1510: SimpleList p2 = list.sort(comparing(x->x.getName())); mcimadamore@1510: SimpleList p3 = list.sort(cond ? comparing(Person::getName) : comparing(x->x.getName())); mcimadamore@1510: SimpleList p4 = list.sort((cond ? comparing(Person::getName) : comparing(x->x.getName()))); mcimadamore@1510: } mcimadamore@1510: mcimadamore@1510: void testMethodContext(SimpleList list, boolean cond) { mcimadamore@1510: testMethodContext(list.sort(comparing(Person::getName)), true); mcimadamore@1510: testMethodContext(list.sort(comparing(x->x.getName())), true); mcimadamore@1510: testMethodContext(list.sort(cond ? comparing(Person::getName) : comparing(x->x.getName())), true); mcimadamore@1510: testMethodContext(list.sort((cond ? comparing(Person::getName) : comparing(x->x.getName()))), true); mcimadamore@1510: } mcimadamore@1510: }