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

Remove redundant bounds check from AbstractStringBuilder.charAt()

    XMLWordPrintable

    Details

    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 18
    • Component/s: core-libs
    • Labels:
      None
    • Subcomponent:
    • Resolved In Build:
      b09

      Description

      AbstractStringBuilder.charAt(int) does bounds check before calling charAt() (for non-latin Strings):

      @Override
      public char charAt(int index) {
          checkIndex(index, count);
          if (isLatin1()) {
              return (char)(value[index] & 0xff);
          }
          return StringUTF16.charAt(value, index);
      }

      This can be improved by removing bounds check from ASB.charAt() in favour of one in String*.charAt()

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              stsypanov Sergey Tsypanov
              Reporter:
              stsypanov Sergey Tsypanov
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: