I am using the following configuration snippet in my Java/Kotlin Android project in the app/build.gradle file:
gradle.projectsEvaluated {
tasks.withType(JavaCompile) {
options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation"
}
}
It generates a verbose output of Lint warnings in .java files when the project is compiled.
I would like to achieve the same for .kt files. I found out that Kotlin has compiler options:
gradle.projectsEvaluated {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
kotlinOptions {
freeCompilerArgs = ["-Xlint:unchecked", "-Xlint:deprecation"]
}
}
}
However the compiler flags are not supported:
w: Flag is not supported by this version of the compiler: -Xlint:unchecked
w: Flag is not supported by this version of the compiler: -Xlint:deprecation
How can I output deprecation warnings for Kotlin code?