Why is RoundingMode is not resolving in Java 21?

499 views Asked by At

I am trying to work through a Spring lab and when I try to pull in Java 21, RoundingMode is not resolving. I have been trying to research what I am doing wrong but I'm not finding anything seems to be off. The class that I am trying to use is

import java.math.RoundingMode;  // <--this doesn't resolve

Error:

"Cannot resolve symbol 'RoundingMode'"

This is the method that I'm trying to use RoundingMode as part of the BigDecimal.setScale.

private void initValue(BigDecimal value) {
    this.value = value.setScale(2, RoundingMode.HALF_EVEN);
}

Everything that I'm reading RoundingMode is part of the JDK yet when I back down to Java17 then everything works just fine and the exact same import and usage for setting scale also resolves with no issues within my IDE.

Using IntelliJ 2022.3.3 as my IDE on MacOS.

1

There are 1 answers

0
Will Lied On