1 /* 2 * Copyright 2019 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.annotation.experimental 18 19 import kotlin.annotation.Retention 20 import kotlin.annotation.Target 21 22 /** 23 * Denotes that the annotated element is a marker of an experimental API. 24 * 25 * Any declaration annotated with this marker is considered part of an unstable API surface and its 26 * call sites should accept the experimental aspect of it either by using [UseExperimental], or by 27 * being annotated with that marker themselves, effectively causing further propagation of that 28 * experimental aspect. 29 */ 30 @Deprecated( 31 "This annotation has been replaced by `@RequiresOptIn`", 32 ReplaceWith("RequiresOptIn", "androidx.annotation.RequiresOptIn") 33 ) 34 @Retention(AnnotationRetention.BINARY) 35 @Target(AnnotationTarget.ANNOTATION_CLASS) 36 public annotation class Experimental( 37 /** Defines the reporting level for incorrect usages of this experimental API. */ 38 public val level: Level = Level.ERROR 39 ) { 40 /** 41 * Severity of the diagnostic that should be reported on usages of experimental API which did 42 * not explicitly accept the experimental aspect of that API either by using [UseExperimental] 43 * or by being annotated with the corresponding marker annotation. 44 */ 45 public enum class Level { 46 /** 47 * Specifies that a warning should be reported on incorrect usages of this experimental API. 48 */ 49 WARNING, 50 51 /** 52 * Specifies that an error should be reported on incorrect usages of this experimental API. 53 */ 54 ERROR 55 } 56 } 57