鉴于我知道使用kotlin编译的jar文件,如何确定使用哪个版本的kotlin来编译其中的类文件?
如果我做以下我得到52(即JDK8)
javap -cp target.jar -verbose fully.qualified.class.name | grep major
这是java目标版本 .
鉴于(据我所知),Kotlin编译器不会在生成的类中存储任何版本信息,我认为你不能 .
与...不同Scala,embeds its major and minor version in the compiled class files,Kotlin只为方法和类等添加@Metadata注释,以保存有关可空性,可变性等的信息 . 您可以找到此信息的原型here .
您可以使用embedding the version in the JAR's name的旧版"standard"(也在Scala项目中使用) .
1 回答
鉴于(据我所知),Kotlin编译器不会在生成的类中存储任何版本信息,我认为你不能 .
与...不同Scala,embeds its major and minor version in the compiled class files,Kotlin只为方法和类等添加@Metadata注释,以保存有关可空性,可变性等的信息 . 您可以找到此信息的原型here .
您可以使用embedding the version in the JAR's name的旧版"standard"(也在Scala项目中使用) .