Replacing Kotlin with Java

javahhas been deprecated since JDK 8 and will / was removed in JDK 10 , and in accordance with JEP 313 and obsolescence javac, flag text -hshould be used instead:

Warning. The tool javahis planned to be removed in the next major version of the JDK. The tool has been replaced with the '-h' option added to javacthe JDK 8. Users are encouraged to switch to the javac'-h' option ; see the javac man page for more information.

The problem is that it javahworks with compiled files .class, but it javacworks with source files (i.e. .java).

javahworks fine with Kotlin functions and externalsince everything ends with compilation as Java bytecode, but since there are no Java source files, when using Kotlin I don’t see any way I javac -hcould work.

Is there a replacement javahor workaround for Kotlin?

+10
source share
2 answers

Until Kotlin starts generating a specific JDK10 bytecode, you can use the tool javahfrom JDK 9 or lower on compiled kotlin classes.

And even after that you can compile externalfunctions with jvmTarget=1.8and use javahin the resulting classes.

0
source

, gjavap . javap-,

0

Source: https://habr.com/ru/post/1695393/


All Articles