Nicolas Geoffray | e53798a | 2014-12-01 10:31:54 +0000 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2014 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 | public class Main { |
| 18 | public static void main(String[] args) { |
| 19 | if ($opt$inline$returnInt() != 4) { |
| 20 | throw new Error(); |
| 21 | } |
| 22 | |
| 23 | if ($opt$inline$returnParameter(42) != 42) { |
| 24 | throw new Error(); |
| 25 | } |
| 26 | |
| 27 | if ($opt$inline$returnWide() != 12L) { |
| 28 | throw new Error(); |
| 29 | } |
| 30 | |
| 31 | if ($opt$inline$returnWideParameter(0x100000001L) != 0x100000001L) { |
| 32 | throw new Error(); |
| 33 | } |
| 34 | |
| 35 | if ($opt$inline$returnReferenceParameter(Main.class) != Main.class) { |
| 36 | throw new Error(); |
| 37 | } |
| 38 | |
| 39 | $opt$inline$returnVoid(); |
| 40 | $opt$inline$returnVoidWithOneParameter(32); |
| 41 | |
| 42 | if ($opt$inline$returnAdd(42, 1) != 43) { |
| 43 | throw new Error(); |
| 44 | } |
| 45 | |
| 46 | if ($opt$inline$returnSub(42, 1) != 41) { |
| 47 | throw new Error(); |
| 48 | } |
| 49 | } |
| 50 | |
| 51 | public static int $opt$inline$returnParameter(int a) { |
| 52 | return a; |
| 53 | } |
| 54 | |
| 55 | public static int $opt$inline$returnAdd(int a, int b) { |
| 56 | return a + b; |
| 57 | } |
| 58 | |
| 59 | public static int $opt$inline$returnSub(int a, int b) { |
| 60 | return a - b; |
| 61 | } |
| 62 | |
| 63 | public static int $opt$inline$returnInt() { |
| 64 | return 4; |
| 65 | } |
| 66 | |
| 67 | public static long $opt$inline$returnWideParameter(long a) { |
| 68 | return a; |
| 69 | } |
| 70 | |
| 71 | public static long $opt$inline$returnWide() { |
| 72 | return 12L; |
| 73 | } |
| 74 | |
| 75 | public static Object $opt$inline$returnReferenceParameter(Object o) { |
| 76 | return o; |
| 77 | } |
| 78 | |
| 79 | public static void $opt$inline$returnVoid() { |
| 80 | return; |
| 81 | } |
| 82 | |
| 83 | public static void $opt$inline$returnVoidWithOneParameter(int a) { |
| 84 | return; |
| 85 | } |
| 86 | } |