View Javadoc
1   package com.puppycrawl.tools.checkstyle.checks.coding.covariantequals;
2   
3   /**
4    * Test file for covariant equals methods.
5    * @author Rick Giles
6    */
7   public class InputCovariantEquals
8   {
9       private class Inner
10      {
11          public boolean equals(Inner aInner)
12          {
13              return false;
14          }
15      }
16  
17      private class Inner2
18      {
19          public boolean equals(Inner2 aInner2)
20          {
21              return false;
22          }
23          
24          public boolean equals(Object aObj)
25          {
26              return false;       
27          }
28      }
29  
30      public boolean equals(InputCovariantEquals aInputCovariantEquals)
31      {
32          return false;
33      }
34  }
35  
36  class InputCovariant2
37  {   
38      public boolean equals(InputCovariant2 aInputCovariant2)
39      {
40          return false;
41      }
42      
43      public boolean equals(Object aObject)
44      {
45          return false;
46      }
47  }
48  
49  class InputCovariant3
50  {   
51      public boolean equals(InputCovariant3 aInputCovariant3)
52      {
53          return false;
54      }
55      
56      public boolean equals(java.lang.Object aObject)
57      {
58          return false;
59      }
60  }
61  
62  class InputCovariant4
63  {
64      public boolean equals(int i)
65      {
66          return false;
67      }
68  }
69  
70  class AnonymousIC
71  {
72      Comparable comp = new Comparable()
73          {
74              public int compareTo(Object aObject)
75              {
76                  return 0;
77              }
78              public boolean equals(String aString)
79              {
80                  return false;
81              }
82          };
83      
84      public boolean equals(Object aObject)
85      {
86          return false;
87      }
88      
89      public void method()
90      {
91          Double d = new Double(1);
92      }
93  }
94  
95  abstract class InputCovariant5
96  {
97      public abstract boolean equals(InputCovariant4 aInputCovariant4);
98  }
99  
100 interface InputCovariant6
101 {
102     public boolean equals(InputCovariant5 aInputCovariant5);
103 }
104 
105 class InputGenericCovariant7
106 {
107     public <A> boolean equals(InputGenericCovariant7 aInputCovariant7)
108     {
109         return true;
110     }
111 
112     public boolean equals(Object aObject)
113     {
114         return false;
115     }
116 }
117 
118 class InputGenericCovariant8
119 {
120     public <A> boolean equals(InputGenericCovariant8 aInputCovariant8)
121     {
122         return true;
123     }
124 
125     public boolean equals(Object aObject)
126     {
127         return false;
128     }
129 }
130 
131 enum InputEnumCovariant {
132     EQUALS;
133 
134     public boolean equals(InputEnumCovariant inputEnumCovariant) {
135         return false;
136     }
137 
138     int equals(Integer integer) {
139         return 0;
140     }
141 }