JDK-8197594: String#repeat
Jim Laskey
james.laskey at oracle.com
Thu Mar 1 15:14:26 UTC 2018
Thank you Bernd.
> On Mar 1, 2018, at 11:04 AM, Bernd Eckenfels <ecki at zusammenkunft.net> wrote:
>
> Hello,
>
> I would not encourage makeshift number formatting by mentioning left padding as a major usecase:
>
> Just remove that part:
>
> + * <p>
> + * This method may be used to create space padding for
> + * formatting text or zero padding for formatting numbers.
>
> I think this error without an Explanation can be hard to debug. It should be clear that Memory allocation was not attempted and what the actual Parameters where:
>
> + if (Integer.MAX_VALUE / count < len) {
> + throw new OutOfMemoryError();
> + }
>
> „Repeating „ + len + „ bytes „ + count + „ times would produce a String exceeding maximum size.“
>
> Gruss
> Bernd
> --
> http://bernd.eckenfels.net <http://bernd.eckenfels.net/>
>
> Von: Jim Laskey <mailto:james.laskey at oracle.com>
> Gesendet: Mittwoch, 28. Februar 2018 21:01
> An: Core-Libs-Dev <mailto:core-libs-dev at openjdk.java.net>
> Betreff: RFR: JDK-8197594: String#repeat
>
> Introduction of a new instance method String::repeat to allow an efficient and concise approach for generating repeated character sequences as strings.
>
> Performance information in JBS.
>
> Thank you.
>
> Cheers,
>
> — Jim
>
>
> JBS: https://bugs.openjdk.java.net/browse/JDK-8197594 <https://bugs.openjdk.java.net/browse/JDK-8197594>
> CSR: https://bugs.openjdk.java.net/browse/JDK-8198296
> <http://cr.openjdk.java.net/~jlaskey/8197594/String.html>
> Webrev: http://cr.openjdk.java.net/~jlaskey/8197594/webrev-02/index.html <http://cr.openjdk.java.net/~jlaskey/8197594/webrev-02/index.html>
> JavaDoc: http://cr.openjdk.java.net/~jlaskey/8197594/String.html <http://cr.openjdk.java.net/~jlaskey/8197594/String.html>
More information about the core-libs-dev
mailing list