Two operators for nullable and non-nullable of the same type

I’ve created a class BDC(val v: BigDecimal) which implements some operations over BigDecimal.
Now I want to define two operators - one for nullable and other for non-nullable version of BDC

operator fun plus(other: BDC): BDC = …
operator fun plus(other: BDC?): BDC? = …

Compiler says that both of them have the same JVM signature.
How to achieve my goal to have operator which accepts nullable and non-nullable version of a type ?

Thanks

use @JvmName annotation:

operator fun plus(other: BDC): BDC = …
@JvmName("plusNullable")
operator fun plus(other: BDC?): BDC? = …
2 Likes

Thank you