1 /*
2  * Copyright (C) 2023 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 package com.android.hoststubgen.test.tinyframework;
17 
18 import android.hosttest.annotation.HostSideTestWholeClassStub;
19 
20 import java.util.function.Supplier;
21 
22 @HostSideTestWholeClassStub
23 public class TinyFrameworkNestedClasses {
24     public final Supplier<Integer> mSupplier = new Supplier<Integer>() {
25         @Override
26         public Integer get() {
27             return 1;
28         }
29     };
30 
31     public static final Supplier<Integer> sSupplier =  new Supplier<Integer>() {
32         @Override
33         public Integer get() {
34             return 2;
35         }
36     };
getSupplier()37     public Supplier<Integer> getSupplier() {
38         return new Supplier<Integer>() {
39             @Override
40             public Integer get() {
41                 return 3;
42             }
43         };
44     }
45 
46     public static Supplier<Integer> getSupplier_static() {
47         return new Supplier<Integer>() {
48             @Override
49             public Integer get() {
50                 return 4;
51             }
52         };
53     }
54 
55     @HostSideTestWholeClassStub
56     public class InnerClass {
57         public int value = 5;
58     }
59 
60     @HostSideTestWholeClassStub
61     public static class StaticNestedClass {
62         public int value = 6;
63 
64         // Double-nest
65         public static Supplier<Integer> getSupplier_static() {
66             return new Supplier<Integer>() {
67                 @Override
68                 public Integer get() {
69                     return 7;
70                 }
71             };
72         }
73     }
74 
75     public static class BaseClass {
76         public int value;
77         public BaseClass(int x) {
78             value = x;
79         }
80     }
81 
82     public static class SubClass extends BaseClass {
83         public SubClass(int x) {
84             super(x);
85         }
86     }
87 }
88