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

Remove redundant bounds check from AbstractStringBuilder.charAt()

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 18
    • None
    • core-libs
    • None
    • b09

      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()

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

              Created:
              Updated:
              Resolved: