#283 Allow space after ; in Iterator for loops

Future
open
nobody
Check (274)
5
2012-10-10
2004-02-17
No

My code always using white space inside of parentheses.
Checkstyle handles this great in all cases except for
one. For Iterator loops, the final semicolon should
be followed by a space and then a close paren as follows:

for ( Iterator iter = list.iterator(); iter.hasNext(); )
{
...
}

My current checks always complain about whitespace
after the final semicolon. If I remove that space
then the check passes.

It looks like this problem was implemented in feature
request #565666. But that case looks like it was for
code which does not normally use whitespace inside of
parens:

for (Iterator i = coll.iterator; i.hasNext(); ) {
// do something that will increment the iterator.
}

I have tried setting the EmptyForIteratorPad check but
it does not have any effect whether I use "space" or
"nospace".

<module name="EmptyForIteratorPad">
<property name="option" value="space"/>
</module>

Thanks for a great tool.
Cheers,
Leif

Discussion


Log in to post a comment.

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks