日志优化

This commit is contained in:
Redkale
2022-12-28 10:14:37 +08:00
parent 9c7676a3f2
commit daa6fe4cbb
14 changed files with 172 additions and 168 deletions

View File

@@ -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;