File tree Expand file tree Collapse file tree 1 file changed +6
-8
lines changed
spring-core/src/main/java/org/springframework/util Expand file tree Collapse file tree 1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change 36
36
*/
37
37
public abstract class TypeUtils {
38
38
39
+ private static final Type [] IMPLICIT_LOWER_BOUNDS = { null };
40
+
41
+ private static final Type [] IMPLICIT_UPPER_BOUNDS = { Object .class };
42
+
39
43
/**
40
44
* Check if the right-hand side type may be assigned to the left-hand side
41
45
* type following the Java generics rules.
@@ -196,20 +200,14 @@ private static Type[] getLowerBounds(WildcardType wildcardType) {
196
200
Type [] lowerBounds = wildcardType .getLowerBounds ();
197
201
198
202
// supply the implicit lower bound if none are specified
199
- if (lowerBounds .length == 0 ) {
200
- lowerBounds = new Type [] { null };
201
- }
202
- return lowerBounds ;
203
+ return (lowerBounds .length == 0 ? IMPLICIT_LOWER_BOUNDS : lowerBounds );
203
204
}
204
205
205
206
private static Type [] getUpperBounds (WildcardType wildcardType ) {
206
207
Type [] upperBounds = wildcardType .getUpperBounds ();
207
208
208
209
// supply the implicit upper bound if none are specified
209
- if (upperBounds .length == 0 ) {
210
- upperBounds = new Type [] { Object .class };
211
- }
212
- return upperBounds ;
210
+ return (upperBounds .length == 0 ? IMPLICIT_UPPER_BOUNDS : upperBounds );
213
211
}
214
212
215
213
public static boolean isAssignableBound (@ Nullable Type lhsType , @ Nullable Type rhsType ) {
You can’t perform that action at this time.
0 commit comments