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

Cleanup redundant Math.max/min calls in DefaultHighlighter

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P5 P5
    • 18
    • 17, 18
    • client-libs
    • None

      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

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

              Created:
              Updated:
              Resolved: