Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8337457

Redundant Math.round call in AquaProgressBarUI#getStringPlacement

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P5 P5
    • 24
    • 21
    • client-libs

      There is a suspicious call to the Math.round method with integer argument.Calling Math.round with integer argument is useless - it will just return the same passed value.

      https://github.com/openjdk/jdk/blob/d10afa26e5c59475e49b353ed34e8e85d0615d92/src/java.desktop/macosx/classes/com/apple/laf/AquaProgressBarUI.java#L259

      com.apple.laf.AquaProgressBarUI#getStringPlacement

          return new Point(x + Math.round(width / 2 - stringWidth / 2), y + ((height + fontSizer.getAscent() - fontSizer.getLeading() - fontSizer.getDescent()) / 2) - 1);

      'width' and 'stringWidth' are 'int'

      Seems we should remove it.

            psadhukhan Prasanta Sadhukhan
            aturbanov Andrey Turbanov
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: