Home | History | Annotate | Download | only in src
      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 
     17 class Main implements InvokeInterface {
     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 
     67     public int interfaceMethod(int i) {
     68         return i + 23;
     69     }
     70 
     71     static int invoke(int a) {
     72         Main foo = new Main();
     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) +
     85                statI_IIIIII(a, 1, 2, 3, 4, 5) +
     86                foo.interfaceMethod(a);
     87     }
     88 
     89     public static void main(String[] args) {
     90         boolean failure = false;
     91         int res = invoke(912);
     92         if (res == 21599) {
     93             System.out.println("invoke PASSED");
     94         } else {
     95             System.out.println("invoke FAILED: " + res);
     96             failure = true;
     97         }
     98         System.exit(failure ? 1 : 0);
     99     }
    100 }
    101 
    102 interface InvokeInterface {
    103     int interfaceMethod(int i);
    104 }
    105