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_01 extends JTTTest { 032 033 interface I { 034 035 int plus(int a); 036 } 037 038 abstract static class A implements I { 039 040 public int plus(int a) { 041 return a; 042 } 043 } 044 045 static class C1 extends A { 046 } 047 048 static class C2 extends A { 049 } 050 051 static class C3 extends A { 052 } 053 054 static class C4 extends A { 055 } 056 057 static class C5 extends A { 058 } 059 060 static class C6 extends A { 061 } 062 063 static class C7 extends A { 064 } 065 066 static class C8 extends A { 067 } 068 069 static class C9 extends A { 070 } 071 072 static class C10 extends A { 073 } 074 075 static class C11 extends A { 076 } 077 078 static class C12 extends A { 079 } 080 081 static class C13 extends A { 082 } 083 084 static class C14 extends A { 085 } 086 087 static class C15 extends A { 088 } 089 090 public static int test(I i, int a) { 091 return i.plus(a); 092 } 093 094 @Before 095 public void setUp() { 096 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()}; 097 int a = 0; 098 for (I i : x) { 099 i.plus(a++); 100 } 101 } 102 103 @Test 104 public void run0() throws Throwable { 105 runTest("test", new C1(), 0); 106 } 107 108 @Test 109 public void run1() throws Throwable { 110 runTest("test", new C2(), 1); 111 } 112 113}