tschuchort
01/26/2021, 4:38 PMjavaSourceRoots
compiler option. Both KaptOptions
and K2JVMCompilerArguments
have a javaSourceRoots
member. So far I have been passing both paths to Kotlin source files and Java source files as K2JVMCompilerArguments.freeArgs
to the compiler and it has worked fine for the most part. Now we have noticed a problem that nested classes in Java sources can not be resolved by compiler plugins. This problem seems to go away when javaSourceRoots
is set to the parent directory where the Java source files are located, but not when paths to the Java source files directly are added to javaSourceRoots
.
1. Why can we give the compiler direct paths to Kotlin files but all the Java files have to be located in the same directory? We can see that the same parameter in KaptOptions
accepts paths to files and not to a parent directory: https://github.com/JetBrains/kotlin/blob/e2521718ddef33d25158032dee649b1fa6f5b73a/[…]t3/kapt3-compiler/src/org/jetbrains/kotlin/kapt3/Kapt3Plugin.kt
2. Why is this option needed at all? The K2JVMCompiler
is able to find and compile Java sources without it, but apparently not nested classes?udalov