mcimadamore@1436: /* mcimadamore@1436: * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. mcimadamore@1436: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. mcimadamore@1436: * mcimadamore@1436: * This code is free software; you can redistribute it and/or modify it mcimadamore@1436: * under the terms of the GNU General Public License version 2 only, as mcimadamore@1436: * published by the Free Software Foundation. mcimadamore@1436: * mcimadamore@1436: * This code is distributed in the hope that it will be useful, but WITHOUT mcimadamore@1436: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or mcimadamore@1436: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License mcimadamore@1436: * version 2 for more details (a copy is included in the LICENSE file that mcimadamore@1436: * accompanied this code). mcimadamore@1436: * mcimadamore@1436: * You should have received a copy of the GNU General Public License version mcimadamore@1436: * 2 along with this work; if not, write to the Free Software Foundation, mcimadamore@1436: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. mcimadamore@1436: * mcimadamore@1436: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA mcimadamore@1436: * or visit www.oracle.com if you need additional information or have any mcimadamore@1436: * questions. mcimadamore@1436: */ mcimadamore@1436: mcimadamore@1436: /* mcimadamore@1436: * @test mcimadamore@1436: * @bug 8002099 mcimadamore@1436: * @summary Add support for intersection types in cast expression mcimadamore@1511: * @compile/fail/ref=Intersection01.out -XDrawDiagnostics Intersection01.java mcimadamore@1436: */ mcimadamore@1436: class Intersection01 { mcimadamore@1436: mcimadamore@1436: interface SAM { mcimadamore@1436: void m(); mcimadamore@1436: } mcimadamore@1436: mcimadamore@1436: Object o1 = (java.io.Serializable & SAM)()->{}; mcimadamore@1436: Object o2 = (SAM & java.io.Serializable)()->{}; mcimadamore@1436: Object o3 = (java.io.Serializable & SAM)Intersection01::m; mcimadamore@1436: Object o4 = (SAM & java.io.Serializable)Intersection01::m; mcimadamore@1436: mcimadamore@1436: static void m() { } mcimadamore@1436: }