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.HostSideTestStaticInitializerKeep; 19 import android.hosttest.annotation.HostSideTestStub; 20 21 import java.util.function.Supplier; 22 23 24 /** 25 * In this class, we explicitly mark each member as "stub". (rather than using WholeClassStub) 26 * 27 * This means the actual generated lambda functions would be removed by default. 28 * 29 * Implicit filter should take care of them. 30 */ 31 @HostSideTestStub 32 @HostSideTestStaticInitializerKeep 33 public class TinyFrameworkLambdas { 34 @HostSideTestStub TinyFrameworkLambdas()35 public TinyFrameworkLambdas() { 36 } 37 38 @HostSideTestStub 39 public final Supplier<Integer> mSupplier = () -> 1; 40 41 @HostSideTestStub 42 public static final Supplier<Integer> sSupplier = () -> 2; 43 44 @HostSideTestStub getSupplier()45 public Supplier<Integer> getSupplier() { 46 return () -> 3; 47 } 48 49 @HostSideTestStub getSupplier_static()50 public static Supplier<Integer> getSupplier_static() { 51 return () -> 4; 52 } 53 54 @HostSideTestStub 55 @HostSideTestStaticInitializerKeep 56 public static class Nested { 57 @HostSideTestStub Nested()58 public Nested() { 59 } 60 61 @HostSideTestStub 62 public final Supplier<Integer> mSupplier = () -> 5; 63 64 @HostSideTestStub 65 public static final Supplier<Integer> sSupplier = () -> 6; 66 67 @HostSideTestStub getSupplier()68 public Supplier<Integer> getSupplier() { 69 return () -> 7; 70 } 71 72 @HostSideTestStub getSupplier_static()73 public static Supplier<Integer> getSupplier_static() { 74 return () -> 8; 75 } 76 } 77 } 78