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.*;
14  
15  public class InputVariableDeclarationUsageDistanceGeneral2 {
16      private void o() {
17          boolean first = true; // violation 'Distance .* is 5.'
18          do {
19              System.lineSeparator();
20              System.lineSeparator();
21              System.lineSeparator();
22              System.lineSeparator();
23              System.lineSeparator();
24              if (first) {}
25          } while(true);
26      }
27  
28      private static void checkInvariants() {
29          Set<Integer> allInvariants = new HashSet<Integer>(); // violation 'Distance .* is 2.'
30          for (int i = 0; i < 10; i++)
31              for (int j = 0; j < 10; j++) {
32                  for (int k = 0; k < 10; k++) {
33                      System.lineSeparator();
34  
35                      allInvariants.add(k);
36                  }
37              }
38      }
39  
40      private void p() {
41          float wet_delta = 0;
42  
43          if (wet_delta != 0) {
44              for (int i = 0; i < 10; i++) {
45                  System.lineSeparator();
46                  System.lineSeparator();
47                  System.lineSeparator();
48                  System.lineSeparator();
49                  float wet = 0;
50                  wet += wet_delta;
51              }
52          } else if (false) {
53          } else {
54          }
55      }
56  
57      void method() throws Exception {
58          String a = "";
59          try (AutoCloseable i = new java.io.StringReader(a)) {
60          }
61          finally {
62              a.equals("");
63          }
64      }
65  }