File tree Expand file tree Collapse file tree
java/kotlin-extractor/src/main/kotlin Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1151,6 +1151,8 @@ open class KotlinFileExtractor(
11511151 if (drType != null && extractClassTypeArguments && drType is IrSimpleType && ! isUnspecialised(drType)) {
11521152
11531153 val extractionMethod = if (isFunctionInvoke) {
1154+ // For `kotlin.FunctionX` and `kotlin.reflect.KFunctionX` interfaces, we're making sure that we
1155+ // extract the call to the `invoke` method that does exist, `kotlin.jvm.functions.FunctionX::invoke`.
11541156 val interfaceType = getFunctionalInterfaceTypeWithTypeArgs(drType.arguments).classOrNull!! .owner
11551157 val substituted = getJavaEquivalentClass(interfaceType) ? : interfaceType
11561158 findFunction(substituted, OperatorNameConventions .INVOKE .asString())!!
@@ -1159,6 +1161,9 @@ open class KotlinFileExtractor(
11591161 }
11601162
11611163 if (isBigArityFunctionInvoke) {
1164+ // Big arity `invoke` methods have a special implementation on JVM, they are transformed to a call to
1165+ // `kotlin.jvm.functions.FunctionN<out R>::invoke(vararg args: Any?)`, so we only need to pass the type
1166+ // argument for the return type. Additionally, the arguments are extracted inside an array literal below.
11621167 useFunction<DbCallable >(extractionMethod, listOf (drType.arguments.last()))
11631168 } else {
11641169 useFunction<DbCallable >(extractionMethod, getDeclaringTypeArguments(callTarget, drType))
You can’t perform that action at this time.
0 commit comments