---
title: "AutoboxingStateValueProperty"
description: "This annotation designates that a property on a [State] class will autobox when it is read from
or assigned to. This is helpful for state APIs like [androidx.compose.runtime.IntState], which
define an alternative value property that does not box while maintaining compatibility with the
generic [`State<T>`][State] API.

Whenever a property that is annotated with `AutoboxingStateValueProperty` is accessed in code, it
will be flagged with a warning and will suggest using an alternative, non-boxing property
instead."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
@Target(AnnotationTarget.PROPERTY_SETTER, AnnotationTarget.PROPERTY_GETTER)
public annotation class AutoboxingStateValueProperty(
    /**
     * An alternative, non-boxing property that can be used instead of the annotated property. The
     * property indicated in this property should contain the exact same value as the annotated
     * property and should be observed in Compose in the same way, meaning that the designated
     * replacement property can serve as a drop-in replacement to the annotated property.
     *
     * This property name will be used for suggesting quick fixes. It must match the suggested
     * property name exactly, including its case.
     */
    @Suppress("unused") // Used by lint
    val preferredPropertyName: String
)
```


This annotation designates that a property on a `State` class will autobox when it is read from
or assigned to. This is helpful for state APIs like `androidx.compose.runtime.IntState`, which
define an alternative value property that does not box while maintaining compatibility with the
generic ``State<T>`` API.

Whenever a property that is annotated with `AutoboxingStateValueProperty` is accessed in code, it
will be flagged with a warning and will suggest using an alternative, non-boxing property
instead.



