001/* 002 * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved. 003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 004 * 005 * This code is free software; you can redistribute it and/or modify it 006 * under the terms of the GNU General Public License version 2 only, as 007 * published by the Free Software Foundation. 008 * 009 * This code is distributed in the hope that it will be useful, but WITHOUT 010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 011 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 012 * version 2 for more details (a copy is included in the LICENSE file that 013 * accompanied this code). 014 * 015 * You should have received a copy of the GNU General Public License version 016 * 2 along with this work; if not, write to the Free Software Foundation, 017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 018 * 019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 020 * or visit www.oracle.com if you need additional information or have any 021 * questions. 022 */ 023package com.oracle.graal.jtt.micro; 024 025import org.junit.*; 026 027import com.oracle.graal.jtt.*; 028 029/* 030 */ 031public class InvokeInterface_04 extends JTTTest { 032 033 interface I { 034 035 int plus(int a); 036 } 037 038 abstract static class A implements I { 039 @Override 040 public abstract int plus(int a); 041 } 042 043 static class C1 extends A { 044 045 @Override 046 public int plus(int a) { 047 return a; 048 } 049 } 050 051 static class C2 extends A { 052 053 @Override 054 public int plus(int a) { 055 return a; 056 } 057 } 058 059 static class C3 extends A { 060 061 @Override 062 public int plus(int a) { 063 return a; 064 } 065 } 066 067 static class C4 extends A { 068 069 @Override 070 public int plus(int a) { 071 return a; 072 } 073 } 074 075 static class C5 extends A { 076 077 @Override 078 public int plus(int a) { 079 return a; 080 } 081 } 082 083 static class C6 extends A { 084 085 @Override 086 public int plus(int a) { 087 return a; 088 } 089 } 090 091 static class C7 extends A { 092 093 @Override 094 public int plus(int a) { 095 return a; 096 } 097 } 098 099 static class C8 extends A { 100 101 @Override 102 public int plus(int a) { 103 return a; 104 } 105 } 106 107 static class C9 extends A { 108 109 @Override 110 public int plus(int a) { 111 return a; 112 } 113 } 114 115 static class C10 extends A { 116 117 @Override 118 public int plus(int a) { 119 return a; 120 } 121 } 122 123 static class C11 extends A { 124 125 @Override 126 public int plus(int a) { 127 return a; 128 } 129 } 130 131 static class C12 extends A { 132 133 @Override 134 public int plus(int a) { 135 return a; 136 } 137 } 138 139 static class C13 extends A { 140 141 @Override 142 public int plus(int a) { 143 return a; 144 } 145 } 146 147 static class C14 extends A { 148 149 @Override 150 public int plus(int a) { 151 return a; 152 } 153 } 154 155 static class C15 extends A { 156 157 @Override 158 public int plus(int a) { 159 return a; 160 } 161 } 162 163 public static int test(I i, int a) { 164 return i.plus(a); 165 } 166 167 @Before 168 public void setUp() { 169 I[] x = new I[]{new C1(), new C2(), new C3(), new C4(), new C5(), new C6(), new C7(), new C8(), new C9(), new C10(), new C11(), new C12(), new C13(), new C14(), new C15()}; 170 int a = 0; 171 for (I i : x) { 172 i.plus(a++); 173 } 174 } 175 176 @Test 177 public void run0() throws Throwable { 178 runTest("test", new C1(), 0); 179 } 180 181 @Test 182 public void run1() throws Throwable { 183 runTest("test", new C2(), 1); 184 } 185 186}