View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.coding.hiddenfield;
2   
3   import java.util.Comparator;
4   
5   public class InputHiddenFieldStaticVisibility {
6       static int someField;
7       static InputHiddenFieldStaticVisibility other = null;
8       InputHiddenFieldStaticVisibility field = null;
9   
10      static void method(InputHiddenFieldStaticVisibility field, InputHiddenFieldStaticVisibility other) {
11          // field 'field' can not be referenced form a static context
12          // static field 'other' can be referenced from a static context
13      }
14  
15      static class B {
16          void method(InputHiddenFieldStaticVisibility field, InputHiddenFieldStaticVisibility other) {
17              // field 'field' can not be referenced form a static context
18              // static field 'other' can be referenced from a static context
19          }
20      }
21  
22      static Comparator<InputHiddenFieldStaticVisibility> COMP = new Comparator<InputHiddenFieldStaticVisibility>() {
23          @Override
24          public int compare(InputHiddenFieldStaticVisibility field, InputHiddenFieldStaticVisibility other) {
25              // field 'field' can not be referenced form a static context
26              // static field 'other' can be referenced from a static context
27              return 0;
28          }
29      };
30  
31      static Comparator<InputHiddenFieldStaticVisibility> createComp() {
32          return new Comparator<InputHiddenFieldStaticVisibility>() {
33              @Override
34              public int compare(InputHiddenFieldStaticVisibility field, InputHiddenFieldStaticVisibility other) {
35                  // field 'field' can not be referenced form a static context
36                  // static field 'other' can be referenced from a static context
37                  return 0;
38              }
39          };
40      }
41  
42      static void foo1(int a) {}
43  
44      void foo2(int a) {}
45  
46      static void foo3(int someField) {}
47  }