1 /*
   2  * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 package org.graalvm.compiler.jtt.micro;
  24 
  25 import org.junit.Before;
  26 import org.junit.Test;
  27 
  28 import org.graalvm.compiler.jtt.JTTTest;
  29 
  30 /*
  31  */
  32 public class InvokeInterface_03 extends JTTTest {
  33 
  34     interface I {
  35 
  36         int plus(int a);
  37     }
  38 
  39     abstract static class A implements I {
  40     }
  41 
  42     static class C1 extends A {
  43 
  44         @Override
  45         public int plus(int a) {
  46             return a;
  47         }
  48     }
  49 
  50     static class C2 extends A {
  51 
  52         @Override
  53         public int plus(int a) {
  54             return a;
  55         }
  56     }
  57 
  58     static class C3 extends A {
  59 
  60         @Override
  61         public int plus(int a) {
  62             return a;
  63         }
  64     }
  65 
  66     static class C4 extends A {
  67 
  68         @Override
  69         public int plus(int a) {
  70             return a;
  71         }
  72     }
  73 
  74     static class C5 extends A {
  75 
  76         @Override
  77         public int plus(int a) {
  78             return a;
  79         }
  80     }
  81 
  82     static class C6 extends A {
  83 
  84         @Override
  85         public int plus(int a) {
  86             return a;
  87         }
  88     }
  89 
  90     static class C7 extends A {
  91 
  92         @Override
  93         public int plus(int a) {
  94             return a;
  95         }
  96     }
  97 
  98     static class C8 extends A {
  99 
 100         @Override
 101         public int plus(int a) {
 102             return a;
 103         }
 104     }
 105 
 106     static class C9 extends A {
 107 
 108         @Override
 109         public int plus(int a) {
 110             return a;
 111         }
 112     }
 113 
 114     static class C10 extends A {
 115 
 116         @Override
 117         public int plus(int a) {
 118             return a;
 119         }
 120     }
 121 
 122     static class C11 extends A {
 123 
 124         @Override
 125         public int plus(int a) {
 126             return a;
 127         }
 128     }
 129 
 130     static class C12 extends A {
 131 
 132         @Override
 133         public int plus(int a) {
 134             return a;
 135         }
 136     }
 137 
 138     static class C13 extends A {
 139 
 140         @Override
 141         public int plus(int a) {
 142             return a;
 143         }
 144     }
 145 
 146     static class C14 extends A {
 147 
 148         @Override
 149         public int plus(int a) {
 150             return a;
 151         }
 152     }
 153 
 154     static class C15 extends A {
 155 
 156         @Override
 157         public int plus(int a) {
 158             return a;
 159         }
 160     }
 161 
 162     public static int test(I i, int a) {
 163         return i.plus(a);
 164     }
 165 
 166     @Before
 167     public void setUp() {
 168         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()};
 169         int a = 0;
 170         for (I i : x) {
 171             i.plus(a++);
 172         }
 173     }
 174 
 175     @Test
 176     public void run0() throws Throwable {
 177         runTest("test", new C1(), 0);
 178     }
 179 
 180     @Test
 181     public void run1() throws Throwable {
 182         runTest("test", new C2(), 1);
 183     }
 184 
 185 }