| 152 | } |
| 153 | |
| 154 | static final boolean deepEqual(Object thisValue, Object thatValue) { |
| 155 | |
| 156 | // [#1850] Only return false early. In all other cases, |
| 157 | // continue checking the remaining fields |
| 158 | if (thisValue == null && thatValue == null) |
| 159 | return true; |
| 160 | |
| 161 | else if (thisValue == null || thatValue == null) |
| 162 | return false; |
| 163 | |
| 164 | // [#985] Compare arrays too. |
| 165 | else if (thisValue.getClass().isArray() && thatValue.getClass().isArray()) { |
| 166 | |
| 167 | // Might be byte[] |
| 168 | if (thisValue.getClass() == byte[].class && thatValue.getClass() == byte[].class) { |
| 169 | return Arrays.equals((byte[]) thisValue, (byte[]) thatValue); |
| 170 | } |
| 171 | |
| 172 | // Other primitive types are not expected |
| 173 | else if (!thisValue.getClass().getComponentType().isPrimitive() && |
| 174 | !thatValue.getClass().getComponentType().isPrimitive()) { |
| 175 | return Arrays.deepEquals((Object[]) thisValue, (Object[]) thatValue); |
| 176 | } |
| 177 | |
| 178 | else |
| 179 | return false; |
| 180 | } |
| 181 | else |
| 182 | return thisValue.equals(thatValue); |
| 183 | } |
| 184 | } |