RFR: 8215281: Use String.isEmpty() where applicable in java.base
Daniel Fuchs
daniel.fuchs at oracle.com
Thu Dec 13 13:06:07 UTC 2018
Looks good Claes!
I eyeballed the rest of the patch and found
nothing wrong - but with a patch this size
it would be easy to miss something.
Were you able to measure any improvement after
patching?
best regards,
-- daniel
On 12/12/2018 17:06, Claes Redestad wrote:
>
>
> On 2018-12-12 17:54, Daniel Fuchs wrote:
>> Hi Claes,
>>
>> It might read even better if things like:
>>
>> + resultString = !specarg.isEmpty() ? specarg.intern(): opt;
>>
>> were changed into:
>>
>> + resultString = specarg.isEmpty() ? opt : specarg.intern();
>>
>> best regards,
>
> I only found this pattern in this file, so incremental
> diff will look like the below. I will update in place due hugeness of
> webrev.
>
> Thanks!
>
> /Claes
>
> diff -r 732b03e40349
> src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java
> --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java
> Wed Dec 12 17:41:46 2018 +0100
> +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java
> Wed Dec 12 18:03:57 2018 +0100
> @@ -641,10 +641,10 @@
> String specarg = spec.substring(sidx);
> switch (specop) {
> case '.': // terminate the option sequence
> - resultString = !specarg.isEmpty() ?
> specarg.intern(): opt;
> + resultString = specarg.isEmpty() ? opt :
> specarg.intern();
> break doArgs;
> case '?': // abort the option sequence
> - resultString = !specarg.isEmpty() ?
> specarg.intern(): arg;
> + resultString = specarg.isEmpty() ? arg :
> specarg.intern();
> isError = true;
> break eachSpec;
> case '@': // change the effective opt name
> @@ -655,7 +655,7 @@
> val = "";
> break;
> case '!': // negation option
> - String negopt = !specarg.isEmpty() ?
> specarg.intern(): opt;
> + String negopt = specarg.isEmpty() ? opt :
> specarg.intern();
> properties.remove(negopt);
> properties.put(negopt, null); // leave
> placeholder
> didAction = true;
More information about the security-dev
mailing list