File tree 1 file changed +2
-19
lines changed
spring-beans/src/main/java/org/springframework/beans/factory/config
1 file changed +2
-19
lines changed Original file line number Diff line number Diff line change 21
21
import java .io .Serializable ;
22
22
import java .lang .annotation .Annotation ;
23
23
import java .lang .reflect .Field ;
24
- import java .lang .reflect .ParameterizedType ;
25
- import java .lang .reflect .Type ;
26
24
import java .util .Map ;
27
25
import java .util .Optional ;
28
26
@@ -365,23 +363,8 @@ public String getDependencyName() {
365
363
public Class <?> getDependencyType () {
366
364
if (this .field != null ) {
367
365
if (this .nestingLevel > 1 ) {
368
- Type type = this .field .getGenericType ();
369
- for (int i = 2 ; i <= this .nestingLevel ; i ++) {
370
- if (type instanceof ParameterizedType ) {
371
- Type [] args = ((ParameterizedType ) type ).getActualTypeArguments ();
372
- type = args [args .length - 1 ];
373
- }
374
- }
375
- if (type instanceof Class ) {
376
- return (Class <?>) type ;
377
- }
378
- else if (type instanceof ParameterizedType ) {
379
- Type arg = ((ParameterizedType ) type ).getRawType ();
380
- if (arg instanceof Class ) {
381
- return (Class <?>) arg ;
382
- }
383
- }
384
- return Object .class ;
366
+ Class <?> clazz = getResolvableType ().getRawClass ();
367
+ return (clazz != null ? clazz : Object .class );
385
368
}
386
369
else {
387
370
return this .field .getType ();
You can’t perform that action at this time.
0 commit comments