日志优化
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
package org.redkale.test.type;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
import org.junit.jupiter.api.*;
|
||||
import org.redkale.util.TypeToken;
|
||||
|
||||
/**
|
||||
@@ -14,15 +15,25 @@ import org.redkale.util.TypeToken;
|
||||
*/
|
||||
public class TypeTokenTest {
|
||||
|
||||
private boolean main;
|
||||
|
||||
public static void main(String[] args) throws Throwable {
|
||||
TypeTokenTest test = new TypeTokenTest();
|
||||
test.main = true;
|
||||
test.run();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void run() throws Exception {
|
||||
Class declaringClass = ThreeService.class;
|
||||
ParameterizedType declaringType = (ParameterizedType) declaringClass.getGenericSuperclass();
|
||||
System.out.println("getRawType:" + declaringType.getRawType());
|
||||
TypeVariable argType0 = (TypeVariable)declaringType.getActualTypeArguments()[0];
|
||||
TypeVariable argType0 = (TypeVariable) declaringType.getActualTypeArguments()[0];
|
||||
System.out.println("argType0.getBounds[0]:" + argType0.getBounds()[0]);
|
||||
|
||||
for (Method method : declaringClass.getMethods()) {
|
||||
if (!"run".equals(method.getName())) continue;
|
||||
if (!main) Assertions.assertEquals(ThreeRound.class, TypeToken.getGenericType(method.getGenericParameterTypes()[0], declaringClass));
|
||||
System.out.println("返回值应该是: " + ThreeRound.class);
|
||||
System.out.println("返回值结果是: " + TypeToken.getGenericType(method.getGenericParameterTypes()[0], declaringClass));
|
||||
break;
|
||||
|
||||
Reference in New Issue
Block a user