@@ -381,8 +381,7 @@ public ResolvableType getSuperType() {
381
381
return NONE ;
382
382
}
383
383
if (this .superType == null ) {
384
- this .superType = forType (SerializableTypeWrapper .forGenericSuperclass (resolved ),
385
- asVariableResolver ());
384
+ this .superType = forType (SerializableTypeWrapper .forGenericSuperclass (resolved ), asVariableResolver ());
386
385
}
387
386
return this .superType ;
388
387
}
@@ -399,8 +398,7 @@ public ResolvableType[] getInterfaces() {
399
398
return EMPTY_TYPES_ARRAY ;
400
399
}
401
400
if (this .interfaces == null ) {
402
- this .interfaces = forTypes (SerializableTypeWrapper .forGenericInterfaces (resolved ),
403
- asVariableResolver ());
401
+ this .interfaces = forTypes (SerializableTypeWrapper .forGenericInterfaces (resolved ), asVariableResolver ());
404
402
}
405
403
return this .interfaces ;
406
404
}
@@ -1102,11 +1100,11 @@ public static ResolvableType forMethodParameter(MethodParameter methodParameter)
1102
1100
*/
1103
1101
public static ResolvableType forMethodParameter (MethodParameter methodParameter , ResolvableType implementationType ) {
1104
1102
Assert .notNull (methodParameter , "MethodParameter must not be null" );
1105
- implementationType = (implementationType == null ? forType (methodParameter .getContainingClass ()) : implementationType );
1103
+ implementationType = (implementationType != null ? implementationType :
1104
+ forType (methodParameter .getContainingClass ()));
1106
1105
ResolvableType owner = implementationType .as (methodParameter .getDeclaringClass ());
1107
- return forType (null , new MethodParameterTypeProvider (methodParameter ),
1108
- owner .asVariableResolver ()).getNested (methodParameter .getNestingLevel (),
1109
- methodParameter .typeIndexesPerLevel );
1106
+ return forType (null , new MethodParameterTypeProvider (methodParameter ), owner .asVariableResolver ()).
1107
+ getNested (methodParameter .getNestingLevel (), methodParameter .typeIndexesPerLevel );
1110
1108
}
1111
1109
1112
1110
/**
@@ -1124,13 +1122,26 @@ public static ResolvableType forMethodParameter(MethodParameter methodParameter,
1124
1122
getNested (methodParameter .getNestingLevel (), methodParameter .typeIndexesPerLevel );
1125
1123
}
1126
1124
1125
+ /**
1126
+ * Resolve the top-level parameter type of the given {@code MethodParameter}.
1127
+ * @param methodParameter the method parameter to resolve
1128
+ * @since 4.1.9
1129
+ * @see MethodParameter#setParameterType
1130
+ */
1131
+ static void resolveMethodParameter (MethodParameter methodParameter ) {
1132
+ Assert .notNull (methodParameter , "MethodParameter must not be null" );
1133
+ ResolvableType owner = forType (methodParameter .getContainingClass ()).as (methodParameter .getDeclaringClass ());
1134
+ methodParameter .setParameterType (
1135
+ forType (null , new MethodParameterTypeProvider (methodParameter ), owner .asVariableResolver ()).resolve ());
1136
+ }
1137
+
1127
1138
/**
1128
1139
* Return a {@link ResolvableType} as a array of the specified {@code componentType}.
1129
1140
* @param componentType the component type
1130
1141
* @return a {@link ResolvableType} as an array of the specified component type
1131
1142
*/
1132
1143
public static ResolvableType forArrayComponent (ResolvableType componentType ) {
1133
- Assert .notNull (componentType , "componentType must not be null" );
1144
+ Assert .notNull (componentType , "Component type must not be null" );
1134
1145
Class <?> arrayClass = Array .newInstance (componentType .resolve (), 0 ).getClass ();
1135
1146
return new ResolvableType (arrayClass , null , null , componentType );
1136
1147
}
@@ -1220,7 +1231,7 @@ static ResolvableType forType(Type type, TypeProvider typeProvider, VariableReso
1220
1231
/**
1221
1232
* Strategy interface used to resolve {@link TypeVariable}s.
1222
1233
*/
1223
- static interface VariableResolver extends Serializable {
1234
+ interface VariableResolver extends Serializable {
1224
1235
1225
1236
/**
1226
1237
* Return the source of the resolver (used for hashCode and equals).
@@ -1230,7 +1241,7 @@ static interface VariableResolver extends Serializable {
1230
1241
/**
1231
1242
* Resolve the specified variable.
1232
1243
* @param variable the variable to resolve
1233
- * @return the resolved variable or {@code null}
1244
+ * @return the resolved variable, or {@code null} if not found
1234
1245
*/
1235
1246
ResolvableType resolveVariable (TypeVariable <?> variable );
1236
1247
}
@@ -1362,7 +1373,7 @@ public static WildcardBounds get(ResolvableType type) {
1362
1373
/**
1363
1374
* The various kinds of bounds.
1364
1375
*/
1365
- static enum Kind {UPPER , LOWER }
1376
+ enum Kind {UPPER , LOWER }
1366
1377
}
1367
1378
1368
1379
}
0 commit comments