Solution: Adjust Kotlin for Java usage

@file:JvmName("MoneyUtils") package advanced.java import java.math.BigDecimal data class Money @JvmOverloads constructor( val amount: BigDecimal = BigDecimal.ZERO, val currency: Currency = Currency.EUR, ) { companion object { @JvmStatic fun eur(amount: String) = Money(BigDecimal(amount), Currency.EUR) @JvmStatic fun usd(amount: String) = Money(BigDecimal(amount), Currency.USD) @JvmField val ZERO_EUR = eur("0.00") } } @JvmName("sumMoney") fun List<Money>.sum(): Money? { if (isEmpty()) return null val currency = this.map { it.currency }.toSet().single() return Money( amount = sumOf { it.amount }, currency = currency ) } operator fun Money.plus(other: Money): Money { require(currency == other.currency) return Money(amount + other.amount, currency) } enum class Currency { EUR, USD }