RFR (S): 8065070: (fmt) Avoid creating substrings when building FormatSpecifier

Aleksey Shipilev aleksey.shipilev at oracle.com
Mon Nov 17 12:29:11 UTC 2014


On 11/17/2014 03:23 PM, Claes Redestad wrote:
> 
> On 2014-11-17 12:54, Aleksey Shipilev wrote:
>>> Perhaps rewriting to something like this would make the code
>>> cleaner:
>>>
>>>                index(s, m.start(1), m.end(1));
>>>                flags(s, m.start(2), m.end(2));
>>>                width(s, m.start(3), m.end(3));
>>>                precision(s, m.start(4), m.end(4));
>>>                  int tTStart = m.start(5);
>>>                if (tTStart >= 0) {
>>>                    dt = true;
>>>                    if (s.charAt(tTStart) == 'T') {
>>>                        f.add(Flags.UPPERCASE);
>>>                  }
>>>                }
>>>                conversion(s.charAt(m.start(6)));
>> Yes please.
>>
>>> (I noticed that getting and checking tTEnd is basically redundant,
>>> since the formatSpecifier regex guarantees either one char or
>>> nothing is matched for that group)
>> That makes sense.
> 
> New webrev including the above cleanup:
> 
> http://cr.openjdk.java.net/~redestad/8065070/webrev.01

Good, thank you!

-Aleksey.





More information about the core-libs-dev mailing list