View Javadoc
1   /*
2   VariableDeclarationUsageDistance
3   allowedDistance = 1
4   ignoreVariablePattern = (default)
5   validateBetweenScopes = true
6   ignoreFinal = false
7   
8   
9   */
10  
11  package com.puppycrawl.tools.checkstyle.checks.coding.variabledeclarationusagedistance;
12  
13  import java.util.HashSet;
14  import java.util.Iterator;
15  import java.util.List;
16  
17  public class InputVariableDeclarationUsageDistanceGeneral4 {
18  
19      class Parent {
20          void mm() {
21          }
22          <T> void xx(List<T> m){}
23      }
24      public void method9() {
25          // until https://github.com/checkstyle/checkstyle/issues/13011
26          Integer z = 5; // violation 'Distance .* is 3.'
27          Iterator<Integer> mn = new HashSet<Integer>().iterator();
28          class BClass extends Parent {
29              Boolean h = false;
30              @Override
31              public <t> void xx(List<t> a) {
32                  if (a.get(0).toString().compareTo("1") > 0) {
33                      System.out.println("temp");
34                  }
35              }
36              @Override
37              public void mm() {
38              }
39              void nn(Boolean m) {
40                  if(z<0){
41                      System.out.println();
42                  }
43              }
44          }
45      }
46  }