Move static constants with builtin names to :core:descriptors.common module

This commit is contained in:
Dmitriy Novozhilov
2020-08-16 22:57:12 +03:00
parent 2e92fe9be9
commit 7a7fe77b8e
180 changed files with 1085 additions and 1025 deletions
@@ -27,6 +27,7 @@ import org.jetbrains.kotlin.asJava.elements.KotlinLightTypeParameterListBuilder
import org.jetbrains.kotlin.asJava.elements.KtLightMethod
import org.jetbrains.kotlin.asJava.elements.psiType
import org.jetbrains.kotlin.builtins.KotlinBuiltIns
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames
import org.jetbrains.kotlin.builtins.jvm.JavaToKotlinClassMap
import org.jetbrains.kotlin.codegen.AsmUtil
import org.jetbrains.kotlin.codegen.JvmCodegenUtil
@@ -35,8 +36,8 @@ import org.jetbrains.kotlin.codegen.signature.BothSignatureWriter
import org.jetbrains.kotlin.codegen.signature.JvmSignatureWriter
import org.jetbrains.kotlin.codegen.state.KotlinTypeMapper
import org.jetbrains.kotlin.descriptors.*
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode
import org.jetbrains.kotlin.lexer.KtTokens
import org.jetbrains.kotlin.load.kotlin.TypeMappingMode
import org.jetbrains.kotlin.name.FqName
import org.jetbrains.kotlin.name.SpecialNames
import org.jetbrains.kotlin.psi.*
@@ -316,7 +317,7 @@ internal fun KtModifierListOwner.isHiddenByDeprecation(support: KtUltraLightSupp
annotation.looksLikeDeprecated()
}
if (annotations.isNotEmpty()) { // some candidates found
val deprecated = support.findAnnotation(this, KotlinBuiltIns.FQ_NAMES.deprecated)?.second
val deprecated = support.findAnnotation(this, KotlinBuiltInsNames.FqNames.deprecated)?.second
return (deprecated?.argumentValue("level") as? EnumValue)?.enumEntryName?.asString() == "HIDDEN"
} else {
return false
@@ -361,7 +362,7 @@ internal fun KtModifierListOwner.isDeprecated(support: KtUltraLightSupport? = nu
val modifierList = this.modifierList ?: return false
if (modifierList.annotationEntries.isEmpty()) return false
val deprecatedFqName = KotlinBuiltIns.FQ_NAMES.deprecated
val deprecatedFqName = KotlinBuiltInsNames.FqNames.deprecated
val deprecatedName = deprecatedFqName.shortName().asString()
for (annotationEntry in modifierList.annotationEntries) {
@@ -374,7 +375,7 @@ internal fun KtModifierListOwner.isDeprecated(support: KtUltraLightSupport? = nu
if (fqName.asString() == deprecatedName) return true
}
return support?.findAnnotation(this, KotlinBuiltIns.FQ_NAMES.deprecated) !== null
return support?.findAnnotation(this, KotlinBuiltInsNames.FqNames.deprecated) !== null
}
private fun toQualifiedName(userType: KtUserType): FqName? {
@@ -13,7 +13,7 @@ import com.intellij.psi.PsiElement
import com.intellij.psi.PsiNameValuePair
import org.jetbrains.kotlin.asJava.classes.KtUltraLightSimpleAnnotation
import org.jetbrains.kotlin.asJava.classes.KtUltraLightSupport
import org.jetbrains.kotlin.builtins.KotlinBuiltIns.FQ_NAMES
import org.jetbrains.kotlin.builtins.KotlinBuiltInsNames.FqNames
import org.jetbrains.kotlin.name.ClassId
import org.jetbrains.kotlin.name.Name
import org.jetbrains.kotlin.resolve.constants.ArrayValue
@@ -64,7 +64,7 @@ private val targetMapping = hashMapOf(
internal fun PsiAnnotation.tryConvertAsTarget(support: KtUltraLightSupport): KtLightAbstractAnnotation? {
if (FQ_NAMES.target.asString() != qualifiedName) return null
if (FqNames.target.asString() != qualifiedName) return null
val attributeValues = extractArrayAnnotationFqNames("allowedTargets")
?: extractAnnotationFqName("value")?.let { listOf(it) }
@@ -101,7 +101,7 @@ internal fun createRetentionRuntimeAnnotation(support: KtUltraLightSupport, pare
internal fun PsiAnnotation.tryConvertAsRetention(support: KtUltraLightSupport): KtLightAbstractAnnotation? {
if (FQ_NAMES.retention.asString() != qualifiedName) return null
if (FqNames.retention.asString() != qualifiedName) return null
val convertedValue = extractAnnotationFqName("value")
?.let { retentionMapping[it] }
@@ -118,7 +118,7 @@ internal fun PsiAnnotation.tryConvertAsRetention(support: KtUltraLightSupport):
internal fun PsiAnnotation.tryConvertAsMustBeDocumented(support: KtUltraLightSupport): KtLightAbstractAnnotation? {
if (FQ_NAMES.mustBeDocumented.asString() != qualifiedName) return null
if (FqNames.mustBeDocumented.asString() != qualifiedName) return null
return KtUltraLightSimpleAnnotation(
JAVA_LANG_ANNOTATION_DOCUMENTED,
@@ -126,4 +126,4 @@ internal fun PsiAnnotation.tryConvertAsMustBeDocumented(support: KtUltraLightSup
support,
parent
)
}
}