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_02 extends JTTTest {
  33 
  34     interface I {
  35 
  36         int plus(int a);
  37     }
  38 
  39     static class A implements I {
  40 
  41         @Override
  42         public int plus(int a) {
  43             return a;
  44         }
  45     }
  46 
  47     static class C1 extends A {
  48     }
  49 
  50     static class C2 extends A {
  51     }
  52 
  53     static class C3 extends A {
  54     }
  55 
  56     static class C4 extends A {
  57     }
  58 
  59     static class C5 extends A {
  60     }
  61 
  62     static class C6 extends A {
  63     }
  64 
  65     static class C7 extends A {
  66     }
  67 
  68     static class C8 extends A {
  69     }
  70 
  71     static class C9 extends A {
  72     }
  73 
  74     static class C10 extends A {
  75     }
  76 
  77     static class C11 extends A {
  78     }
  79 
  80     static class C12 extends A {
  81     }
  82 
  83     static class C13 extends A {
  84     }
  85 
  86     static class C14 extends A {
  87     }
  88 
  89     static class C15 extends A {
  90     }
  91 
  92     public static int test(I i, int a) {
  93         return i.plus(a);
  94     }
  95 
  96     @Before
  97     public void setUp() {
  98         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()};
  99         int a = 0;
 100         for (I i : x) {
 101             i.plus(a++);
 102         }
 103     }
 104 
 105     @Test
 106     public void run0() throws Throwable {
 107         runTest("test", new C1(), 0);
 108     }
 109 
 110     @Test
 111     public void run1() throws Throwable {
 112         runTest("test", new C2(), 1);
 113     }
 114 
 115 }