Is it possible to turn some Kotlin compiler warnin...
# compiler
d
Is it possible to turn some Kotlin compiler warnings into errors via a compiler plugin, or compiler plugins don't have access to that? Goal being for example turning unused variables into errors etc.
see flag allWarningsAsErrors
d
Yes I know right, it's insane. All C-compilers have for ages been able to flip specific compiler warnings into error.
I'm currently wrapping compilation in bash that greps for specific warnings and fail the build based on that. While it works, every line of bash smells bad.
Thus I was hoping to find more integrated deterministic ways of dealing with this.
g
I see now your point, no there is no way to do this for specific warning
I would create a feature request
not sure that compiler plugins has access to this information
d
Yeah, think there's an issue about this already iirc. Was hoping a plugin would be an alternative, thanks.
d
@Daniel Svensson We are working on refactoring CLI for new kotlin compiler, and in it we want support such functionality. But it won't be released soon, and there is no workarounds for your case right now
d
Excellent!
s
Theoretically, you could hack compiler to suppress particular diagnostics and introduce your own with the same text instead, but with Error level. I remember at least folks from arrow-meta doing something with diagnostics, but maybe it is available even without it. My suspicion is that it is limited to JVM only, but maybe it covers your case