|
1 | 1 | /*
|
2 |
| - * Copyright 2002-2022 the original author or authors. |
| 2 | + * Copyright 2002-2023 the original author or authors. |
3 | 3 | *
|
4 | 4 | * Licensed under the Apache License, Version 2.0 (the "License");
|
5 | 5 | * you may not use this file except in compliance with the License.
|
|
22 | 22 | import java.lang.reflect.InvocationHandler;
|
23 | 23 | import java.lang.reflect.Method;
|
24 | 24 | import java.lang.reflect.Proxy;
|
25 |
| -import java.util.Arrays; |
26 | 25 | import java.util.Map;
|
27 | 26 | import java.util.NoSuchElementException;
|
28 | 27 | import java.util.concurrent.ConcurrentHashMap;
|
@@ -136,44 +135,11 @@ private Integer computeHashCode() {
|
136 | 135 | for (int i = 0; i < this.attributes.size(); i++) {
|
137 | 136 | Method attribute = this.attributes.get(i);
|
138 | 137 | Object value = getAttributeValue(attribute);
|
139 |
| - hashCode += (127 * attribute.getName().hashCode()) ^ getValueHashCode(value); |
| 138 | + hashCode += (127 * attribute.getName().hashCode()) ^ ObjectUtils.nullSafeHashCode(value); |
140 | 139 | }
|
141 | 140 | return hashCode;
|
142 | 141 | }
|
143 | 142 |
|
144 |
| - private int getValueHashCode(Object value) { |
145 |
| - // Use Arrays.hashCode(...) since Spring's ObjectUtils doesn't comply |
146 |
| - // with the requirements specified in Annotation#hashCode(). |
147 |
| - if (value instanceof boolean[] booleans) { |
148 |
| - return Arrays.hashCode(booleans); |
149 |
| - } |
150 |
| - if (value instanceof byte[] bytes) { |
151 |
| - return Arrays.hashCode(bytes); |
152 |
| - } |
153 |
| - if (value instanceof char[] chars) { |
154 |
| - return Arrays.hashCode(chars); |
155 |
| - } |
156 |
| - if (value instanceof double[] doubles) { |
157 |
| - return Arrays.hashCode(doubles); |
158 |
| - } |
159 |
| - if (value instanceof float[] floats) { |
160 |
| - return Arrays.hashCode(floats); |
161 |
| - } |
162 |
| - if (value instanceof int[] ints) { |
163 |
| - return Arrays.hashCode(ints); |
164 |
| - } |
165 |
| - if (value instanceof long[] longs) { |
166 |
| - return Arrays.hashCode(longs); |
167 |
| - } |
168 |
| - if (value instanceof short[] shorts) { |
169 |
| - return Arrays.hashCode(shorts); |
170 |
| - } |
171 |
| - if (value instanceof Object[] objects) { |
172 |
| - return Arrays.hashCode(objects); |
173 |
| - } |
174 |
| - return value.hashCode(); |
175 |
| - } |
176 |
| - |
177 | 143 | private String annotationToString() {
|
178 | 144 | String string = this.string;
|
179 | 145 | if (string == null) {
|
|
0 commit comments