xref: /aosp_15_r20/art/test/732-checker-app-image/src-ex/Secondary.java (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1 /*
2  * Copyright (C) 2024 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 Secondary {
main()18     public static void main() {
19         System.out.println($noinline$getSecondaryAppImageClass().getName());
20         System.out.println($noinline$getSecondaryNonAppImageClass().getName());
21         System.out.println($noinline$getSecondaryClassWithUnmetDependency().getName());
22     }
23 
24     /// CHECK-START: java.lang.Class Secondary.$noinline$getSecondaryAppImageClass() builder (after)
25     /// CHECK:            LoadClass load_kind:AppImageRelRo in_image:true
$noinline$getSecondaryAppImageClass()26     public static Class<?> $noinline$getSecondaryAppImageClass() {
27         return SecondaryAppImageClass.class;
28     }
29 
30     /// CHECK-START: java.lang.Class Secondary.$noinline$getSecondaryNonAppImageClass() builder (after)
31     /// CHECK:            LoadClass load_kind:BssEntry in_image:false
$noinline$getSecondaryNonAppImageClass()32     public static Class<?> $noinline$getSecondaryNonAppImageClass() {
33         return SecondaryNonAppImageClass.class;
34     }
35 
36     /// CHECK-START: java.lang.Class Secondary.$noinline$getSecondaryClassWithUnmetDependency() builder (after)
37     /// CHECK:            LoadClass load_kind:BssEntry in_image:false
$noinline$getSecondaryClassWithUnmetDependency()38     public static Class<?> $noinline$getSecondaryClassWithUnmetDependency() {
39         return SecondaryClassWithUnmetDependency.class;
40     }
41 }
42 
43 class SecondaryAppImageClass {  // Included in the profile.
44 }
45 
46 class SecondaryNonAppImageClass {  // Not included in the profile.
47 }
48 
49 // Included in the profile but with interface defined in parent class loader
50 // and therefore unsuitable for inclusion in the app image.
51 class SecondaryClassWithUnmetDependency implements PrimaryInterface {}
52