Lots of warnings during compliation of JTE generated Kotlin code
See original GitHub issueAfter we have swithed to generate()
in the build.gradle.kts
(see our another issue #177), we are getting lots of Kotlin compiler warnings which we have never had before.
Below is list of warnings that we’ve faced:
// Unchecked cast: Any? to Response<ServiceResponse>
// many similar ones for different parameter names and types
// these all are our custom parameters which we pass into a KTE page, by declaring them like
// @param keyHistoryDetailsResponse: Response<KeyHistoryDetailsResponse>
val fesServiceResponse = params["fesServiceResponse"] as Response<com.flowcrypt.eap.clients.fes.ServiceResponse>
// Parameter 'params' is never used
@JvmStatic fun renderMap(jteOutput:gg.jte.html.HtmlTemplateOutput, jteHtmlInterceptor:gg.jte.html.HtmlInterceptor?, params:Map<String, Any?>) {
render(jteOutput, jteHtmlInterceptor);
}
// Parameter 'jteHtmlInterceptor' is never used
@JvmStatic fun render(jteOutput:gg.jte.html.HtmlTemplateOutput, jteHtmlInterceptor:gg.jte.html.HtmlInterceptor?) {
jteOutput.writeContent("....")
}
// 'capitalize(): String' is deprecated. Use replaceFirstChar instead
jteOutput.writeUserContent(provider.capitalize())
I suggest to add proper @Suppress(...)
statements into the generated code.
In the last case I’d suggest to use recommended method instead of deprecated one.
On my end, I’m looking into how to disable such warnings for certain paths (generated code) in the project but no luck so far.
Issue Analytics
- State:
- Created a year ago
- Comments:16 (16 by maintainers)
Top Results From Across the Web
Fail your build on Kotlin warnings | by Maxi Rosson - Dipien
Kotlin warnings are very useful for developers. They help to clean up the code and even fix potential bugs. This is how they...
Read more >Generated Kotlin code triggers compile warnings #207 - GitHub
This makes using Kotlin code generation mode impossible when allWarningsAsErrors is enabled. See #205. This time it's because the generated ...
Read more >Treating Warnings As Errors In Kotlin | by JAVING
some code that has unused parameters. command used to compile. warnings displayed in the console .jar file is created despite there are ...
Read more >Kotlin warnings with gradle build - java - Stack Overflow
The warnings that you see are reported by the Kotlin compiler, not by Android Lint, so lintOptions won't affect them.
Read more >How to supress OptIn warnings in Gradle and during Git ...
I'm using OptIn features quite liberally in my code base. Because of this, I get a lot of warnings of the following form...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Can you please also add in the beginning of each generated file following line:
I may later provide more fine-grained list of ktlint rules to disable, but for now suppressing all of them will be good enough.
Thanks, found
provider.capitalize()
in my code, will fix it.