1   package com.puppycrawl.tools.checkstyle.checks.coding.requirethis;
2   
3   import java.io.BufferedReader;
4   import java.io.FileNotFoundException;
5   import java.io.InputStreamReader;
6   import java.io.IOException;
7   
8   public final class InputRequireThisStatic {
9       public static String staticField1 = "";
10  
11      public static String staticField2 = new String(staticField1);
12  
13      public String instanceField1;
14      public BufferedReader instFld2;
15  
16      static {
17          try (BufferedReader instFld2 = new BufferedReader(new InputStreamReader(null, "utf-8"))) {
18              instFld2.readLine();
19          }
20          catch (FileNotFoundException e) {
21          }
22          catch (IOException e) {
23          }
24      }
25  
26      public String get() {
27          return staticField1;
28      }
29  
30      void foo50(String staticField1) {
31          staticField1 = staticField1;
32      }
33  
34      void foo52(String staticField1) {
35          staticField1 += staticField1;
36      }
37  
38      static void test(String instanceField1) {
39          if (instanceField1 == null) {
40              instanceField1 = staticField1;
41          }
42      }
43  
44      static void test2() {
45          try (BufferedReader instFld2 = new BufferedReader(new InputStreamReader(null, "utf-8"))) {
46              instFld2.readLine();
47          }
48          catch (IOException e) {
49          }
50      }
51  }