https://kotlinlang.org logo
Title
i

Ilya Muradyan

05/02/2020, 6:00 PM
Hello, guys! There is a function
fun DependencyHandler.kotlin(module: String, version: String? = null): Any =
    "org.jetbrains.kotlin:kotlin-$module${version?.let { ":$version" } ?: ""}"
Why does it return Any? It becomes a problem when I use this overload of
implementation
:
implementation(kotlin("...")) { isTransitive = false }
In this variant,
implementation
takes
String
as a first argument and I need to explicitely cast return value to
String
o

octylFractal

05/02/2020, 6:02 PM
https://github.com/gradle/gradle/issues/12172 is a reported issue doesn't contain a reason though
i

Ilya Muradyan

05/02/2020, 6:05 PM
Thanks!
g

gregorbg

05/03/2020, 6:51 AM
If you can be certain that the return type is actually a string, you might as well do
implementation(kotlin("...").toString())
i

Ilya Muradyan

05/03/2020, 8:26 AM
Of course, but it's not too safe from API perspective)