从 Kotlin 编译器 API 的变化开始: 2.3.20

大家好!众所周知,我有在平时维护一个简单的Kotlin编译器插件项目: Kotlin Suspend Transform Compiler Plugin。 想必经常维护编译器插件的小伙伴们也清楚,每次 Kotlin 的主要版本递进,编译器的API都会或多或少的发生变化, 也给编译器插件的更新维护带来不小的挑战。那么借此机会,我会在每次发生API变化的更新出现后, 藉由此系列记录一下能有哪些编译器API的变化可以被我发现。

不算是一种技术分享文,而是一种记录文,所以不保证有什么技术含金量喔~

今天要记录的版本变化是:v2.3.(1)0 -> 2.3.20

一如既往,首先先直接列举一下这次更新出现的所有错误和警告:

perl 复制代码
> Task :compiler:suspend-transform-plugin:compileKotlin FAILED
w: -Xjvm-default is deprecated. Use -jvm-default instead.
i: Finished executing kotlin compiler using DAEMON strategy
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:270:17 Unresolved reference 'FirSimpleFunctionBuilder'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:271:28 Unresolved reference 'symbol'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:274:33 Unresolved reference 'typeParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:275:9 Unresolved reference 'typeParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:276:9 Unresolved reference 'typeParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:278:36 Unresolved reference 'contextParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:282:9 Unresolved reference 'contextParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:283:9 Unresolved reference 'contextParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:285:34 Unresolved reference 'valueParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:289:9 Unresolved reference 'valueParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:290:9 Unresolved reference 'valueParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:292:9 Unresolved reference 'receiverParameter'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:293:13 Unresolved reference 'FirSimpleFunctionBuilder'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:293:18 Unresolved reference 'receiverParameter'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:296:30 Unresolved reference 'returnTypeRef'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:296:44 'val FirResolvedTypeRef.coneTypeOrNull: ConeKotlinType?' is deprecated. This type ref already resolved, use `.coneType` instead.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:298:13 Unresolved reference 'returnTypeRef'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:298:29 Unresolved reference 'returnTypeRef'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:356:21 Unresolved reference 'FirSimpleFunction'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:399:64 Unresolved reference 'valueParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:439:62 Argument type mismatch: actual type is 'V? (of fun <K, V> Map<out K, V>.get)', but 'FirValueParameter' was expected.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:439:62 Cannot infer type for type parameter 'V'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:455:68 Unresolved reference 'returnTypeRef'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:462:46 Unresolved reference 'body'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:633:26 Unresolved reference 'buildSimpleFunctionCopy'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:634:17 Unresolved reference. None of the following candidates is applicable because of a receiver type mismatch:
val GeneratedDeclarationKey.origin: FirDeclarationOrigin
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:634:17 'val' cannot be reassigned.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:635:17 Unresolved reference 'source'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:636:17 'val' cannot be reassigned.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:636:22 Assignment type mismatch: actual type is 'Name', but 'FirExtensionPointName' was expected.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:637:17 Unresolved reference 'symbol'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:638:17 Unresolved reference 'status'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:661:17 Unresolved reference 'returnTypeRef'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:661:72 Unresolved reference 'returnTypeRef'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:663:50 Unresolved reference 'receiverParameter'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:664:50 Unresolved reference 'contextParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:665:48 Unresolved reference 'valueParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:667:17 Unresolved reference 'annotations'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:668:17 Unresolved reference 'annotations'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:670:17 Unresolved reference 'body'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:683:17 Unresolved reference. None of the following candidates is applicable because of a receiver type mismatch:
val GeneratedDeclarationKey.origin: FirDeclarationOrigin
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:683:17 'val' cannot be reassigned.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1082:19 Unresolved reference 'FirSimpleFunction'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1086:53 Unresolved reference 'annotations'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1086:65 Cannot infer type for type parameter 'K'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1086:65 Cannot infer type for type parameter 'V'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1086:75 Cannot infer type for type parameter 'K'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1096:80 Cannot infer type for type parameter 'K'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1096:80 Cannot infer type for type parameter 'V'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1110:58 Cannot infer type for type parameter 'T'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1110:58 Cannot infer type for type parameter 'R'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1110:64 Cannot infer type for type parameter 'T'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1115:53 Unresolved reference 'typeArguments'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1117:45 Unresolved reference 'source'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1118:51 Unresolved reference 'argumentMapping'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1169:80 Cannot infer type for type parameter 'K'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1169:80 Cannot infer type for type parameter 'V'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1200:61 Cannot infer type for type parameter 'T'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1200:65 Cannot infer type for type parameter 'T'. Specify it explicitly.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1290:21 Unresolved reference 'FirSimpleFunction'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1297:59 Unresolved reference 'receiverParameter'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1299:63 Unresolved reference 'valueParameters'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1300:16 Unresolved reference 'symbol'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1506:13 Unresolved reference 'FirSimpleFunction'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1508:9 Unresolved reference 'status'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1510:17 Unresolved reference 'status'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt:38:50 Unresolved reference 'getSourceLocation'.
e: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt:373:9 Unresolved reference 'getSourceLocation'.

OMG! 这次看上去有点儿多啊... 希望大部分都只是连带出来的,而不是需要我一个个手改的吧。开工!

符号变化

FirSimpleFunctionBuilder

让我们一个个来看。首先看来看已经找不到符号的 FirSimpleFunctionBuilder 类型。

看来,比起 Simple, 它们选择了命名看上去更明确的 Named。将 FirSimpleFunctionFirSimpleFunctionBuilder 分别更换为 FirNamedFunctionFirNamedFunctionBuilder 即可。

FirSimpleFunction -> FirNamedFunction 的包路径没有变更。

getSourceLocation

这其实是原本就用错了的一个地方。我之前写了个这么个函数,用来获取某个 IrFunctionCompilerMessageSourceLocation, 用于报告一些错误信息:

Kotlin 复制代码
private fun IrFunction.reportLocation(): CompilerMessageSourceLocation? {
    return when (val sourceLocation =
        getSourceLocation(declaration = symbol, fileEntry = runCatching { fileEntry }.getOrNull())) {

        is SourceLocation.WithFileAndLineNumberInformation ->
            CompilerMessageLocation.create(
                path = sourceLocation.file,
                line = sourceLocation.line,
                column = sourceLocation.column,
                lineContent = null
            )

        else -> null
    }
}

但是我之前都没发现,这个 getSourceLocationorg.jetbrains.kotlin.backend.wasm.ir2wasm 这么个包下的。 这怎么看都不对吧!至于现在,我把它改成了看上去更正确的形式:

Kotlin 复制代码
private fun IrFunction.reportLocation(): CompilerMessageSourceLocation? = runCatching {
    val file = getSourceFile() ?: return null
    val (line, column) = file.getLineAndColumnNumbers(startOffset)
    return CompilerMessageLocation.create(file.name, line, column, null)
}.getOrNull()

其实那一片报错都来自 FirSimpleFunction -> FirNamedFunction 的名称变化,这么一改,错误就没了。 不过接下来,还有一批仁慈地留下了 Deprecated 标记而没有被删除的 废弃函数 、或者不影响直接编译的 警告 要进行改进了。

废弃内容&警告修复

先来看看这些内容的汇总:

perl 复制代码
> Task :compiler:suspend-transform-plugin:compileKotlin
w: -Xjvm-default is deprecated. Use -jvm-default instead.
w: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1464:35 Unnecessary safe call on a non-null receiver of type 'ClassId'.
w: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/fir/SuspendTransformFirTransformer.kt:1475:31 Unnecessary safe call on a non-null receiver of type 'ClassId'.
w: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt:72:23 'val messageCollector: MessageCollector' is deprecated. Consider using diagnosticReporter instead. See https://youtrack.jetbrains.com/issue/KT-78277 for more details.
w: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt:123:43 'fun referenceFunctions(callableId: CallableId): Collection<IrSimpleFunctionSymbol>' is deprecated. Please use `finderForBuiltins()` or `finderForSource(fromFile)` instead.
w: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt:151:43 'fun referenceFunctions(callableId: CallableId): Collection<IrSimpleFunctionSymbol>' is deprecated. Please use `finderForBuiltins()` or `finderForSource(fromFile)` instead.
w: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt:183:35 'fun referenceFunctions(callableId: CallableId): Collection<IrSimpleFunctionSymbol>' is deprecated. Please use `finderForBuiltins()` or `finderForSource(fromFile)` instead.
w: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt:219:53 'fun referenceClass(classId: ClassId): IrClassSymbol?' is deprecated. Please use `finderForBuiltins()` or `finderForSource(fromFile)` instead.
w: file:///suspend-transform-kotlin-compile-plugin/compiler/suspend-transform-plugin/src/main/kotlin/love/forte/plugin/suspendtrans/ir/SuspendTransformTransformer.kt:519:17 'fun referenceClass(classId: ClassId): IrClassSymbol?' is deprecated. Please use `finderForBuiltins()` or `finderForSource(fromFile)` instead.

然后我们一个个来进行修正。

ConeKotlinType.classId -> non-null

看起来,ConeKotlinType.classId 从原本的 nullable 变化为 non-null 了。

没啥可说的,修复就完了。

为了严谨一些,我又去上个版本看了一下,那时候它就已经是 non-null 了。看来是某个中间版本就改了。 但是那时候没有直接的 API 不兼容变更,所以我没发现这个问题。

IrPluginContext.reference* 函数废弃

IrPluginContext 中的 referenceClass, referenceClassifier, referenceConstructors, referenceFunctions, referenceProperties 均已废弃。废弃描述如下:

scss 复制代码
Please use `finderForBuiltins()` or `finderForSource(fromFile)` instead.

因此,原本的代码:

Kotlin 复制代码
pluginContext.referenceFunctions(pluginKey.data.transformer.transformFunctionInfo.toCallableId())
.firstOrNull()
?: throw IllegalStateException("Transform function ${pluginKey.data.transformer.transformFunctionInfo} not found")

现在修复为:

Kotlin 复制代码
pluginContext.finderForBuiltins()
    .findFunctions(pluginKey.data.transformer.transformFunctionInfo.toCallableId())
    .firstOrNull()
    ?: throw IllegalStateException("Transform function ${pluginKey.data.transformer.transformFunctionInfo} not found")

尾声

本次的变更记录就做到这里啦~ 其他的一些测试方面还有过去遗留的隐患问题就不再落笔于此了,与本文的主题不太相符。 Kotlin 的语言演进滚滚向前,也对未来的种种变化怀揣期待吧!

相关推荐
IvorySQL2 小时前
第 6 次执行后,PostgreSQL 执行计划为何突变?
数据库·postgresql·开源
Java水解2 小时前
一篇文章让你彻底弄懂Spring Boot 自动配置原理详解
spring boot·后端
Java水解2 小时前
【MYSQL】MYSQL学习的一大重点:MYSQL数据类型
后端·mysql
架构师沉默2 小时前
为什么 Dubbo 从 ZooKeeper 转向 Nacos?
java·后端·架构
IvorySQL2 小时前
PostgreSQL 技术日报 (4月2日)|社区工具更新与内核补丁讨论速递
数据库·postgresql·开源
海兰2 小时前
【实战】Ubuntu 24.04下本地部署开源项目Higress
linux·人工智能·ubuntu·开源·银行系统
用户8307196840822 小时前
Spring Prototype Bean的四种正确使用方式
java·spring boot·后端
代码丰2 小时前
一篇讲透:Spring Boot + Redisson + 注解 + AOP 实现接口限流(可直接落地)
后端
蚂蚁集团分布式架构3 小时前
🦐 不办 Meetup,开挑战赛!SOFAStack PR Challenge | SOFAStack 8 周年
后端·github·claude