[9] RFR (S) 8057654: Extract checks performed during MethodHandle construction into separate methods

Aleksey Shipilev aleksey.shipilev at oracle.com
Fri Sep 5 10:46:54 UTC 2014


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.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: OpenPGP digital signature
URL: <http://mail.openjdk.java.net/pipermail/mlvm-dev/attachments/20140905/97c0681a/signature.asc>


More information about the mlvm-dev mailing list