From 5c17148146a9c9e3b4a8686ae68571f68915c91c Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Wed, 3 Jul 2019 15:41:34 +0300 Subject: [PATCH] [Core API] Introduce TypeRefinement annotations --- .../kotlin/types/refinement/annotations.kt | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 core/descriptors/src/org/jetbrains/kotlin/types/refinement/annotations.kt diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/refinement/annotations.kt b/core/descriptors/src/org/jetbrains/kotlin/types/refinement/annotations.kt new file mode 100644 index 00000000000..dbc7f64c3ef --- /dev/null +++ b/core/descriptors/src/org/jetbrains/kotlin/types/refinement/annotations.kt @@ -0,0 +1,23 @@ +/* + * Copyright 2010-2019 JetBrains s.r.o. and Kotlin Programming Language contributors. + * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.types.refinement + +/** + * This annotation marks part of internal compiler API related to type refinement. + * + * Marking such API explicitly has two objectives: + * - prevent unconscious abuse of invasive API (like DelegatingSimpleType.replaceDelegate), + * which shouldn't be needed by anything outside of type refinement + * - improve readability of classes by separating API + * + * If you're using related API outside of MPP context, it's a nice idea to consider + * either finding some other API or removing @TypeRefinement (and thus "publishing" + * API for broader use) + */ +@Experimental(level = Experimental.Level.ERROR) +@Retention(AnnotationRetention.BINARY) +@Target(AnnotationTarget.CLASS, AnnotationTarget.FUNCTION, AnnotationTarget.PROPERTY) +annotation class TypeRefinement