View Javadoc
1   ////////////////////////////////////////////////////////////////////////////////
2   // Test case file for checkstyle.
3   // Created: 2001
4   ////////////////////////////////////////////////////////////////////////////////
5   package com.puppycrawl.tools.checkstyle.checks.blocks.emptyblock;
6   
7   import java.io.*; // star import for instantiation tests
8   import java.awt.Dimension; // explicit import for instantiation tests
9   import java.awt.Color;
10  
11  /**
12   * Test case for detecting empty block statements.
13   * @author Lars K├╝hne
14   **/
15  class InputEmptyBlockSemantic
16  {
17      static {
18          Boolean x = new Boolean(true);
19      }
20  
21      {
22          Boolean x = new Boolean(true);
23          Boolean[] y = new Boolean[]{Boolean.TRUE, Boolean.FALSE};
24      }
25  
26      Boolean getBoolean()
27      {
28          return new java.lang.Boolean(true);
29      }
30  
31      void exHandlerTest()
32      {
33          try {
34          }
35          finally {
36          }
37          try {
38          // something
39          }
40          finally {
41              // something
42          }
43          try {
44              ; // something
45          }
46          finally {
47              ; // statement
48          }
49      }
50  
51      /** test **/
52      private static final long IGNORE = 666l + 666L;
53  
54      public class EqualsVsHashCode1
55      {
56          public boolean equals(int a)
57          {
58              return a == 1;
59          }
60      }
61  
62      // empty instance initializer
63      {
64      }
65  
66      private class InputBraces {
67          
68      }
69  
70      synchronized void foo() {
71          synchronized (this) {} // not OK
72          synchronized (Class.class) { // OK
73              synchronized (new Object()) {
74                  // not OK if checking statements
75              }
76          }
77      }
78      
79      
80      static {
81         
82      int a = 0;}
83      
84      static {
85          
86      }
87  }