Which standard library to use in Kotlin

前端 未结 3 1357
刺人心
刺人心 2021-02-13 05:41

In Kotlin, when working with the JVM, it seems there is multiple choices for standard library, namely kotlin-stdlib, kotlin-stdlib-jdk7 and kotli

3条回答
  •  花落未央
    2021-02-13 06:45

    As the name indicates, -jdk8 is supposed to be used when using the JDK8. It contains code used to integrate the changes made in the JDK 8 into the Kotlin standard lib.

    As its pom indicates, it depends on -jdk7, which contains the code needed to integrate the changes made in the JDK 7 into the Kotlin standard lib.

    And as the pom of -jdk7 indicates, it depends on the stdlib.

    So, in short, use the one matching your JDK. Adding it to the dependencies will also, transitively, add all the ones for the previous versions of the JDK.

提交回复
热议问题