When using new switch in java, I got a S2201 bug (return of … must be used)
BigDecimal amount=...;
String v = switch (param) {
case xxxx -> "aValue";
case paymentAmount -> amount.toPlainString();
case refundAmount -> amount.toPlainString();
default -> defaultValue();
};
I got " The return value of “toPlainString” must be used." for both the amount.toPlainString()
. (I think it is the same with toString()
) this is wrong as the value is used.