Too weak variable type leads to unnecessary cast
Reports type casts that can be removed if the variable type is narrowed to the cast type.
Here, changing the type of
String makes the cast redundant. The suggested quick-fix updates the variable type and removes all redundant casts on that variable:
New in 2018.2
IntelliJ IDEA 2023.3, Qodana for JVM 2023.3