View Javadoc
1   /*
2   RequireThis
3   checkFields = (default)true
4   checkMethods = (default)true
5   validateOnlyOverlapping = (default)true
6   
7   
8   */
9   
10  package com.puppycrawl.tools.checkstyle.checks.coding.requirethis;
11  
12  public class InputRequireThisCaseGroup {
13      private String aVariable;
14  
15      public String method1(int val) {
16          switch (val) {
17              case 0:
18                  String aVariable = "";
19  
20                  if (this.aVariable != null) {
21                      aVariable = this.aVariable;
22                  }
23  
24                  return aVariable;
25              default:
26                  return null;
27          }
28      }
29  
30      public String method2(int val) {
31          switch (val) {
32              case 0:
33                  String aVariable = "";
34  
35                  if (this.aVariable != null) {
36                      aVariable = this.aVariable;
37                  }
38  
39                  return aVariable;
40          }
41          return null;
42      }
43  
44      public String method3(int val) {
45          switch (val) {
46              case 0:
47                  String other = "";
48  
49                  if (aVariable != null) {
50                      other = aVariable;
51                  }
52  
53                  return other;
54          }
55          return null;
56      }
57  }