Skip to content

Commit d08549a

Browse files
Model for String.getChars
1 parent 766ac7a commit d08549a

File tree

1 file changed

+16
-11
lines changed

1 file changed

+16
-11
lines changed

src/main/java/java/lang/String.java

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -964,20 +964,25 @@ public int offsetByCodePoints(int index, int codePointOffset) {
964964
* <li>{@code dstBegin+(srcEnd-srcBegin)} is larger than
965965
* {@code dst.length}</ul>
966966
*
967-
* @diffblue.noSupport
967+
* @diffblue.fullSupport
968+
* @diffblue.untested
968969
*/
969970
public void getChars(int srcBegin, int srcEnd, char dst[], int dstBegin) {
970-
CProver.notModelled();
971-
// if (srcBegin < 0) {
972-
// throw new StringIndexOutOfBoundsException(srcBegin);
973-
// }
974-
// if (srcEnd > value.length) {
975-
// throw new StringIndexOutOfBoundsException(srcEnd);
976-
// }
977-
// if (srcBegin > srcEnd) {
978-
// throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
979-
// }
971+
if (srcBegin < 0) {
972+
throw new StringIndexOutOfBoundsException(srcBegin);
973+
}
974+
if (srcEnd > length()) {
975+
throw new StringIndexOutOfBoundsException(srcEnd);
976+
}
977+
if (srcBegin > srcEnd) {
978+
throw new StringIndexOutOfBoundsException(srcEnd - srcBegin);
979+
}
980+
// DIFFBLUE MODEL LIBRARY we inline System.arraycopy here so that we
981+
// can specialize it for characters.
980982
// System.arraycopy(value, srcBegin, dst, dstBegin, srcEnd - srcBegin);
983+
for(int i = 0; i < srcEnd - srcBegin; i++) {
984+
dst[dstBegin + i] = CProverString.charAt(this, srcBegin + i);
985+
}
981986
}
982987

983988
/**

0 commit comments

Comments
 (0)