How does the kotlin compiler process java code when compiling kotlin code?

Viewed 136

I only know that when compiling a mixed project of java and kotlin, the compiler will process the kotlin code first, but if an object of the java class is created in the kotlin code, how does the compiler handle it? Does the kotlin compiler need to compile java files to javapsifile first?

1 Answers

In that case you need to supply the Kotlin compiler with the related Java source files path. Any code defined in those Java source files are available for the Kotlin compiling.

Kotlin compiler is loading those Java files (I assume as some AST) and can link to those. No class files are generated for the Java files.

Related