捆绑的kotlin-stdlib在IDEA插件中的运行时被忽略
上下文
我构建了一个依赖Moshi 1.13.0的Intellij插件。 在软件包com.squareup.moshi.kotlin.troct.rectlect
第269行 propertytypeclassifier.isvalue 使用。 属性可用。
与Kotlin-STDLIB 1.5.10或更高捆绑的基于较新的IDE(2021.2及以上)运行时的症状
时,一切都很好。 试图在Android Studio上运行我的插件(最新稳定版本为2021.1.1.1补丁3个Bumblebee)和其他基于IDEA 2021.1或以上的其他IDE时,就会发生问题。 每当我的 openapapi-generated 这需要上述MOSHI)试图对服务器的响应进行估算,我得到java.lang.nosuchmethoderror:'boolean kotlin.reflectlin.reflect.kclass.isvalue()'
IDE造成了致命错误。
已经尝试过的是
因为它似乎是kotlin-stdlib
相关错误,我假设由于某种原因,我的插件没有得到正确的版本,所以:
- 我尝试更新所有依赖关系并使100%确定
kotlin-stdlib:1.6.10
是 仅在gradlew列出的直接和传递依赖项中可见的
版本:依赖项
使用各种迫使其中的方法。 - 添加了最新的
kotlin-stdlib
作为顶级依赖关系(尝试了编译范围和实现
,理论上将运行时添加到依赖项的范围afaik) - ,我也确保<<代码> kotlin.stdlib.default.dependenty 未偶然将设置为false 。
- 我确保我的gradle是最新的(7.4.2使用Kotlin 1.5.30)
- 检查是否
Kotlin-Gradle-Plugin
是最新的对于捆绑的stdlib - 技术上不需要1.5,因此不需要)
结果
实际
更新了项目设置,以使用最新可用的Kotlin编译器以及与Kotlin相关的任何内容(尽管在 。 kotlin-stdlib
捆绑在一起,但Moshi Deserializer似乎仍然只能访问IDE的内置stdlib,并且仍然无法获得iSvalue
getter forter forter forter for me to to
Me的预期
to the 插件只能工作; _;并使用捆绑的stdlib而不是忽略它,并使用IDE的一员
可以做些什么来确保在运行时可以使用插件的正确kotlin-stdlib
版本?
Context
I have built an IntelliJ plugin that relies on moshi 1.13.0.
In package com.squareup.moshi.kotlin.reflect
at line 269 propertyTypeClassifier.isValue
is used. The isValue
property is available since Kotlin 1.5.
Symptoms
When running on newer IDEA based IDEs (2021.2 and up) with kotlin-stdlib 1.5.10 or higher bundled, everything works just fine.
The problem occurs when trying to run my plugin on Android Studio (latest stable release being 2021.1.1.1 patch 3 bumblebee) and other IDEs based on IDEA 2021.1 or older.
Whenever my openapi-generated kotlin SDK (which requires aforementioned Moshi) tries to deserialize the server's response, I get java.lang.NoSuchMethodError: 'boolean kotlin.reflect.KClass.isValue()'
fatal error thrown by the ide.
What has been tried
Since it seems to be a kotlin-stdlib
related error, I assumed that for some reason my plugin doesn't get the correct version bundled, so:
- I've tried to update all dependencies and make 100% sure
kotlin-stdlib:1.6.10
is the only version visible in both direct and transitive dependencies listed bygradlew :dependencies
using various ways to force that in there. - added the latest
kotlin-stdlib
as top level dependency (tried both compile scope andimplementation
which theoretically adds runtime to a dependency's scope afaik) - I've also made sure that the
kotlin.stdlib.default.dependency
is not set tofalse
by accident. - I've made sure my gradle is up to date (7.4.2 with Kotlin 1.5.30)
- Checked if
kotlin-gradle-plugin
is up to date since most of suggestions online led to plugin version being responsible for bundled stdlib - updated project settings to use latest available Kotlin compiler and anything Kotlin-related (though it was 1.5 before so technically it shouldn't be required)
Outcome
Actual
The plugin distribution comes with latest (1.6.20 at the time of writing) kotlin-stdlib
bundled but the moshi deserializer seems to still only have access to the IDE's built-in stdlib and still fails to get the isValue
getter throwing errors at me
Expected
For the plugin to just work ;_; and use the bundled stdlib instead of ignoring it and using the IDE's one
What can be done to ensure proper kotlin-stdlib
version is available to the plugin during runtime?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论