JDK-8221430 : StringBuffer(CharSequence) constructor truncates when -XX:-CompactStrings specified
  • Type: Bug
  • Component: core-libs
  • Sub-Component: java.lang
  • Affected Version: 13
  • Priority: P3
  • Status: Closed
  • Resolution: Fixed
  • Submitted: 2019-03-25
  • Updated: 2022-08-08
  • Resolved: 2019-04-09
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 13
13 b16Fixed
Related Reports
Relates :  
Description
If Compact Strings is disabled, the StringBuffer/StringBuilder(CharSequence)
constructor truncates the string in half, eg:
        StringBuffer sb2 = new StringBuffer((CharSequence)new StringBuffer("test2"));
        System.out.println(sb2);
        System.out.println(sb2.toString().equals("test2"));

Results in output ==>
    tes
    false

JDK13 regression from change JDK-8218227

Comments
URL: http://hg.openjdk.java.net/jdk/jdk/rev/f847a42ddc01 User: igerasim Date: 2019-04-09 23:31:43 +0000
09-04-2019