IllegalBridgeModifier.java revision 2106:1ce8405af5fe
1329394Sdim/*
2329394Sdim * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
3353358Sdim * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4353358Sdim *
5353358Sdim * This code is free software; you can redistribute it and/or modify it
6329394Sdim * under the terms of the GNU General Public License version 2 only, as
7329394Sdim * published by the Free Software Foundation.
8329394Sdim *
9329394Sdim * This code is distributed in the hope that it will be useful, but WITHOUT
10329394Sdim * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11329394Sdim * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12341825Sdim * version 2 for more details (a copy is included in the LICENSE file that
13341825Sdim * accompanied this code).
14341825Sdim *
15341825Sdim * You should have received a copy of the GNU General Public License version
16341825Sdim * 2 along with this work; if not, write to the Free Software Foundation,
17329394Sdim * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18329394Sdim *
19329394Sdim * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20341825Sdim * or visit www.oracle.com if you need additional information or have any
21341825Sdim * questions.
22341825Sdim */
23341825Sdim
24341825Sdim/*
25341825Sdim * @test
26341825Sdim * @bug 8016320
27341825Sdim * @summary Check that 8016320 is fixed,
28341825Sdim *          that bridges have valid modifier bits
29341825Sdim * @author  Robert Field
30341825Sdim * @run main IllegalBridgeModifier
31341825Sdim */
32341825Sdim
33341825Sdiminterface SAM {
34341825Sdim    int m();
35341825Sdim}
36341825Sdim
37341825Sdiminterface SuperI {
38341825Sdim    public default int foo() { return 1234; }
39341825Sdim}
40341825Sdim
41341825Sdiminterface I extends SuperI {
42341825Sdim}
43341825Sdim
44341825Sdiminterface T extends I {
45341825Sdim    public default SAM boo() { return I.super::foo; }
46341825Sdim}
47341825Sdim
48341825Sdimpublic class IllegalBridgeModifier {
49341825Sdim    public static void main(String argv[])throws Exception {
50341825Sdim        T t = new T(){};
51341825Sdim        if (t.boo().m() != 1234) {
52341825Sdim            throw new Exception("Failed test");
53341825Sdim        }
54344779Sdim    }
55341825Sdim}
56341825Sdim