View Javadoc
1   package com.google.checkstyle.test.chapter4formatting.rule462horizontalwhitespace;
2   
3   /** some javadoc. */
4   public class InputFormattedWhitespaceAfterGood {
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;
17        int b = 1;
18      }
19      do {
20        System.out.println("Testing");
21      } while (x == 0 || y == 2);
22    }
23  
24    /** some javadoc. */
25    public void check2(final int a, final int b) {
26      if ((float) a == 0.0) {
27        System.out.println("true");
28      } else {
29        System.out.println("false");
30      }
31    }
32  
33    /** some javadoc. */
34    public void check3(int... a) {
35      Runnable r2 = () -> String.valueOf("Hello world two!");
36      switch (a[0]) {
37        default:
38          break;
39      }
40    }
41  
42    /** some javadoc. */
43    public void check4() throws java.io.IOException {
44      try (java.io.InputStream ignored = System.in) {
45        /* foo */
46      }
47      try {
48        /* foo. */
49      } catch (Exception e) {
50        /* foo. */
51      }
52    }
53  
54    /** some javadoc. */
55    public void check5() {
56  
57      try {
58        /* foo. */
59      } catch (Exception e) {
60        /* foo. */
61      }
62    }
63  
64    /** some javadoc. */
65    public void check6() {
66      try {
67        /* foo. */
68      } catch (Exception e) {
69        /* foo. */
70      }
71    }
72  
73    /** some javadoc. */
74    public void check7() {
75      synchronized (this) {
76      }
77    }
78  
79    /** some javadoc. */
80    public String check8() {
81      return ("a" + "b");
82    }
83  }