xref: /aosp_15_r20/art/test/2237-checker-inline-multidex/src-multidex/Multi.java (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1 /*
2  * Copyright (C) 2021 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 Multi {
$inline$NeedsEnvironmentMultiDex(String str)18   public static String $inline$NeedsEnvironmentMultiDex(String str) {
19     // StringBuilderAppend needs an environment but it doesn't need a .bss entry.
20     StringBuilder sb = new StringBuilder();
21     return sb.append(str).toString();
22   }
23 
$inline$NeedsBssEntryStringMultiDex()24   public static String $inline$NeedsBssEntryStringMultiDex() {
25     return "this-string-will-never-be-in-RO";
26   }
27 
$noinline$InnerInvokeMultiDex()28   private static String $noinline$InnerInvokeMultiDex() {
29     return "this-string-will-never-be-in-RO-too";
30   }
31 
$inline$NeedsBssEntryInvokeMultiDex()32   public static String $inline$NeedsBssEntryInvokeMultiDex() {
33     return $noinline$InnerInvokeMultiDex();
34   }
35 
NeedsBssEntryClassMultiDex()36   public static Class<?> NeedsBssEntryClassMultiDex() {
37     return Multi2.class;
38   }
39 
40   private class Multi2 {}
41 
$inline$TryCatch(String str)42   public static int $inline$TryCatch(String str) {
43     try {
44       return Integer.parseInt(str);
45     } catch (NumberFormatException ex) {
46       return -1;
47     }
48   }
49 }
50