JVM_IR: make ObsoleteDescriptorBasedApi use explicit in all of backend.jvm
This commit is contained in:
@@ -22,11 +22,3 @@ sourceSets {
|
|||||||
}
|
}
|
||||||
"test" {}
|
"test" {}
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks {
|
|
||||||
val compileKotlin by existing(org.jetbrains.kotlin.gradle.tasks.KotlinCompile::class) {
|
|
||||||
kotlinOptions {
|
|
||||||
freeCompilerArgs += "-Xopt-in=org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
+2
@@ -19,6 +19,7 @@ import org.jetbrains.kotlin.diagnostics.DiagnosticUtils
|
|||||||
import org.jetbrains.kotlin.incremental.components.LocationInfo
|
import org.jetbrains.kotlin.incremental.components.LocationInfo
|
||||||
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
import org.jetbrains.kotlin.incremental.components.LookupLocation
|
||||||
import org.jetbrains.kotlin.incremental.components.Position
|
import org.jetbrains.kotlin.incremental.components.Position
|
||||||
|
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.descriptors.IrBasedSimpleFunctionDescriptor
|
import org.jetbrains.kotlin.ir.descriptors.IrBasedSimpleFunctionDescriptor
|
||||||
import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor
|
import org.jetbrains.kotlin.ir.descriptors.toIrBasedDescriptor
|
||||||
@@ -119,6 +120,7 @@ class IrSourceCompilerForInline(
|
|||||||
it.finallyDepth = curFinallyDepth
|
it.finallyDepth = curFinallyDepth
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ObsoleteDescriptorBasedAPI
|
||||||
override fun isCallInsideSameModuleAsDeclared(functionDescriptor: FunctionDescriptor): Boolean {
|
override fun isCallInsideSameModuleAsDeclared(functionDescriptor: FunctionDescriptor): Boolean {
|
||||||
require(functionDescriptor is IrBasedSimpleFunctionDescriptor) {
|
require(functionDescriptor is IrBasedSimpleFunctionDescriptor) {
|
||||||
"expected an IrBasedSimpleFunctionDescriptor, got $functionDescriptor"
|
"expected an IrBasedSimpleFunctionDescriptor, got $functionDescriptor"
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import org.jetbrains.kotlin.descriptors.ClassKind
|
|||||||
import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource
|
import org.jetbrains.kotlin.descriptors.DeclarationDescriptorWithSource
|
||||||
import org.jetbrains.kotlin.descriptors.Modality
|
import org.jetbrains.kotlin.descriptors.Modality
|
||||||
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
import org.jetbrains.kotlin.descriptors.DescriptorVisibilities
|
||||||
|
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||||
import org.jetbrains.kotlin.ir.declarations.*
|
import org.jetbrains.kotlin.ir.declarations.*
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrGetEnumValue
|
import org.jetbrains.kotlin.ir.expressions.IrGetEnumValue
|
||||||
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
|
import org.jetbrains.kotlin.ir.expressions.IrMemberAccessExpression
|
||||||
@@ -411,9 +412,11 @@ val IrFunction.functionDeprecationFlags: Int
|
|||||||
return originFlags or propertyFlags or callableDeprecationFlags
|
return originFlags or propertyFlags or callableDeprecationFlags
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||||
val IrDeclaration.psiElement: PsiElement?
|
val IrDeclaration.psiElement: PsiElement?
|
||||||
get() = (descriptor as? DeclarationDescriptorWithSource)?.psiElement
|
get() = (descriptor as? DeclarationDescriptorWithSource)?.psiElement
|
||||||
|
|
||||||
|
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||||
val IrMemberAccessExpression<*>.psiElement: PsiElement?
|
val IrMemberAccessExpression<*>.psiElement: PsiElement?
|
||||||
get() = (symbol.descriptor.original as? DeclarationDescriptorWithSource)?.psiElement
|
get() = (symbol.descriptor.original as? DeclarationDescriptorWithSource)?.psiElement
|
||||||
|
|
||||||
|
|||||||
+3
-2
@@ -95,13 +95,14 @@ class JvmSharedVariablesManager(
|
|||||||
typeArguments.forEachIndexed(::putTypeArgument)
|
typeArguments.forEachIndexed(::putTypeArgument)
|
||||||
}
|
}
|
||||||
return with(originalDeclaration) {
|
return with(originalDeclaration) {
|
||||||
|
val descriptor = WrappedVariableDescriptor()
|
||||||
IrVariableImpl(
|
IrVariableImpl(
|
||||||
startOffset, endOffset, origin, IrVariableSymbolImpl(WrappedVariableDescriptor()), name, refType,
|
startOffset, endOffset, origin, IrVariableSymbolImpl(descriptor), name, refType,
|
||||||
isVar = false, // writes are remapped to field stores
|
isVar = false, // writes are remapped to field stores
|
||||||
isConst = false, // const vals could not possibly require ref wrappers
|
isConst = false, // const vals could not possibly require ref wrappers
|
||||||
isLateinit = false
|
isLateinit = false
|
||||||
).apply {
|
).apply {
|
||||||
(descriptor as WrappedVariableDescriptor).bind(this)
|
descriptor.bind(this)
|
||||||
initializer = refConstructorCall
|
initializer = refConstructorCall
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+11
-8
@@ -82,14 +82,17 @@ private class AdditionalClassAnnotationLowering(private val context: JvmBackendC
|
|||||||
returnType = annotationClass.defaultType
|
returnType = annotationClass.defaultType
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun buildEnumEntry(enumClass: IrClass, entryName: String): IrEnumEntry = IrEnumEntryImpl(
|
private fun buildEnumEntry(enumClass: IrClass, entryName: String): IrEnumEntry {
|
||||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB,
|
val descriptor = WrappedEnumEntryDescriptor()
|
||||||
IrEnumEntrySymbolImpl(WrappedEnumEntryDescriptor()),
|
return IrEnumEntryImpl(
|
||||||
Name.identifier(entryName)
|
UNDEFINED_OFFSET, UNDEFINED_OFFSET, IrDeclarationOrigin.IR_EXTERNAL_JAVA_DECLARATION_STUB,
|
||||||
).apply {
|
IrEnumEntrySymbolImpl(descriptor),
|
||||||
(descriptor as WrappedEnumEntryDescriptor).bind(this)
|
Name.identifier(entryName)
|
||||||
parent = enumClass
|
).apply {
|
||||||
enumClass.addChild(this)
|
descriptor.bind(this)
|
||||||
|
parent = enumClass
|
||||||
|
enumClass.addChild(this)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private val documentedConstructor = buildAnnotationConstructor(buildAnnotationClass("Documented"))
|
private val documentedConstructor = buildAnnotationConstructor(buildAnnotationClass("Documented"))
|
||||||
|
|||||||
+2
@@ -11,6 +11,7 @@ import org.jetbrains.kotlin.backend.jvm.JvmBackendContext
|
|||||||
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
|
import org.jetbrains.kotlin.codegen.binding.CodegenBinding
|
||||||
import org.jetbrains.kotlin.config.JvmAnalysisFlags
|
import org.jetbrains.kotlin.config.JvmAnalysisFlags
|
||||||
import org.jetbrains.kotlin.ir.IrElement
|
import org.jetbrains.kotlin.ir.IrElement
|
||||||
|
import org.jetbrains.kotlin.ir.ObsoleteDescriptorBasedAPI
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrClass
|
import org.jetbrains.kotlin.ir.declarations.IrClass
|
||||||
import org.jetbrains.kotlin.ir.declarations.IrFile
|
import org.jetbrains.kotlin.ir.declarations.IrFile
|
||||||
import org.jetbrains.kotlin.ir.util.render
|
import org.jetbrains.kotlin.ir.util.render
|
||||||
@@ -34,6 +35,7 @@ class CheckLocalNamesWithOldBackend(private val context: JvmBackendContext) : Fi
|
|||||||
irFile.acceptVoid(this)
|
irFile.acceptVoid(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OptIn(ObsoleteDescriptorBasedAPI::class)
|
||||||
override fun visitClass(declaration: IrClass) {
|
override fun visitClass(declaration: IrClass) {
|
||||||
val actualName = context.getLocalClassType(declaration)?.internalName
|
val actualName = context.getLocalClassType(declaration)?.internalName
|
||||||
if (actualName != null) {
|
if (actualName != null) {
|
||||||
|
|||||||
+2
-1
@@ -476,7 +476,8 @@ internal class FunctionReferenceLowering(private val context: JvmBackendContext)
|
|||||||
//don't pass receivers otherwise LocalDeclarationLowering will create additional captured parameters
|
//don't pass receivers otherwise LocalDeclarationLowering will create additional captured parameters
|
||||||
IrFunctionReferenceImpl(
|
IrFunctionReferenceImpl(
|
||||||
UNDEFINED_OFFSET, UNDEFINED_OFFSET, irFunctionReference.type, target,
|
UNDEFINED_OFFSET, UNDEFINED_OFFSET, irFunctionReference.type, target,
|
||||||
irFunctionReference.typeArgumentsCount, irFunctionReference.reflectionTarget, null
|
irFunctionReference.typeArgumentsCount, target.owner.valueParameters.size,
|
||||||
|
irFunctionReference.reflectionTarget, null
|
||||||
).apply {
|
).apply {
|
||||||
copyTypeArgumentsFrom(irFunctionReference)
|
copyTypeArgumentsFrom(irFunctionReference)
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -123,7 +123,7 @@ private class SuspendLambdaLowering(context: JvmBackendContext) : SuspendLowerin
|
|||||||
|
|
||||||
private fun generateAnonymousObjectForLambda(reference: IrFunctionReference, parent: IrDeclarationParent) =
|
private fun generateAnonymousObjectForLambda(reference: IrFunctionReference, parent: IrDeclarationParent) =
|
||||||
context.createIrBuilder(reference.symbol).irBlock(reference.startOffset, reference.endOffset) {
|
context.createIrBuilder(reference.symbol).irBlock(reference.startOffset, reference.endOffset) {
|
||||||
assert(reference.getArguments().isEmpty()) { "lambda with bound arguments: ${reference.render()}" }
|
assert(reference.getArgumentsWithIr().isEmpty()) { "lambda with bound arguments: ${reference.render()}" }
|
||||||
val continuation = generateContinuationClassForLambda(reference, parent)
|
val continuation = generateContinuationClassForLambda(reference, parent)
|
||||||
+continuation
|
+continuation
|
||||||
+irCall(continuation.constructors.single().symbol).apply {
|
+irCall(continuation.constructors.single().symbol).apply {
|
||||||
|
|||||||
+1
-1
@@ -424,7 +424,7 @@ internal class SyntheticAccessorLowering(val context: JvmBackendContext) : IrEle
|
|||||||
accessorSymbol as IrConstructorSymbol, oldExpression.typeArgumentsCount
|
accessorSymbol as IrConstructorSymbol, oldExpression.typeArgumentsCount
|
||||||
)
|
)
|
||||||
is IrConstructorCall ->
|
is IrConstructorCall ->
|
||||||
IrConstructorCallImpl.fromSymbolDescriptor(
|
IrConstructorCallImpl.fromSymbolOwner(
|
||||||
oldExpression.startOffset, oldExpression.endOffset,
|
oldExpression.startOffset, oldExpression.endOffset,
|
||||||
oldExpression.type,
|
oldExpression.type,
|
||||||
accessorSymbol as IrConstructorSymbol
|
accessorSymbol as IrConstructorSymbol
|
||||||
|
|||||||
Reference in New Issue
Block a user