diff --git a/src/org/redkale/util/TypeToken.java b/src/org/redkale/util/TypeToken.java index a734e283b..895de030b 100644 --- a/src/org/redkale/util/TypeToken.java +++ b/src/org/redkale/util/TypeToken.java @@ -69,11 +69,17 @@ public abstract class TypeToken { if (type instanceof TypeVariable) { if (declaringClass instanceof Class) { final Class declaringClass0 = (Class) declaringClass; - final Type superType = declaringClass0.getGenericSuperclass(); + Type superType = declaringClass0.getGenericSuperclass(); + while (superType instanceof Class && superType != Object.class) superType = ((Class) superType).getGenericSuperclass(); if (superType instanceof ParameterizedType) { ParameterizedType superPT = (ParameterizedType) superType; Type[] atas = superPT.getActualTypeArguments(); - TypeVariable[] asts = declaringClass0.getSuperclass().getTypeParameters(); + Class ss = declaringClass0; + TypeVariable[] asts = ss.getTypeParameters(); + while (atas.length != asts.length && ss != Object.class) { + ss = ss.getSuperclass(); + asts = ss.getTypeParameters(); + } if (atas.length == asts.length) { for (int i = 0; i < asts.length; i++) { if (asts[i] == type) return atas[i];