1 /*
2  * Copyright 2021 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
18 
19 /**
20  * This annotation can be applied to [Composable] functions so that no group will be generated
21  * around the body of the function it annotates. This is not safe unless the body of the function
22  * and any functions that it calls only executes "read" operations on the passed in composer. This
23  * will result in slightly more efficient code.
24  *
25  * A common use case for this are for functions that only need to be composable in order to read
26  * [CompositionLocal] values, but don't call any other composables.
27  *
28  * Caution: Use of this annotation means that the annotated declaration *MUST* comply with this
29  * contract, or else the resulting code's behavior will be undefined.
30  */
31 @MustBeDocumented
32 @Retention(AnnotationRetention.BINARY)
33 @Target(AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY_GETTER)
34 annotation class ReadOnlyComposable
35