RFR: JDK-8066619: String(byte,int,int,int) in String has been deprecated in Manifest and Attributes
philipp.kunz at paratix.ch
Tue Dec 18 06:15:37 UTC 2018
Thanks for pointing out about ISC. I replaced it with StringBuilders
but now I don't know with what capacity to initialize. Also the
previous code does not reveal a conscious choice about the buffer
capacity. So I arbitrarily chose 72 as an initial capacity which is one
line. Any suggestions?
Ideally I would have preferred to use the same single StringBuilder for
writing the whole Manifest but it cannot be easily passed from one
method to another down the stack because adding it as a parameter to
existing methods would change API not absolutely hidden (just like for
example make72Safe only deprecated rather than removed). Otherwise I
would probably have also replaced DataOutputStream with a custom one
somewhat similar to Manifest.FastInputStream that counts bytes and adds
line breaks accordingly which would make String concatenation
completely redundant. The main intention is still to resolve the
deprecation and hence I figure it might be good enough if the result is
at least as good as the previous version. Does that convince or make
Find another patch attached.
On Mon, 2018-12-17 at 08:06 +0100, Claes Redestad wrote:
> On 2018-12-17 07:42, Philipp Kunz wrote:
> > I did deliberately not touch the StringBuffer in the previous patch
> > but
> > fully agree now I know it has a chance to be accepted. Would you
> > accept
> > to replace StringBuffer with plain string concatenation afterhttp:/
> > /op
> > enjdk.java.net/jeps/280 which was not in place at the time those
> > StringBuffers were introduced?
> Unfortunately JEP 280-style indified string concatenation is not
> in the java.base module to avoid bootstrap issues.
> That said, even if you could benefit from ISC here, StringBuilders
> likely to be better when building up your string using loops and
> calls, unless there's a simple way to reduce it all down to a single
> concatenation expression (no passing the builder to another method,
> loops etc).
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 30857 bytes
Desc: not available
More information about the core-libs-dev