dbuck@3102: /* dbuck@3102: * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. dbuck@3102: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. dbuck@3102: * dbuck@3102: * This code is free software; you can redistribute it and/or modify it dbuck@3102: * under the terms of the GNU General Public License version 2 only, as dbuck@3102: * published by the Free Software Foundation. dbuck@3102: * dbuck@3102: * This code is distributed in the hope that it will be useful, but WITHOUT dbuck@3102: * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or dbuck@3102: * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License dbuck@3102: * version 2 for more details (a copy is included in the LICENSE file that dbuck@3102: * accompanied this code). dbuck@3102: * dbuck@3102: * You should have received a copy of the GNU General Public License version dbuck@3102: * 2 along with this work; if not, write to the Free Software Foundation, dbuck@3102: * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. dbuck@3102: * dbuck@3102: * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA dbuck@3102: * or visit www.oracle.com if you need additional information or have any dbuck@3102: * questions. dbuck@3102: */ dbuck@3102: dbuck@3102: /* dbuck@3102: * @test dbuck@3102: * @bug 8143647 dbuck@3102: * @summary Javac compiles method reference that allows results in an IllegalAccessError dbuck@3102: * @run main MethodReference75 dbuck@3102: */ dbuck@3102: dbuck@3102: import pkg.PublicDerived8143647; dbuck@3102: dbuck@3102: public class MethodReference75 { dbuck@3102: public static void main(String[] args) { dbuck@3102: if (java.util.Arrays dbuck@3102: .asList(new PublicDerived8143647()) dbuck@3102: .stream() dbuck@3102: .map(PublicDerived8143647::getX) dbuck@3102: .findFirst() dbuck@3102: .get() dbuck@3102: .equals("PackagePrivateBase")) dbuck@3102: System.out.println("OK"); dbuck@3102: else dbuck@3102: throw new AssertionError("Unexpected output"); dbuck@3102: } dbuck@3102: }