View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace;
2   
3   /** some javadoc. */
4   public class InputWhitespaceAfterGood {
5   
6     int xyz;       // multiple space between content and double slash.
7     int abc; //       multiple space between double slash and comment's text.
8     int pqr;       //     testing both.
9   
10    /** some javadoc. */
11    public void check1(int x, int y) {
12      // violation below ''for' construct must use '{}'s.'
13      for (int a = 1, b = 2; a < 5; a++, b--)
14        ;
15      while (x == 0) {
16        int a = 0, b = 1; // violation 'Each variable declaration must be in its own statement.'
17      }
18      do {
19        System.out.println("Testing");
20      } while (x == 0 || y == 2);
21    }
22  
23    /** some javadoc. */
24    public void check2(final int a, final int b) {
25      if ((float) a == 0.0) {
26        System.out.println("true");
27      } else {
28        System.out.println("false");
29      }
30    }
31  
32    /** some javadoc. */
33    public void check3(int... a) {
34      Runnable r2 = () -> String.valueOf("Hello world two!");
35      switch (a[0]) {
36        default:
37          break;
38      }
39    }
40  
41    /** some javadoc. */
42    public void check4() throws java.io.IOException {
43      try (java.io.InputStream ignored = System.in) {}
44      try {
45        /* foo. */
46      } catch (Exception e) {
47        /* foo. */
48      }
49    }
50  
51    /** some javadoc. */
52    public void check5() {
53  
54      try {
55        /* foo. */
56      } catch (Exception e) {
57        /* foo. */
58      }
59    }
60  
61    /** some javadoc. */
62    public void check6() {
63      try {
64        /* foo. */
65      } catch (Exception e) {
66        /* foo. */
67      }
68    }
69  
70    /** some javadoc. */
71    public void check7() {
72      synchronized (this) {
73      }
74    }
75  
76    /** some javadoc. */
77    public String check8() {
78      return ("a" + "b");
79    }
80  }