diff --git a/src/org/redkale/util/TypeToken.java b/src/org/redkale/util/TypeToken.java index f07415e47..7892bc921 100644 --- a/src/org/redkale/util/TypeToken.java +++ b/src/org/redkale/util/TypeToken.java @@ -96,6 +96,78 @@ public abstract class TypeToken { } return newTypes; } +// +// public static void main(String[] args) throws Throwable { +// Method tt0 = C.class.getMethod("getValue"); +// System.out.println("tt0.type=" + tt0.getReturnType() + "======" + tt0.getGenericReturnType() + "======" + getGenericType(tt0.getGenericReturnType(), C.class)); +// +// Method tt3 = C.class.getMethod("getValue3"); +// System.out.println("tt3.type=" + tt3.getReturnType() + "======" + tt3.getGenericReturnType() + "======" + getGenericType(tt3.getGenericReturnType(), C.class)); +// +// Method ttr = AGameService.class.getMethod("getResult"); +// System.out.println("ttr.type=" + ttr.getReturnType() + "======" + ttr.getGenericReturnType() + "======" + getGenericType(ttr.getGenericReturnType(), AGameService.class)); +// System.out.println("ttr.应该是: List, 结果是: " + getGenericType(ttr.getGenericReturnType(), AGameService.class)); +// } +// +// public static class GamePlayer { +// } +// +// public static class GameTable

{ +// } +// +// public static class GameService { +// +// } +// +// public static class AbstractGamePlayer extends GamePlayer { +// } +// +// public static class AbstractGameTable

extends GameTable

{ +// } +// +// public static class AbstractGameService, P extends AbstractGamePlayer> extends GameService { +// +// public List getResult() { +// return null; +// } +// } +// +// public static class IGamePlayer extends AbstractGamePlayer { +// } +// +// public static class IGameTable

extends AbstractGameTable

{ +// } +// +// public static class IGameService, P extends IGamePlayer> extends AbstractGameService { +// +// } +// +// public static class AGamePlayer extends IGamePlayer { +// } +// +// public static class AGameTable extends IGameTable { +// } +// +// public static class AGameService extends IGameService { +// +// } +// +// public static class A { +// +// public List getValue() { +// return null; +// } +// +// public T getValue3() { +// return null; +// } +// } +// +// public static class B extends A { +// } +// +// public static class C extends B { +// } /** * 获取TypeVariable对应的实际Type, 如果type不是TypeVariable 直接返回type。 @@ -151,7 +223,7 @@ public abstract class TypeToken { ss = ss.getSuperclass(); asts = ss.getTypeParameters(); } - + if (atas.length == asts.length) { for (int i = 0; i < asts.length; i++) { Type currt = asts[i];