Kevin
06/24/2019, 10:05 PMextensions.kt
with a top-level function @file:JvmName("Utils")
and fun String.secretFeature()
, in the Java code, this translates to Utils.secretFeature(myString)
. However, the parameter name for myString
becomes $this$secretFeature
and generates a constant available at runtime used in the generated Intrinsics.checkParameterIsNotNull()
invocation. We rely on ProGuard for stripping out unreleased features and have a script to decompile and search for keywords. In this case, this generated parameter name is leaked as there's no way for ProGuard to remove that constant. I'd like to do something like @receiver:JvmName("stringParam") fun String.secretFeature()
.Dico
06/24/2019, 10:34 PMKevin
06/24/2019, 10:38 PMfun mySecretFeature(stringParam: String)
and then a Kotlin extension function that delegates to it (@JvmName("_") fun String.mySecretFeature()
) and then the Java classes never use the generated extension. I guess the generated Java method gets stripped out as unused via ProGuard. Technically it's still visible in autocomplete as Utils._
but it's good enough for now.