I like this one, > if (this == obj) { > return true; > }
Regards, r00t4dm Cloud-Penetrating Arrow Lab of Meituan Corp Information Security Department > 2020年12月23日 下午10:07,Erick Erickson <erickerick...@gmail.com> 写道: > > I took a quick look at lucene/queries just to get my feet wet. Before working > on it seriously. I did a fast scan through about half of the changes and have > only one question. > > The formatter tightens up non-block comments, i.e. > > if (this == obj) > return true; > > becomes > > if (this == obj) return true; > > Which one is clearer is always a matter of debate, but my take is that braces > should be added when the _original_ code was on multiple lines, respecting > the opinion of the author. So the above would get braces added manually: > > if (this == obj) { > return true; > } > > However, if the original code were: > > if( this == obj ) return true; > > and it reformatted to: > > if (this == obj) return true; > > leave it be. > > Does this align with other people’s opinion? > > Or is the consensus that any changed non-block should have braces added on > the theory that braces are always clearer and the code was changed anyway? In > which case the second example would get braces. > > I don’t particularly have any strong opinion, and I don’t think we need to be > draconian about it, just thought that I’d do whatever others are doing. > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org > For additional commands, e-mail: dev-h...@lucene.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org For additional commands, e-mail: dev-h...@lucene.apache.org