Yoavya
06/15/2022, 11:36 AMA
data class A(val x:String)
then we update the lib so that A has another val
data class A(val x: String, val y: String = "")
I used default parameters so everything should be fine, but it not.
the third party library will continue to call A("something") to a constructor that doesn’t exist and I am getting a
java.lang.NoSuchMethodError: A.<init>(Ljava/lang/String;ILkotlin/jvm/internal/DefaultConstructorMarker;)V
@JvmOverloads doesn’t help. Any solutions for this?mcpiroman
06/15/2022, 11:56 AMYoavya
06/15/2022, 11:58 AMmcpiroman
06/15/2022, 12:02 PMYoavya
06/15/2022, 12:04 PMephemient
06/15/2022, 12:19 PMcopy method changesephemient
06/15/2022, 12:20 PMThe only real way to avoid these binary-incompatibilities for public API is to avoid themodifier from the start and implementdata,equals, andhashCodeyourself.toString
Yoavya
06/15/2022, 12:51 PM