< prev index next >

test/jdk/java/lang/StringBuffer/CompactStringBuffer.java

Print this page
rev 54280 : 8221430: StringBuffer(CharSequence) constructor truncates when -XX:-CompactStrings specified

*** 1,7 **** /* ! * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. --- 1,7 ---- /* ! * Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation.
*** 438,447 **** --- 438,453 ---- //////////////////////////////////////////////////////////////////// check(new StringBuffer().append(ascii).append(1.23456).toString(), "abcdefgh1.23456"); check(new StringBuffer().append(bmp).append(1.23456).toString(), "\u4e00\u4e01\u4e02\u4e03\u4e04\u4e05\u4e06\u4e07\u4e081.23456"); + + //////////////////////////////////////////////////////////////////// + check(new StringBuffer((CharSequence)new StringBuffer(ascii)).toString(), + ascii); + check(new StringBuffer((CharSequence)new StringBuffer(asciiMixed)).toString(), + asciiMixed); } private void checkGetChars(StringBuffer sb, int srcBegin, int srcEnd, char expected[]) { char[] dst = new char[srcEnd - srcBegin];
< prev index next >