hotspot/test/runtime/lambda-features/PublicStaticInterfaceMethodHandling.java
author duke
Wed, 05 Jul 2017 20:01:44 +0200
changeset 26660 5e174bbfc03a
parent 17092 8d0bef547de9
child 41705 332239c052cc
permissions -rw-r--r--
Merge
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17092
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
     1
/*
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
     2
 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
     4
 *
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
     7
 * published by the Free Software Foundation.
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
     8
 *
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    13
 * accompanied this code).
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    14
 *
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    18
 *
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    21
 * questions.
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    22
 *
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    23
 */
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    24
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    25
/*
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    26
 * @test
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    27
 * @bug 8013418
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    28
 * @summary [JDK 8] Test correct handling of static public interface methods
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    29
 * @run main/othervm -Xverify:all PublicStaticInterfaceMethodHandling
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    30
 */
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    31
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    32
class TestClass implements InterfaceWithStaticAndDefaultMethods {
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    33
}
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    34
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    35
interface InterfaceWithStaticAndDefaultMethods {
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    36
    public static String get() {
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    37
        return "Hello from StaticMethodInInterface.get()";
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    38
    }
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    39
    default void default_method() {
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    40
        System.out.println("Default method FunctionalInterface:default_method()");
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    41
    }
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    42
}
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    43
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    44
public class PublicStaticInterfaceMethodHandling  {
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    45
    public static void main(String[] args) {
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    46
        TestClass tc = new TestClass();
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    47
        tc.default_method();
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    48
    }
8d0bef547de9 8013418: assert(i == total_args_passed) in AdapterHandlerLibrary::get_adapter since 8-b87
bharadwaj
parents:
diff changeset
    49
}