View Javadoc
1   ///////////////////////////////////////////////////////////////////////////////////////////////
2   // checkstyle: Checks Java source code and other text files for adherence to a set of rules.
3   //
4   //
5   // This library is free software; you can redistribute it and/or
6   // modify it under the terms of the GNU Lesser General Public
7   // License as published by the Free Software Foundation; either
8   // version 2.1 of the License, or (at your option) any later version.
9   //
10  // This library is distributed in the hope that it will be useful,
11  // but WITHOUT ANY WARRANTY; without even the implied warranty of
12  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  // Lesser General Public License for more details.
14  //
15  // You should have received a copy of the GNU Lesser General Public
16  // License along with this library; if not, write to the Free Software
17  // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
18  ///////////////////////////////////////////////////////////////////////////////////////////////
19  // violation below ''package' should be separated from previous line.'
20  package com.google.checkstyle.test.chapter4formatting.rule461verticalwhitespace;
21  import java.util.concurrent.Callable; // violation ''import' should be separated from previous line.'
22  class InputVerticalWhitespace { // violation ''CLASS_DEF' should be separated from previous line.'
23    public static final double FOO_PI = 3.1415;
24    private boolean flag = true;
25    static { // violation ''STATIC_INIT' should be separated from previous line.'
26      // empty static initializer
27    }
28  
29    {
30      // empty instance initializer
31    }
32  
33    /** Some javadoc. */
34    private InputVerticalWhitespace() {
35      // empty
36    }
37  
38    public int compareTo(InputVerticalWhitespace obj) {
39      int number = 0;
40      return 0;
41    }
42    /**
43     * Some javadoc.
44     *
45     * @param task some description.
46     * @param result some description.
47     * @return some description.
48     */
49    public static <T> Callable<T> callable(Runnable task, T result) {
50      // violation above ''METHOD_DEF' should be separated from previous line.'
51      return null;
52    }
53  
54    public int getBeastNumber() {
55      return 666;
56    }
57    interface IntEnum { // violation ''INTERFACE_DEF' should be separated from previous line.'
58    }
59  
60    class InnerClass {
61  
62      public static final double FOO_PI_INNER = 3.1415;
63      private boolean flagInner = true;
64      { // violation ''INSTANCE_INIT' should be separated from previous line.'
65        // empty instance initializer
66      }
67  
68      private InnerClass() {
69        // empty
70      }
71    }
72  
73    class InnerClass2 { // ok
74      private InnerClass2() { // ok
75        // empty
76      }
77    }
78  
79    class InnerClass3 { // ok
80      public int compareTo(InputVerticalWhitespace obj) { // ok
81        int number = 0;
82        return 0;
83      }
84    }
85  
86    class Clazz { // ok
87      private Clazz() {} // ok
88    }
89    class Class2 { // violation ''CLASS_DEF' should be separated from previous line.'
90      public int compareTo(InputVerticalWhitespace obj) { // ok
91        int number = 0;
92        return 0;
93      }
94      Class2 anon = // violation ''VARIABLE_DEF' should be separated from previous line.'
95              new Class2() {
96                public int compareTo(InputVerticalWhitespace obj) { // ok
97                  int number = 0;
98                  return 0;
99                }
100             };
101   }
102 }