Closed maxvetrenko closed 10 years ago
1) add youself as author
2)
setAllowEmptyLoops
I do not see a reason in this booelan field, as we could as user to define tokens where empty block is allowed {TokenTypes.LITERAL_FOR , TokenTypes.LITERAL_WHILE} Let user define Style he wants, do not restrict him.
1)
<property name="allowEmptyLoops" value="true" />
?
There is no such code in last commit.
squash all commit in one to let me validate them, I use only last commits reference on this page.
I have only one commit: EmptyBlockUpdate branch. I always amend it after making changes.
I do not see changes in Check itself, is it expected ?
Yes, there is no changes in Check, I added UT to test Google's rule coverage.
ok to PR.
http://checkstyle.sourceforge.net/config_blocks.html#EmptyBlock http://google-styleguide.googlecode.com/svn/trunk/javaguide.html#s4.1.3-braces-empty-blocks If (a==1) {} //is not OK If (doSideEffect()==1) {} //is not OK, while ((r = in.read()) != 0) {} // is OK for (; index < s.length() && s[index] != 'x'; index++) {} // is OK
and If (a==1) {} else {print(a)} // is not OK
Till comments support are not in Checkstyle you can not extend this check to allow empty blocks that have a comments.
// it is OK, but you can not support this now If (a==1) {/it is ok /} else {print(a)}