View Javadoc
1   /*
2   RequireThis
3   checkFields = (default)true
4   checkMethods = (default)true
5   validateOnlyOverlapping = false
6   
7   
8   */
9   
10  package com.puppycrawl.tools.checkstyle.checks.coding.requirethis;
11  
12  import java.nio.file.Path;
13  import java.nio.file.Paths;
14  
15  public class InputRequireThisFor {
16      private String name;
17      int bottom;
18  
19      public void method1() {
20          for (int i = 0; i < 10; i++) {
21              int bottom = i - 4;
22              bottom = bottom > 0 ? bottom - 1 : bottom; // violation '.*variable 'bottom' needs .*'
23          }
24      }
25  
26      public void method2() {
27          for (String name : new String[]{}) {
28          }
29  
30          Path jarfile = Paths.get(name + ".jar"); // violation '.*variable 'name' needs .*'
31      }
32  }