JVM KT-49613 use adapter for indy reference to protected constructor
This commit is contained in:
committed by
TeamCityServer
parent
76bdf4ff1a
commit
916379c0e7
+1
-1
@@ -553,7 +553,7 @@ private class TypeOperatorLowering(private val context: JvmBackendContext) : Fil
|
||||
targetRef: IrFunctionReference
|
||||
): IrCall {
|
||||
fun fail(message: String): Nothing =
|
||||
throw AssertionError("$message, irFunRef:\n${targetRef.dump()}")
|
||||
throw AssertionError("$message, targetRef:\n${targetRef.dump()}")
|
||||
|
||||
val dynamicCallArguments = ArrayList<IrExpression>()
|
||||
|
||||
|
||||
+10
-2
@@ -145,9 +145,8 @@ internal class LambdaMetafactoryArgumentsBuilder(
|
||||
functionHazard = true
|
||||
}
|
||||
|
||||
if (implFun is IrConstructor && DescriptorVisibilities.isPrivate(implFun.visibility)) {
|
||||
if (isConstructorRequiringAccessor(implFun)) {
|
||||
// Kotlin generates constructor accessors differently from Java.
|
||||
// We don't do exact accessibility check here, just
|
||||
functionHazard = true
|
||||
}
|
||||
|
||||
@@ -214,6 +213,15 @@ internal class LambdaMetafactoryArgumentsBuilder(
|
||||
?: MetafactoryArgumentsResult.Failure.FunctionHazard
|
||||
}
|
||||
|
||||
private fun isConstructorRequiringAccessor(implFun: IrFunction): Boolean {
|
||||
if (implFun !is IrConstructor) return false
|
||||
// We don't do exact accessibility check here:
|
||||
// constructor will be called by a class generated by LambdaMetafactory at runtime.
|
||||
val visibility = implFun.visibility
|
||||
return visibility == DescriptorVisibilities.PROTECTED ||
|
||||
DescriptorVisibilities.isPrivate(visibility)
|
||||
}
|
||||
|
||||
private val javaIoSerializableFqn =
|
||||
FqName("java.io").child(Name.identifier("Serializable"))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user