1
2
3
4
5
6
7
8
9 package com.puppycrawl.tools.checkstyle.checks.design.designforextension;
10
11
12
13
14
15 public abstract class InputDesignForExtension
16 {
17
18
19 public interface InterfaceOK
20 {
21 void implicitlyAbstract();
22 }
23
24 final class ClassOK
25 {
26 protected void finalThroughClassDef()
27 {
28 System.identityHashCode("no way to override");
29 }
30 }
31
32 protected void nonFinalButEmpty()
33 {
34 }
35
36 public void nonFinalButEmpty2()
37 {
38
39 }
40
41 private void aPrivateMethod()
42 {
43 System.identityHashCode("no way to override");
44 }
45
46 protected abstract void nonFinalButAbstract();
47
48
49
50 protected void doh()
51 {
52 System.identityHashCode("nonempty and overriding possible");
53 }
54
55 public final void aFinalMethod()
56 {
57 System.identityHashCode("no way to override");
58 }
59
60 public static void aStaticMethod()
61 {
62 System.identityHashCode("no way to override");
63 }
64
65
66
67
68 private class MyComparator implements java.util.Comparator
69 {
70 public int compare(Object o1, Object o2)
71 {
72
73 if (o1.hashCode() > o2.hashCode()) {
74 return -1;
75 }
76 else {
77 return 1;
78 }
79 }
80 }
81
82 public final class aFinalClass
83 {
84 public void someMethod()
85 {
86 System.identityHashCode("nonempty and overriding is possible");
87 }
88 }
89
90 public class nonFinalClass
91 {
92
93 private nonFinalClass(){}
94 public void someMethod()
95 {
96 System.identityHashCode("nonempty and overriding is possible");
97 }
98 }
99
100 public class anotherNonFinalClass
101 {
102
103 public anotherNonFinalClass(){}
104 public void someMethod()
105 {
106 System.identityHashCode("nonempty and overriding is possible");
107 }
108 }
109
110
111 public enum TEnum
112 {
113 FIRST,
114 SECOND;
115
116 public int value()
117 {
118 return 3;
119 }
120 }
121 }