On 10/31/18 5:25 PM, Nico Williams wrote:
I think you should put braces around the conditional statements on lines
332, 357, & 359. It would read better and avoid accidental bugs.
Is that part of a published Java style?
(Personally, I dislike braces for single statement blocks. But we'll follow
whatever style guide exists.)
Mostly for consistency, but it can help avoid accidental bugs where you
forget to put the braces in, ex:
if (a == true)
doThis();
doThat();
It's not yet an official style guide, but here is a draft of the Java
style guidelines:
http://cr.openjdk.java.net/~alundblad/styleguide/index-v6.html#toc-braces
Of course, not all code in the JDK follows this rule, and I am sure
there are personal preferences each way but I think what is worse is
when you have a mix of both styles within the same class or package.
Other coding guidelines such as from Google [1] also give similar advice.
--Sean
[1] https://google.github.io/styleguide/javaguide.html#s4.1-braces