From 29148c4b42d04257ed4fd5e5e54fb205d7e81e8e Mon Sep 17 00:00:00 2001 From: Redkale <8730487+redkale@users.noreply.github.com> Date: Sun, 9 Feb 2020 12:37:00 +0800 Subject: [PATCH] =?UTF-8?q?TypeToken.getGenericType=E5=8A=A0=E5=BC=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/org/redkale/util/TypeToken.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/org/redkale/util/TypeToken.java b/src/org/redkale/util/TypeToken.java index 3751e18f3..3359206c0 100644 --- a/src/org/redkale/util/TypeToken.java +++ b/src/org/redkale/util/TypeToken.java @@ -159,6 +159,20 @@ public abstract class TypeToken { return atas[i]; } } + ParameterizedType cycType = superPT; + if (cycType.getRawType() instanceof Class) { + TypeVariable[] argTypes = ((Class) cycType.getRawType()).getTypeParameters(); + if (argTypes.length == asts.length) { + for (int i = 0; i < argTypes.length; i++) { + if (argTypes[i] == type) { + if (atas[i] instanceof TypeVariable + && ((TypeVariable) atas[i]).getBounds().length == 1 + && ((TypeVariable) atas[i]).getBounds()[0] instanceof Class) + return ((Class) ((TypeVariable) atas[i]).getBounds()[0]); + } + } + } + } } Type moreType = ((ParameterizedType) superType).getRawType(); if (moreType != Object.class) return getGenericType(type, moreType);