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