-
Enhancement
-
Resolution: Fixed
-
P4
-
8u40
-
b72
-
x86
-
windows_8
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8135994 | emb-9 | Ivan Gerasimov | P4 | Resolved | Fixed | team |
A DESCRIPTION OF THE REQUEST :
Please add an "append substring" method to StringBuilder, with semantics similar to the already existing "append sub-char-array", append(char[], int, int).
JUSTIFICATION :
With the recent change to String.substring where it copies the underlying char[] rather than reusing it, it is no longer "free" to append substrings to a StringBuilder.
Yes, perhaps the JIT eventually figures that out, but why make it do that work? And as a developer it's risky to rely on the JIT for such things - how can I be sure it will always do the right thing?
Please add an "append substring" method to StringBuilder, with semantics similar to the already existing "append sub-char-array", append(char[], int, int).
JUSTIFICATION :
With the recent change to String.substring where it copies the underlying char[] rather than reusing it, it is no longer "free" to append substrings to a StringBuilder.
Yes, perhaps the JIT eventually figures that out, but why make it do that work? And as a developer it's risky to rely on the JIT for such things - how can I be sure it will always do the right thing?
- backported by
-
JDK-8135994 (str) Optimize AbstractStringBuilder.append(CharSequence, int, int) for String argument
- Resolved
- duplicates
-
JDK-6792262 (str) Add a getChars method to java.lang.CharSequence
- Open
-
JDK-6813523 (str) Add method CharSequence.getChars() as StringBuilder.getChars()
- Open
- relates to
-
JDK-8130778 (str) Make AbstractStringBuilder.append(CharSequence, int, int) to throw StringIndexOutOfBoundsException
- Closed