Path: blob/master/test/hotspot/jtreg/compiler/jvmci/common/testcases/MultipleImplementersInterface.java
41161 views
/*1* Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.2* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.3*4* This code is free software; you can redistribute it and/or modify it5* under the terms of the GNU General Public License version 2 only, as6* published by the Free Software Foundation.7*8* This code is distributed in the hope that it will be useful, but WITHOUT9* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or10* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License11* version 2 for more details (a copy is included in the LICENSE file that12* accompanied this code).13*14* You should have received a copy of the GNU General Public License version15* 2 along with this work; if not, write to the Free Software Foundation,16* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.17*18* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA19* or visit www.oracle.com if you need additional information or have any20* questions.21*/2223package compiler.jvmci.common.testcases;2425import java.util.HashMap;26import java.util.Map;2728public interface MultipleImplementersInterface {2930int INT_CONSTANT = Integer.MAX_VALUE;31long LONG_CONSTANT = Long.MAX_VALUE;32float FLOAT_CONSTANT = Float.MAX_VALUE;33double DOUBLE_CONSTANT = Double.MAX_VALUE;34String STRING_CONSTANT = "Hello";35Object OBJECT_CONSTANT = new Object();3637default void defaultMethod() {38// empty39}4041void testMethod();4243default void finalize() throws Throwable {44// empty45}4647default void lambdaUsingMethod() {48Thread t = new Thread(this::defaultMethod);49t.start();50}5152default void printFields() {53System.out.println(OBJECT_CONSTANT);54String s = "";55System.out.println(s);56}5758static void staticMethod() {59System.getProperties(); // calling some static method60Map map = new HashMap(); // calling some constructor61map.put(OBJECT_CONSTANT, OBJECT_CONSTANT); // calling some interface method62map.remove(OBJECT_CONSTANT); // calling some default interface method63}6465default void instanceMethod() {66toString(); // calling some virtual method67}6869default void anonClassMethod() {70new Runnable() {71@Override72public void run() {73System.out.println("Running");74}75}.run();76}77}787980