View Javadoc
1   /*
2   ExecutableStatementCount
3   max = 0
4   tokens = METHOD_DEF
5   
6   
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.sizes.executablestatementcount;
10  
11  public class InputExecutableStatementCountMethodDef {
12      public void foo() { // violation
13          while (true) {
14              Runnable runnable = new Runnable() {
15                  public void run() { // violation
16                      while (true) {
17                      }
18                  }
19              };
20  
21              new Thread(runnable).start();
22          }
23      }
24  
25      public void bar() { // violation
26          if (System.currentTimeMillis() == 0) {
27              if (System.currentTimeMillis() == 0 && System.currentTimeMillis() == 0) {
28              }
29  
30              if (System.currentTimeMillis() == 0 || System.currentTimeMillis() == 0) {
31              }
32          }
33      }
34  
35      public void simpleElseIf() { // violation
36          if (System.currentTimeMillis() == 0) {
37          } else if (System.currentTimeMillis() == 0) {
38          } else {
39          }
40      }
41  
42      public void stupidElseIf() { // violation
43          if (System.currentTimeMillis() == 0) {
44          } else {
45              if (System.currentTimeMillis() == 0) {
46              } else {
47                  if (System.currentTimeMillis() == 0) {
48                  }
49              }
50  
51              if (System.currentTimeMillis() == 0) {
52              }
53          }
54      }
55  
56      /** Inner */
57      public InputExecutableStatementCountMethodDef(int aParam)
58      {
59          Runnable runnable = new Runnable() {
60              public void run() { // violation
61                  while (true) {
62                  }
63              }
64          };
65          new Thread(runnable).start();
66      }
67  }