Introduce RequiresOptIn and OptIn annotations

RequiresOptIn should be used now instead of Experimental, OptIn instead
of UseExperimental. See https://github.com/Kotlin/KEEP/pull/201.

This change adds the new declarations only to the stdlib, and supports
them in the compiler. Because of the way compiler loads annotations, we
need to bootstrap it first before deprecating the old annotations and
updating tests.

 #KT-34647 Fixed
This commit is contained in:
Alexander Udalov
2019-12-13 21:11:48 +03:00
parent 33bc3db144
commit cdbabf224f
17 changed files with 119 additions and 39 deletions
@@ -210,7 +210,9 @@ private val OVERRIDE_RENDERER = withOptions {
typeNormalizer = IdeDescriptorRenderers.APPROXIMATE_FLEXIBLE_TYPES
renderUnabbreviatedType = false
annotationFilter = {
it.type.constructor.declarationDescriptor?.annotations?.hasAnnotation(ExperimentalUsageChecker.EXPERIMENTAL_FQ_NAME) ?: false
val annotations = it.type.constructor.declarationDescriptor?.annotations
annotations != null && (annotations.hasAnnotation(ExperimentalUsageChecker.REQUIRES_OPT_IN_FQ_NAME) ||
annotations.hasAnnotation(ExperimentalUsageChecker.OLD_EXPERIMENTAL_FQ_NAME))
}
presentableUnresolvedTypes = true
informativeErrorType = false