From 7c53685de4809ae68cf98fdf369d7a976b791ce6 Mon Sep 17 00:00:00 2001 From: Stanislav Erokhin Date: Wed, 30 Mar 2022 17:25:36 +0200 Subject: [PATCH] Restore API used in Android safeArg plugin See IDEA/f53c2114c38f856bdf0ff4d01de9fffeeeb630f2 commit. In 222+ IDEA usage of the old ErrorUtils (and other classes) was eliminated, but not in the 211-221 versions. Relevant Kotlin commit: b5933c70e20a0dfd788d8d4a6c04ca0d16f7c731 Also, there is usages of UnresolvedType or ErrorType from the org.jetbrains.kotlin.types package in the safeargs tests, but it is difficult to restore the compatibility for them. So, I decided that it is ok to eliminate them in the `kt-[212|213|221]-*` branches, because it is tests and not production --- .../kotlin/renderer/DescriptorRendererImpl.kt | 1 + .../org/jetbrains/kotlin/types/ErrorUtils.kt | 28 +++++++++++++++++++ 2 files changed, 29 insertions(+) create mode 100644 core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.kt diff --git a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt index 6ca57ae857c..02127a318cb 100644 --- a/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt +++ b/core/descriptors/src/org/jetbrains/kotlin/renderer/DescriptorRendererImpl.kt @@ -25,6 +25,7 @@ import org.jetbrains.kotlin.resolve.descriptorUtil.declaresOrInheritsDefaultValu import org.jetbrains.kotlin.types.* import org.jetbrains.kotlin.types.TypeUtils.CANNOT_INFER_FUNCTION_PARAM_TYPE import org.jetbrains.kotlin.types.error.* +import org.jetbrains.kotlin.types.error.ErrorUtils import org.jetbrains.kotlin.types.typeUtil.isUnresolvedType import org.jetbrains.kotlin.util.capitalizeDecapitalize.toLowerCaseAsciiOnly diff --git a/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.kt b/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.kt new file mode 100644 index 00000000000..6da2efee1d0 --- /dev/null +++ b/core/descriptors/src/org/jetbrains/kotlin/types/ErrorUtils.kt @@ -0,0 +1,28 @@ +/* + * Copyright 2010-2022 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 + +import org.jetbrains.kotlin.types.error.ErrorTypeKind +import org.jetbrains.kotlin.utils.IDEAPlatforms.* +import org.jetbrains.kotlin.utils.IDEAPluginsCompatibilityAPI + +@Suppress("unused", "UNUSED_PARAMETER") +@IDEAPluginsCompatibilityAPI( + _212, _213, _221, + message = "Please migrate to the org.jetbrains.kotlin.types.error.ErrorUtils", + plugins = "android/safeargs" +) +object ErrorUtils { + @IDEAPluginsCompatibilityAPI( + _212, _213, _221, + message = "Please migrate to the org.jetbrains.kotlin.types.error.ErrorUtils", + plugins = "android/safeargs" + ) + @JvmStatic + fun createUnresolvedType(presentableName: String, arguments: List): SimpleType { + return org.jetbrains.kotlin.types.error.ErrorUtils.createErrorType(ErrorTypeKind.UNRESOLVED_TYPE, this.toString()) + } +} \ No newline at end of file