diff --git a/pmd/xdocs/howtowritearule.xml b/pmd/xdocs/howtowritearule.xml index 667a2c459c..b7490cdcea 100644 --- a/pmd/xdocs/howtowritearule.xml +++ b/pmd/xdocs/howtowritearule.xml @@ -99,7 +99,35 @@ CompilationUnit
  • If you get a FileNotFoundException, make sure that go.bat is pointing to the test-data directory where you put Example.java
  • - +

    + So you can see in the example above that the AST for a WhileStatement looks kind of like this (excluding that expression gibberish for clarity): +

    + + + +

    + If you were to add curly braces and run the go.bat file again, you'd see that the AST would change a bit. It'd look like this: +

    + + + +

    + Ah ha! We see that the curly braces add a couple more AST elements - a Block and a BlockStatement. So all we have + to do is write a rule to detect a WhileStatement that's not followed by a Block, and we've got it. +