mar3kk
mar3kk

Reputation: 1936

How tu suppress warnings issued by javac task

Recent version of Moshi (1.15.0) is issuing a warning Kapt support in Moshi Kotlin Code Gen is deprecated and will be removed in 2.0. Please migrate to KSP. https://github.com/square/moshi#codegen"

This happens when Hilt is used as Hilt configures the annotation processor classpath of the hiltJavaCompile to be a mirror of the kapt and ksp configurations. This however triggers the aforementioned warning in Moshi: processingEnv.messager.printMessage(Diagnostic.Kind.WARNING, "Kapt support in Moshi Kotlin Code Gen is deprecated...")

https://github.com/square/moshi/blob/491e66bd6475860ec0cba35f76dd14ec88fbeeca/moshi-kotlin-codegen/src/main/java/com/squareup/moshi/kotlin/codegen/apt/JsonClassCodegenProcessor.kt#L73

The issue is mentioned in dagger (https://github.com/google/dagger/issues/4116) and Moshi projects (https://github.com/square/moshi/discussions/1752).

Our project has javac flag -werror set i we would like to avoid removing it. Is there any way in Gradle to suppress just this specific warning? So far I tried using ContextAwareTaskLogger.MessageRewriter but this message was not intercepted at all.

Upvotes: 2

Views: 83

Answers (0)

Related Questions