gpt4 book ai didi

intellij-idea - Kotlin 'rem' 作为 'mod' 的替代品不可用?

转载 作者:IT老高 更新时间:2023-10-28 13:47:35 25 4
gpt4 key购买 nike

对于 count % 2 我收到警告

Warning:(137, 17) Kotlin: 'mod(Int): Int' is deprecated. Use rem(other) instead

Intellij IDE 提供了对 count.rem(2) 的自动更正,然后由于未解决对 rem 的引用,我将其标记为错误。

我做错了什么?

最佳答案

这是 Kotlin IDE 插件中的 known bug

它源于 Kotlin 1.1 中弃用了 mod 函数,应将其替换为 rem(参见 this blog post 中的 Other changes) .但是 IDE 插件会错误地报告并建议快速修复,即使对于没有 rem 的早期 Kotlin 版本也是如此。

Unitl 已修复,您可以将项目更新到 Kotlin 1.1 或 suppress the warnings ,或者直接忽略它们。

关于intellij-idea - Kotlin 'rem' 作为 'mod' 的替代品不可用?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42717683/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com