1 /* 2 * Copyright 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 17 package androidx.compose.runtime.snapshots 18 19 /** 20 * This annotation designates that a property on a [State] class will autobox when it is read from 21 * or assigned to. This is helpful for state APIs like [IntState], which define an alternative value 22 * property that does not box while maintaining compatibility with the generic [`State<T>`][State] 23 * API. 24 * 25 * Whenever a property that is annotated with `AutoboxingStateValueProperty` is accessed in code, it 26 * will be flagged with a warning and will suggest using an alternative, non-boxing property 27 * instead. 28 */ 29 @Retention(AnnotationRetention.BINARY) 30 @Target(AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.PROPERTY_GETTER) 31 annotation class AutoboxingStateValueProperty( 32 /** 33 * An alternative, non-boxing property that can be used instead of the annotated property. The 34 * property indicated in this property should contain the exact same value as the annotated 35 * property and should be observed in Compose in the same way, meaning that the designated 36 * replacement property can serve as a drop-in replacement to the annotated property. 37 * 38 * This property name will be used for suggesting quick fixes. It must match the suggested 39 * property name exactly, including its case. 40 */ 41 @Suppress("unused") // Used by lint 42 val preferredPropertyName: String 43 ) 44