You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[java] UnnecessaryBoxing: False positive when removing the conversion selects a more specific primitive overload #7135
With an Integer value, Math.abs(value.longValue()) calls abs(long). Without longValue(), javac selects abs(int). All four abs overloads are applicable in phase 2 (JLS 15.12.2.3), and abs(int) is the most specific (JLS 15.12.2.5). For Integer.MIN_VALUE the result changes from 2147483648 to -2147483648.
The overload check from #5971 only suppresses the warning for overloads with a reference type, so it does not cover this case. PMD 7.16.0 reports the call too.
Activity