This commit is contained in:
@@ -69,11 +69,17 @@ public abstract class TypeToken<T> {
|
|||||||
if (type instanceof TypeVariable) {
|
if (type instanceof TypeVariable) {
|
||||||
if (declaringClass instanceof Class) {
|
if (declaringClass instanceof Class) {
|
||||||
final Class declaringClass0 = (Class) declaringClass;
|
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) {
|
if (superType instanceof ParameterizedType) {
|
||||||
ParameterizedType superPT = (ParameterizedType) superType;
|
ParameterizedType superPT = (ParameterizedType) superType;
|
||||||
Type[] atas = superPT.getActualTypeArguments();
|
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) {
|
if (atas.length == asts.length) {
|
||||||
for (int i = 0; i < asts.length; i++) {
|
for (int i = 0; i < asts.length; i++) {
|
||||||
if (asts[i] == type) return atas[i];
|
if (asts[i] == type) return atas[i];
|
||||||
|
|||||||
Reference in New Issue
Block a user