View Javadoc
1   ////////////////////////////////////////////////////////////////////////////////
2   // Test case file for checkstyle.
3   // Created: 2003
4   ////////////////////////////////////////////////////////////////////////////////
5   package com.puppycrawl.tools.checkstyle.checks.design.finalclass;
6   
7   public class InputFinalClass 
8   {
9       private InputFinalClass() {}
10  }
11  
12  final class test2 {}
13  class test3 
14  {
15     class test4 
16     {
17         private test4() {}
18     }
19  }
20  
21  class test5
22  {
23      private test5() {}
24      test5(int i) {}
25  }
26  
27  class test6 
28  {
29      public test6() {}
30  }
31  
32  final class test7 {
33      private test7() {}
34  }
35  
36  // Typesafe enum with operation
37  // abstract classes cannot be final, see bug #837012
38  abstract class Operation
39  {
40      abstract double eval(double a, double b);
41      
42      public static final Operation PLUS =
43  	new Operation("+")
44  	{
45  	    double eval(double a, double b)
46  	    {
47  		return a + b;
48  	    }
49  	};
50      
51      public static final Operation MINUS =
52  	new Operation("-")
53  	{
54  	    double eval(double a, double b)
55  	    {
56  		return a - b;
57  	    }
58  	};
59      
60      private String _name;
61      private Operation(String name)
62      {
63  	this._name = name;
64      }
65  }
66  
67  // Typesafe enum with operation
68  // abstract classes cannot be final, see bug #837012
69  interface Evaluatable
70  {
71      double eval(double a, double b);
72  }
73  
74  // abstract class without it's own abstract method decl
75  abstract class Operation2 implements Evaluatable 
76  {
77      
78      public static final Operation2 PLUS =
79  	new Operation2("+")
80  	{
81  	    public double eval(double a, double b)
82  	    {
83  		return a + b;
84  	    }
85  	};
86      
87      public static final Operation2 MINUS =
88  	new Operation2("-")
89  	{
90  	    public double eval(double a, double b)
91  	    {
92  		return a - b;
93  	    }
94  	};
95      
96      private String _name;
97      private Operation2(String name)
98      {
99  	this._name = name;
100     }
101 }
102 
103 enum testenum1
104 {
105     A, B;
106     testenum1() {}
107 }
108 
109 enum testenum2
110 {
111     A, B;
112 
113     public static class someinnerClass
114     {
115         private someinnerClass() {}
116     }
117 }
118 
119 interface TestInterface {
120     class SomeClass {
121         private SomeClass() {}
122     }
123 }
124 
125 @interface SomeAnnotation {
126     class SomeClass {
127         private SomeClass() {}
128     }
129 }