< prev index next >
src/java.base/share/classes/java/lang/StringBuilder.java
Print this page
rev 54318 : 8221430: StringBuffer(CharSequence) constructor truncates when -XX:-CompactStrings specified
Reviewed-by: igerasim, rriggs
Contributed-by: Andrew Leonard <andrew_m_leonard@uk.ibm.com>
*** 119,130 ****
*
* @param str the initial contents of the buffer.
*/
@HotSpotIntrinsicCandidate
public StringBuilder(String str) {
! super(str.coder(), str.length(), 16);
! append(str);
}
/**
* Constructs a string builder that contains the same characters
* as the specified {@code CharSequence}. The initial capacity of
--- 119,129 ----
*
* @param str the initial contents of the buffer.
*/
@HotSpotIntrinsicCandidate
public StringBuilder(String str) {
! super(str);
}
/**
* Constructs a string builder that contains the same characters
* as the specified {@code CharSequence}. The initial capacity of
*** 132,143 ****
* {@code CharSequence} argument.
*
* @param seq the sequence to copy.
*/
public StringBuilder(CharSequence seq) {
! super(String.LATIN1, seq.length(), 16);
! append(seq);
}
/**
* Compares two {@code StringBuilder} instances lexicographically. This method
* follows the same rules for lexicographical comparison as defined in the
--- 131,141 ----
* {@code CharSequence} argument.
*
* @param seq the sequence to copy.
*/
public StringBuilder(CharSequence seq) {
! super(seq);
}
/**
* Compares two {@code StringBuilder} instances lexicographically. This method
* follows the same rules for lexicographical comparison as defined in the
< prev index next >