buzbee | 109bd6a | 2011-09-06 13:58:41 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2011 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
Brian Carlstrom | 25c3325 | 2011-09-18 15:58:35 -0700 | [diff] [blame] | 17 | class Invoke implements InvokeInterface { |
buzbee | 109bd6a | 2011-09-06 13:58:41 -0700 | [diff] [blame] | 18 | |
| 19 | int virI_I(int a) { |
| 20 | return a + 123; |
| 21 | } |
| 22 | |
| 23 | int virI_II(int a, int b) { |
| 24 | return a + b + 321; |
| 25 | } |
| 26 | |
| 27 | int virI_III(int a, int b, int c) { |
| 28 | return a + b + c + 432; |
| 29 | } |
| 30 | |
| 31 | int virI_IIII(int a, int b, int c, int d) { |
| 32 | return a + b + c + d + 919; |
| 33 | } |
| 34 | |
| 35 | int virI_IIIII(int a, int b, int c, int d, int e) { |
| 36 | return a + b + c + d + e + 1010; |
| 37 | } |
| 38 | |
| 39 | int virI_IIIIII(int a, int b, int c, int d, int e, int f) { |
| 40 | return a + b + c + d + e + f + 2020; |
| 41 | } |
| 42 | |
| 43 | static int statI_I(int a) { |
| 44 | return a + 123; |
| 45 | } |
| 46 | |
| 47 | static int statI_II(int a, int b) { |
| 48 | return a + b + 321; |
| 49 | } |
| 50 | |
| 51 | static int statI_III(int a, int b, int c) { |
| 52 | return a + b + c + 432; |
| 53 | } |
| 54 | |
| 55 | static int statI_IIII(int a, int b, int c, int d) { |
| 56 | return a + b + c + d + 919; |
| 57 | } |
| 58 | |
| 59 | static int statI_IIIII(int a, int b, int c, int d, int e) { |
| 60 | return a + b + c + d + e + 1010; |
| 61 | } |
| 62 | |
| 63 | static int statI_IIIIII(int a, int b, int c, int d, int e, int f) { |
| 64 | return a + b + c + d + e + f + 2020; |
| 65 | } |
| 66 | |
Brian Carlstrom | 25c3325 | 2011-09-18 15:58:35 -0700 | [diff] [blame] | 67 | public int interfaceMethod(int i) { |
| 68 | return i + 23; |
| 69 | } |
| 70 | |
| 71 | static int invoke(int a) { |
buzbee | 109bd6a | 2011-09-06 13:58:41 -0700 | [diff] [blame] | 72 | Invoke foo = new Invoke(); |
| 73 | |
| 74 | return foo.virI_I(a) + |
| 75 | foo.virI_II(a, 1) + |
| 76 | foo.virI_III(a, 1, 2) + |
| 77 | foo.virI_IIII(a, 1, 2, 3) + |
| 78 | foo.virI_IIIII(a, 1, 2, 3, 4) + |
| 79 | foo.virI_IIIIII(a, 1, 2, 3, 4, 5) + |
| 80 | statI_I(a) + |
| 81 | statI_II(a, 1) + |
| 82 | statI_III(a, 1, 2) + |
| 83 | statI_IIII(a, 1, 2, 3) + |
| 84 | statI_IIIII(a, 1, 2, 3, 4) + |
Brian Carlstrom | 25c3325 | 2011-09-18 15:58:35 -0700 | [diff] [blame] | 85 | statI_IIIIII(a, 1, 2, 3, 4, 5) + |
| 86 | foo.interfaceMethod(a); |
buzbee | 109bd6a | 2011-09-06 13:58:41 -0700 | [diff] [blame] | 87 | } |
| 88 | |
| 89 | public static void main(String[] args) { |
Brian Carlstrom | 25c3325 | 2011-09-18 15:58:35 -0700 | [diff] [blame] | 90 | boolean failure = false; |
| 91 | int res = invoke(912); |
| 92 | if (res == 21599) { |
| 93 | System.out.println("invoke PASSED"); |
buzbee | 109bd6a | 2011-09-06 13:58:41 -0700 | [diff] [blame] | 94 | } else { |
Brian Carlstrom | 25c3325 | 2011-09-18 15:58:35 -0700 | [diff] [blame] | 95 | System.out.println("invoke FAILED: " + res); |
| 96 | failure = true; |
buzbee | 109bd6a | 2011-09-06 13:58:41 -0700 | [diff] [blame] | 97 | } |
Brian Carlstrom | 25c3325 | 2011-09-18 15:58:35 -0700 | [diff] [blame] | 98 | System.exit(failure ? 1 : 0); |
buzbee | 109bd6a | 2011-09-06 13:58:41 -0700 | [diff] [blame] | 99 | } |
| 100 | } |
Brian Carlstrom | 25c3325 | 2011-09-18 15:58:35 -0700 | [diff] [blame] | 101 | |
| 102 | interface InvokeInterface { |
| 103 | int interfaceMethod(int i); |
| 104 | } |