1 /* 2 * Copyright (C) 2022 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 package dalvik.annotation.optimization; 18 19 import static android.annotation.SystemApi.Client.MODULE_LIBRARIES; 20 21 import android.annotation.SystemApi; 22 23 import java.lang.annotation.ElementType; 24 import java.lang.annotation.Retention; 25 import java.lang.annotation.RetentionPolicy; 26 import java.lang.annotation.Target; 27 28 /** 29 * Indicates that an API should never be inlined. 30 * 31 * <p> 32 * NeverInline can be used to annotate methods that should not be inlined into other methods. 33 * Methods that are not called frequently, are never speed-critical, or are only used for 34 * debugging do not necessarily need to run quickly. Applying this annotation to prevent these 35 * methods from being inlined will return some size improvements in .odex files. 36 * </p> 37 * 38 * <p> 39 * The <code>fillInStackTrace</code> method in java.lang.Throwable can be used as a concrete 40 * example. This is a method that fills in the execution stack trace and it is not used for 41 * performance. Annotating this method with NeverInline can be seen to significantly reduce 42 * the size of services.odex. 43 * </p> 44 * @hide 45 */ 46 @SystemApi(client = MODULE_LIBRARIES) 47 @Retention(RetentionPolicy.CLASS) 48 @Target({ElementType.CONSTRUCTOR, ElementType.METHOD}) 49 public @interface NeverInline {} 50