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

Cleanup redundant Math.max/min calls in DefaultHighlighter

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P5
    • Resolution: Fixed
    • Affects Version/s: 17, 18
    • Fix Version/s: 18
    • Component/s: client-libs
    • Labels:
      None

      Description

      Method javax.swing.text.DefaultHighlighter#changeHighlight
      ```
              if (p1 < p0) {
                  throw new BadLocationException("Invalid end of the range", p1);
              }
              ...
              safeDamageRange(Math.min(p0, p1), Math.max(p0, p1));
      ```
      This Math.max and Math.min calls are redundant, because order of p0 and p1 is checked in method pre-conditions.
      Checks were added under JDK-6771184

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              aturbanov Andrey Turbanov
              Reporter:
              aturbanov Andrey Turbanov
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: