I set
allWarningsAsErrors = true
in all of my projects because I find that addressing warnings before they become bugs makes life easier.
However a lot of build functionality uses the same concept of warning to flag things that can't be addressed by the user.
There's been discussion about this before (e.g.
here and
here) and now I've run into it again when trying to update to Kotlin 2.0.0 in a project that uses kapt. If I set
kapt.use.k2 = false
I get this warning:
> Task :app:kaptGenerateStubsDebugKotlin FAILED
w: Kapt currently doesn't support language version 2.0+. Falling back to 1.9.
e: warnings found and -Werror specified
and if I set
kapt.use.k2 = true
I get this warning:
> Task :app:kaptGenerateStubsDebugKotlin FAILED
w: K2 kapt is an experimental feature. Use with caution.
e: warnings found and -Werror specified
in both cases my only recourse to using Kotlin 2.0.0 is to set
allWarningsAsErrors = false
which can lead to the quality of my project degrading.
It would be nice if
allWarningsAsErrors
differentiated between warnings that are resolvable by the user, and warnings that are not.