1
votes

Given a jar file that I know was compiled with kotlin, how do I determine which version of kotlin was used to compile the class files in it?

If I do the following I get 52 (i.e. JDK8)

javap -cp target.jar -verbose fully.qualified.class.name | grep major

That is the java target version though.

1

1 Answers

0
votes

I don't think you can, given that (as far as I know) the Kotlin compiler doesn't store any version information in generated classes.

Unlike e.g. Scala, which embeds its major and minor version in the compiled class files, Kotlin only adds @Metadata annotations to methods and classes etc. to hold information about nullability, mutability, etc. You can find the protobuf for this information here.

You could use the older "standard" (which was also used in Scala projects) of embedding the version in the JAR's name.