annotate test/compiler/inlining/InlineDefaultMethod1.java @ 14667:e65d960c7be5

8036100: Default method returns true for a while, and then returns false Reviewed-by: kvn, jrose
author vlivanov
date Tue, 04 Mar 2014 02:33:10 -0800
parents
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14667
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
1 /*
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
2 * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved.
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
4 *
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
7 * published by the Free Software Foundation.
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
8 *
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
13 * accompanied this code).
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
14 *
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
18 *
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
21 * questions.
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
22 */
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
23
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
24 /*
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
25 * @test
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
26 * @bug 8036100
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
27 * @summary Default method returns true for a while, and then returns false
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
28 * @run main/othervm -Xcomp -XX:CompileOnly=InlineDefaultMethod1::test
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
29 * -XX:CompileOnly=I1::m -XX:CompileOnly=I2::m
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
30 * InlineDefaultMethod1
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
31 */
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
32 interface I1 {
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
33 default public int m() { return 0; }
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
34 }
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
35
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
36 interface I2 extends I1 {
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
37 default public int m() { return 1; }
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
38 }
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
39
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
40 abstract class A implements I1 {
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
41 }
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
42
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
43 class B extends A implements I2 {
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
44 }
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
45
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
46 public class InlineDefaultMethod1 {
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
47 public static void test(A obj) {
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
48 int id = obj.m();
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
49 if (id != 1) {
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
50 throw new AssertionError("Called wrong method: 1 != "+id);
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
51 }
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
52 }
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
53
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
54 public static void main(String[] args) throws InterruptedException {
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
55 test(new B());
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
56 System.out.println("TEST PASSED");
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
57 }
e65d960c7be5 8036100: Default method returns true for a while, and then returns false
vlivanov
parents:
diff changeset
58 }