IntersectionTypeReceiverTest2.java revision 3092:582f31e79d74
11553Srgrimes/*
21553Srgrimes * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
31553Srgrimes * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
41553Srgrimes *
51553Srgrimes * This code is free software; you can redistribute it and/or modify it
61553Srgrimes * under the terms of the GNU General Public License version 2 only, as
71553Srgrimes * published by the Free Software Foundation.
81553Srgrimes *
91553Srgrimes * This code is distributed in the hope that it will be useful, but WITHOUT
101553Srgrimes * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
111553Srgrimes * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
121553Srgrimes * version 2 for more details (a copy is included in the LICENSE file that
131553Srgrimes * accompanied this code).
141553Srgrimes *
151553Srgrimes * You should have received a copy of the GNU General Public License version
161553Srgrimes * 2 along with this work; if not, write to the Free Software Foundation,
171553Srgrimes * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
181553Srgrimes *
191553Srgrimes * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
201553Srgrimes * or visit www.oracle.com if you need additional information or have any
211553Srgrimes * questions.
221553Srgrimes */
231553Srgrimes
241553Srgrimes/**
251553Srgrimes * @test
261553Srgrimes * @bug 8142476
271553Srgrimes * @summary Test that Call site initialization exception is not thrown when the method
281553Srgrimes   reference receiver is of intersection type.
291553Srgrimes * @run main IntersectionTypeReceiverTest2
301553Srgrimes */
311553Srgrimes
321553Srgrimespublic class IntersectionTypeReceiverTest2 {
331553Srgrimes    interface I {
3454375Sjoe    }
351553Srgrimes
36112214Srobert    interface J {
371553Srgrimes        void foo();
3899800Salfred    }
39112214Srobert
4099800Salfred    static <T extends I & J> void bar(T t) {
4199800Salfred        Runnable r = t::foo;
4254375Sjoe    }
4399802Salfred
4499800Salfred    public static void main(String[] args) {
4599800Salfred        class A implements I, J {
4699800Salfred            public void foo() {
4799800Salfred            }
4860418Swollman        }
4999800Salfred        bar(new A());
5099800Salfred    }
5199800Salfred}
52