Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8221430

StringBuffer(CharSequence) constructor truncates when -XX:-CompactStrings specified

XMLWordPrintable

    • b16
    • Verified

      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

            aleonard Andrew Leonard
            aleonard Andrew Leonard
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: