No such method: replace$default with the latest version


#1

I recently updated my project to 0.12.200 and the following code:

return Strings.join("/", listOf(groupId.replace(".", "/"), artifactId, version, artifactId + "-" + version + ".pom"))

is now throwing:

Exception in thread "main" java.lang.NoSuchMethodError: kotlin.KotlinPackage.replace$default(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;ZI)Ljava/lang/String;

Any thoughts?

#2

 

val groupId = "com.examples"
val artifactId = "demo"
val version = “1.0”

val str = java.lang.String.join("/", listOf(groupId.replace(".", “/”), artifactId, version, artifactId + “-” + version + “.pom”))
println(str)

-> com/examples/demo/1.0/demo-1.0.pom

Is Strings.join is java.lang.String?


#3

Please ensure you have updated runtime library kotlin-runtime.jar. This exception can arise when you have compiled against new runtime, but use old runtime in production.


#4

Is Strings.join is java.lang.String?

No, String.join is the extension method defined for kotlin.String, not java.lang.String. In runtime the former type is same as the latter, but for compiler they are different types.