JDK-8263446 : Avoid unary minus over unsigned type in ObjectSynchronizer::dec_in_use_list_ceiling
  • Type: Bug
  • Component: hotspot
  • Sub-Component: runtime
  • Affected Version: 17
  • Priority: P4
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2021-03-11
  • Updated: 2021-03-18
  • Resolved: 2021-03-15
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 17
17 b14Fixed
Related Reports
Relates :  
Description
SonarCloud complains:
  Unary minus should not be applied to an unsigned expression

Here:

void ObjectSynchronizer::dec_in_use_list_ceiling() {
  Atomic::add(&_in_use_list_ceiling, -AvgMonitorsPerThreadEstimate);
}

We can instead use Atomic::sub.
Comments
Changeset: ba22e6f6 Author: Aleksey Shipilev <shade@openjdk.org> Date: 2021-03-15 06:25:36 +0000 URL: https://git.openjdk.java.net/jdk/commit/ba22e6f6
15-03-2021