Summary
Change documentation for String.regionMatches fix incorrect use of String.substring.
Problem
Existing documentation for String.regionMatches contains two instances of String.substring where the second argument is treated as length instead of end offset.
Solution
Correct both instances to use the correct second argument.
Specification
diff --git a/src/java.base/share/classes/java/lang/String.java b/src/java.base/share/classes/java/lang/String.java
index 6ceaf74da49..316f1455d7b 100644
--- a/src/java.base/share/classes/java/lang/String.java
+++ b/src/java.base/share/classes/java/lang/String.java
@@ -2169,9 +2169,9 @@ public final class String
* ignoring case if and only if {@code ignoreCase} is true.
* The sequences {@code tsequence} and {@code osequence} are compared,
* where {@code tsequence} is the sequence produced as if by calling
- * {@code this.substring(toffset, len).codePoints()} and {@code osequence}
- * is the sequence produced as if by calling
- * {@code other.substring(ooffset, len).codePoints()}.
+ * {@code this.substring(toffset, toffset + len).codePoints()} and
+ * {@code osequence} is the sequence produced as if by calling
+ * {@code other.substring(ooffset, ooffset + len).codePoints()}.
* The result is {@code true} if and only if all of the following
* are true:
* <ul><li>{@code toffset} is non-negative.
- csr of
-
JDK-8268236 The documentation of the String.regionMatches method contains error
-
- Resolved
-