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_04 extends JTTTest {
  33 
  34     interface I {
  35 
  36         int plus(int a);
  37     }
  38 
  39     abstract static class A implements I {
  40         @Override
  41         public abstract int plus(int a);
  42     }
  43 
  44     static class C1 extends A {
  45 
  46         @Override
  47         public int plus(int a) {
  48             return a;
  49         }
  50     }
  51 
  52     static class C2 extends A {
  53 
  54         @Override
  55         public int plus(int a) {
  56             return a;
  57         }
  58     }
  59 
  60     static class C3 extends A {
  61 
  62         @Override
  63         public int plus(int a) {
  64             return a;
  65         }
  66     }
  67 
  68     static class C4 extends A {
  69 
  70         @Override
  71         public int plus(int a) {
  72             return a;
  73         }
  74     }
  75 
  76     static class C5 extends A {
  77 
  78         @Override
  79         public int plus(int a) {
  80             return a;
  81         }
  82     }
  83 
  84     static class C6 extends A {
  85 
  86         @Override
  87         public int plus(int a) {
  88             return a;
  89         }
  90     }
  91 
  92     static class C7 extends A {
  93 
  94         @Override
  95         public int plus(int a) {
  96             return a;
  97         }
  98     }
  99 
 100     static class C8 extends A {
 101 
 102         @Override
 103         public int plus(int a) {
 104             return a;
 105         }
 106     }
 107 
 108     static class C9 extends A {
 109 
 110         @Override
 111         public int plus(int a) {
 112             return a;
 113         }
 114     }
 115 
 116     static class C10 extends A {
 117 
 118         @Override
 119         public int plus(int a) {
 120             return a;
 121         }
 122     }
 123 
 124     static class C11 extends A {
 125 
 126         @Override
 127         public int plus(int a) {
 128             return a;
 129         }
 130     }
 131 
 132     static class C12 extends A {
 133 
 134         @Override
 135         public int plus(int a) {
 136             return a;
 137         }
 138     }
 139 
 140     static class C13 extends A {
 141 
 142         @Override
 143         public int plus(int a) {
 144             return a;
 145         }
 146     }
 147 
 148     static class C14 extends A {
 149 
 150         @Override
 151         public int plus(int a) {
 152             return a;
 153         }
 154     }
 155 
 156     static class C15 extends A {
 157 
 158         @Override
 159         public int plus(int a) {
 160             return a;
 161         }
 162     }
 163 
 164     public static int test(I i, int a) {
 165         return i.plus(a);
 166     }
 167 
 168     @Before
 169     public void setUp() {
 170         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()};
 171         int a = 0;
 172         for (I i : x) {
 173             i.plus(a++);
 174         }
 175     }
 176 
 177     @Test
 178     public void run0() throws Throwable {
 179         runTest("test", new C1(), 0);
 180     }
 181 
 182     @Test
 183     public void run1() throws Throwable {
 184         runTest("test", new C2(), 1);
 185     }
 186 
 187 }