To the style rant, I mean.

On 05 Sep 2014, at 13:40, Marcus Lagergren <marcus.lagerg...@oracle.com> wrote:

> +1
> 
> On 05 Sep 2014, at 12:46, Aleksey Shipilev <aleksey.shipi...@oracle.com> 
> wrote:
> 
>> On 09/05/2014 12:09 PM, Vladimir Ivanov wrote:
>>> http://cr.openjdk.java.net/~vlivanov/8057654/webrev.00/
>>> https://bugs.openjdk.java.net/browse/JDK-8057654
>> 
>> Random style rant of the week, not particularly about this concrete
>> patch. Can we please try to systematically use more
>> readable/robust/secure idioms? E.g.:
>> 
>> a) Always have curly braces around the blocks?
>> 
>>    if (ok && ...) {
>>      ok = false;
>>    }
>>    if (!ok) {
>>      throw misMatchedTypes(...);
>>    }
>>    return rtype;
>> 
>>  vs.
>> 
>>    if (ok && ...)
>>      ok = false;
>>    if (!ok)
>>      throw misMatchedTypes(...);
>>    return rtype;
>> 
>>  Apple's "goto fail;" bug, anyone?
>> 
>> b) Have only a single initialization per line?
>> 
>>      boolean match = true;
>>      boolean fail = false;
>>  vs.
>>      boolean match = true, fail = false;
>> 
>> c) Always have parentheses in ternary operators predicates?
>> 
>>      int foldVals = (rtype == void.class) ? 0 : 1;
>>   vs.
>>      int foldVals = rtype == void.class ? 0 : 1;
>> 
>> Thanks,
>> -Aleksey.
>> 
>> 
> 

Reply via email to