kotlin - 我该如何解决这个错误 "Kotlin: [Internal Error] java.lang.ExceptionInInitializerError"

标签 kotlin intellij-idea

fun main() {
    fun convert(x: Double, converter: (Double) -> Double) : Double{
        val result = converter(x)
        println("$x is converted to $result")
        return result
    }
    fun convertFive(converter: (Int) -> Double) : Double {
        val result = converter(5)
        println("5 is converted to $result")
        return result
    }

    convert(20.0) { it * 1.8 + 32}
    convertFive { it * 1.8 + 32 }
}
//当我更新我的 intelliJ Idea 并运行它时,我收到了这个错误
//

Kotlin: [Internal Error] java.lang.ExceptionInInitializerError

最佳答案

问题是当前版本的 Kotlin 编译器(1.4.31、1.5-M1)在 JDK 16 上不起作用。请暂时使用 JDK < 16。
相关问题: https://youtrack.jetbrains.com/issue/KT-45566

关于kotlin - 我该如何解决这个错误 "Kotlin: [Internal Error] java.lang.ExceptionInInitializerError",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66814501/

相关文章:

java - 将 Intellij IDEA 代码格式化规则导出到 Eclipse

Android LiveData转换: Changing LiveData object value

Android Studio 将 Java 转换为 Kotlin 2 错误

kotlin - 使用 Jetpack Compose 的生物识别提示

android - Kotlin Coroutines - 从 Coroutine 返回一个值而不阻塞主线程 Android

java - Intellij 和 Maven 模板插件 : how to reference java-templates

intellij-idea - API 的使用记录为 @since1.6+

Intellij IDEA 中的 Java 预处理支持

java - 在 IntelliJ IDEA 中将多个项目复制并粘贴到剪贴板

kotlin - 相当于 Kotlin 中 C# 的 Semaphore/SemaphoreSlim?