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