View Javadoc
1   /*
2   EqualsHashCode
3   
4   
5   */
6   
7   package com.puppycrawl.tools.checkstyle.checks.coding.equalshashcode;
8   
9   public class InputEqualsHashCodeEqualsParameter {
10      public static class TestClass1 {
11          public boolean equals(String o) {
12              return true;
13          }
14      }
15      public static class TestClass2 {
16          public int hashCode() { // violation 'without .* of 'equals()'.'
17              return 1;
18          }
19          public boolean equals(String o) {
20              return true;
21          }
22      }
23      public static class TestClass3 {
24          public boolean equals(Object o) { // violation 'without .* of 'hashCode()'.'
25              return true;
26          }
27          public boolean equals(String o) {
28              return false;
29          }
30      }
31      public static class TestClass4 {
32          public int hashCode() {
33              return 1;
34          }
35          public boolean equals(Object o) {
36              return true;
37          }
38          public boolean equals(String o) {
39              return false;
40          }
41      }
42      public static class TestClass5 {
43          public int hashCode() {
44              return 1;
45          }
46          public boolean equals(java.lang.Object o) {
47              return true;
48          }
49      }
50      public static class TestClass6 {
51          public static int hashCode(int i) {
52              return 1;
53          }
54          public boolean equals(Object o) { // violation 'without .* of 'hashCode()'.'
55              return true;
56          }
57      }
58      public static class TestClass7 {
59          public int hashCode() { // violation 'without .* of 'equals()'.'
60              return 1;
61          }
62          public static boolean equals(Object o, Object o2) {
63              return true;
64          }
65      }
66      public static class TestClass8 {
67          public native int hashCode();
68          public native boolean equals(Object o);
69      }
70      public static class TestClass9 {
71          public native int hashCode(); // violation 'without .* of 'equals()'.'
72      }
73      public static class TestClass10 {
74          public native boolean equals(Object o); // violation 'without .* of 'hashCode()'.'
75      }
76      public static abstract class TestClass11 {
77          public abstract int hashCode();
78          public abstract boolean equals(Object o);
79      }
80      public static abstract class TestClass12 {
81          public int hashCode() { // violation 'without .* of 'equals()'.'
82              return 1;
83          }
84          public abstract boolean equals(Object o);
85      }
86      public static abstract class TestClass13 {
87          public abstract int hashCode();
88          public boolean equals(java.lang.Object o) { // violation 'without .* of 'hashCode()'.'
89              return true;
90          }
91      }
92      public interface TestClass14 {
93          public int hashCode();
94          public boolean equals(Object o);
95      }
96      public interface TestClass15 {
97          public boolean equals(Object o);
98      }
99      public interface TestClass16 {
100         public int hashCode();
101     }
102     public class TestClass17 {
103         public int hashCode() { // violation 'without .* of 'equals()'.'
104             return 1;
105         }
106         public int hashCode(int val) {
107             return 1;
108         }
109     }
110 }