src/java.base/share/classes/java/lang/String.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File jdk Cdiff src/java.base/share/classes/java/lang/String.java

src/java.base/share/classes/java/lang/String.java

Print this page

        

*** 1119,1128 **** --- 1119,1130 ---- if ((val[i] & 0xff) != cs.charAt(i)) { return false; } } } else { + // Redundant: n == length() (see earlier check) + checkOffset(n, val.length >> 1); for (int i = 0; i < n; i++) { if (StringUTF16.getChar(val, i) != cs.charAt(i)) { return false; } }
*** 1832,1842 **** // srcCoder == UTF16 && tgtCoder == LATIN1 int min = tgtCount - 1; int i = min + fromIndex; int strLastIndex = tgtCount - 1; ! char strLastChar = (char)(tgt[strLastIndex] & 0xff); startSearchForLastChar: while (true) { while (i >= min && StringUTF16.getChar(src, i) != strLastChar) { i--; } --- 1834,1856 ---- // srcCoder == UTF16 && tgtCoder == LATIN1 int min = tgtCount - 1; int i = min + fromIndex; int strLastIndex = tgtCount - 1; ! char strLastChar = (char) (tgt[strLastIndex] & 0xff); ! ! // Redundant: ! // i == min + fromIndex ! // fromIndex <= rightIndex (earlier check) ==> ! // i <= min + rightIndex == (tgtCount - 1) + (srcCount - tgtCount) == srcCount - 1 ==> ! // i <= srcCount - 1 ! // ! // And (srcCount < src.length >> 1) is covered by: ! // ASB.lastIndexOf(String str, int fromIndex) { ! // checkIndex(count, value.length >> coder); ! checkIndex(i, src.length >> 1); ! startSearchForLastChar: while (true) { while (i >= min && StringUTF16.getChar(src, i) != strLastChar) { i--; }
src/java.base/share/classes/java/lang/String.java
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File