From 50667a690c466664749948ad0969155d98a75eed Mon Sep 17 00:00:00 2001
From: Tom Copeland
- Ah ha! We see that the curly braces add a couple more AST elements - a Block
+ Ah ha! We see that the curly braces add a couple more AST nodes - a Block
and a BlockStatement
. So all we have
to do is write a rule to detect a WhileStatement
that
has a Statement
that's not followed by a Block
, and we've got a rule violation.
@@ -202,8 +201,8 @@ public class WhileLoopsMustUseBracesRule extends AbstractRule {
]]>
OK, well, it won't look exactly like that - you'll need to wrap - the example in a CDATA tag. But I couldn't figure out how to do that with this document getting - confused. If you know how, please let me know.
+ the example in a CDATA tag. But I couldn't figure out how to do that without Maven getting confused. + If you know how to do this, please let me know.Concise, eh? There'll be more documentation on this later - in the form of - an O'Reilly article - so for now, use the Astviewer utility - to experiment with how XPath expressions interact with the AST. Now that I've said - "XPath expression" 5 times, I'll stop. XPath expression.
+Concise, eh? Here's an article with a lot more detail.