View Javadoc

1   /**
2    * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
3    */
4   package net.sourceforge.pmd.rules;
5   
6   import net.sourceforge.pmd.AbstractRule;
7   import net.sourceforge.pmd.ast.ASTBlockStatement;
8   import net.sourceforge.pmd.ast.ASTForStatement;
9   import net.sourceforge.pmd.ast.Node;
10  
11  public class StringConcatenationRule extends AbstractRule {
12  
13      public Object visit(ASTForStatement node, Object data) {
14          Node forLoopStmt = null;
15          for (int i = 0; i < 4; i++) {
16              forLoopStmt = node.jjtGetChild(i);
17              if (forLoopStmt instanceof ASTBlockStatement) {
18                  break;
19              }
20          }
21          if (forLoopStmt == null) {
22              return data;
23          }
24  
25  
26          return data;
27      }
28  }