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 Object other = null;
8       Object field = null;
9   
10      static void method(Object field, Object 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(Object field, Object 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<Object> COMP = new Comparator<Object>() {
23          @Override
24          public int compare(Object field, Object 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<Object> createComp() {
32          return new Comparator<Object>() {
33              @Override
34              public int compare(Object field, Object 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  }