View Javadoc
1   /*xml
2   <module name="Checker">
3     <module name="TreeWalker">
4       <module name="HideUtilityClassConstructor"/>
5     </module>
6   </module>
7   */
8   
9   package com.puppycrawl.tools.checkstyle.checks.design.hideutilityclassconstructor;
10  
11  // xdoc section -- start
12  // violation below, 'should not have a public or default constructor'
13  @java.lang.Deprecated
14  class Example1 {
15  
16    public Example1() {
17    }
18  
19    public static void fun() {
20    }
21  }
22  
23  class Foo {
24  
25    private Foo() {
26    }
27  
28    static int n;
29  }
30  
31  class Bar {
32  
33    protected Bar() {
34      // prevents calls from subclass
35      throw new UnsupportedOperationException();
36    }
37  }
38  
39  @Deprecated // violation, 'should not have a public or default constructor'
40  class UtilityClass {
41  
42    static float f;
43  }
44  // violation below, 'should not have a public or default constructor'
45  @SpringBootApplication
46  class Application1 {
47  
48    public static void main(String[] args) {
49    }
50  }
51  // xdoc section -- end
52  @interface SpringBootApplication {}