From 89c9646e2f38c6afd21896332dbe67f4e7c3a325 Mon Sep 17 00:00:00 2001 From: Yan Zhulanow Date: Mon, 14 Nov 2022 22:49:56 +0900 Subject: [PATCH] [FE] Restore source compatibility in KtPsiFactory Prevent huge code migration in kt- release branches by returning the previously available API in deprecated status. --- .../org/jetbrains/kotlin/psi/KtPsiFactory.kt | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/compiler/psi/src/org/jetbrains/kotlin/psi/KtPsiFactory.kt b/compiler/psi/src/org/jetbrains/kotlin/psi/KtPsiFactory.kt index d36ceb3ee0c..649bac4c16e 100644 --- a/compiler/psi/src/org/jetbrains/kotlin/psi/KtPsiFactory.kt +++ b/compiler/psi/src/org/jetbrains/kotlin/psi/KtPsiFactory.kt @@ -25,15 +25,23 @@ import org.jetbrains.kotlin.utils.checkWithAttachment @JvmOverloads @JvmName("KtPsiFactory") -@Suppress("FunctionName", "unused") -@Deprecated("Use 'KtPsiFactory' constructor instead", level = DeprecationLevel.HIDDEN) -fun KtPsiFactoryOld(project: Project?, markGenerated: Boolean = true): KtPsiFactory = KtPsiFactory(project!!, markGenerated) +@Suppress("unused") +@Deprecated( + "Use 'KtPsiFactory' constructor instead", + level = DeprecationLevel.WARNING, + replaceWith = ReplaceWith("KtPsiFactory(project!!, markGenerated)", "org.jetbrains.kotlin.psi.KtPsiFactory") +) +fun KtPsiFactory(project: Project?, markGenerated: Boolean = true): KtPsiFactory = KtPsiFactory(project!!, markGenerated) @JvmOverloads @JvmName("KtPsiFactory") -@Suppress("FunctionName", "unused") -@Deprecated("Use 'KtPsiFactory' constructor instead", level = DeprecationLevel.HIDDEN) -fun KtPsiFactoryOld(elementForProject: PsiElement, markGenerated: Boolean = true): KtPsiFactory = +@Suppress("unused") +@Deprecated( + "Use 'KtPsiFactory' constructor instead", + level = DeprecationLevel.WARNING, + replaceWith = ReplaceWith("KtPsiFactory(elementForProject.project, markGenerated)", "org.jetbrains.kotlin.psi.KtPsiFactory") +) +fun KtPsiFactory(elementForProject: PsiElement, markGenerated: Boolean = true): KtPsiFactory = KtPsiFactory(elementForProject.project, markGenerated) private const val DO_NOT_ANALYZE_NOTIFICATION = "This file was created by KtPsiFactory and should not be analyzed\n" +