mcimadamore@1609: /* mcimadamore@1609: * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. mcimadamore@1609: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. mcimadamore@1609: * mcimadamore@1609: * This code is free software; you can redistribute it and/or modify it mcimadamore@1609: * under the terms of the GNU General Public License version 2 only, as mcimadamore@1609: * published by the Free Software Foundation. mcimadamore@1609: * mcimadamore@1609: * This code is distributed in the hope that it will be useful, but WITHOUT mcimadamore@1609: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or mcimadamore@1609: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License mcimadamore@1609: * version 2 for more details (a copy is included in the LICENSE file that mcimadamore@1609: * accompanied this code). mcimadamore@1609: * mcimadamore@1609: * You should have received a copy of the GNU General Public License version mcimadamore@1609: * 2 along with this work; if not, write to the Free Software Foundation, mcimadamore@1609: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. mcimadamore@1609: * mcimadamore@1609: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA mcimadamore@1609: * or visit www.oracle.com if you need additional information or have any mcimadamore@1609: * questions. mcimadamore@1609: */ mcimadamore@1609: mcimadamore@1609: /* mcimadamore@1609: * @test mcimadamore@1609: * @bug 8008813 mcimadamore@1609: * @summary Structural most specific fails when method reference is passed to overloaded method mcimadamore@1609: * @compile MostSpecific08.java mcimadamore@1609: */ mcimadamore@1609: class MostSpecific08 { mcimadamore@1609: mcimadamore@1609: static class C { mcimadamore@1609: int getInt() { return -1; } mcimadamore@1609: Integer getInteger() { return -1; } mcimadamore@1609: } mcimadamore@1609: mcimadamore@1609: interface IntResult { } mcimadamore@1609: interface ReferenceResult { } mcimadamore@1609: mcimadamore@1609: interface PrimitiveFunction { mcimadamore@1609: int f(C c); mcimadamore@1609: } mcimadamore@1609: mcimadamore@1609: interface ReferenceFunction { mcimadamore@1609: X f(C c); mcimadamore@1609: } mcimadamore@1609: mcimadamore@1609: interface Tester { mcimadamore@1609: IntResult apply(PrimitiveFunction p); mcimadamore@1609: ReferenceResult apply(ReferenceFunction p); mcimadamore@1609: } mcimadamore@1609: mcimadamore@1609: void testMref(Tester t) { mcimadamore@1609: IntResult pr = t.apply(C::getInt); mcimadamore@1609: ReferenceResult rr = t.apply(C::getInteger); mcimadamore@1609: } mcimadamore@1609: mcimadamore@1609: void testLambda(Tester t) { mcimadamore@1609: IntResult pr = t.apply(c->c.getInt()); mcimadamore@1609: ReferenceResult rr = t.apply(c->c.getInteger()); mcimadamore@1609: } mcimadamore@1609: }