Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如果嵌套类型是MAP的情况下,会报类型转换异常 #25

Open
habwang opened this issue Apr 2, 2022 · 1 comment
Open

如果嵌套类型是MAP的情况下,会报类型转换异常 #25

habwang opened this issue Apr 2, 2022 · 1 comment

Comments

@habwang
Copy link

habwang commented Apr 2, 2022

如果返回结果是 泛型且嵌套List时,会报类型转换异常。
示例:
定义个ResultEntity 如下

private class ResultEntity<T> {
  private String code;
  private String message;
  private T rows;
}  

定义一个接口

@GetMapping("/test")
public ResultEntity<List<Map<String,String>>(){
return null;
}

这种情况下会报


Caused by: java.lang.ClassCastException: class sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl cannot be cast to class java.lang.Class (sun.reflect.generics.reflectiveObjects.ParameterizedTypeImpl and java.lang.Class are in module java.base of loader 'bootstrap')
	at com.github.ydoc.core.Core.deepObject(Core.java:135) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
	at com.github.ydoc.core.strategy.AbstractStrategy.deepObject(AbstractStrategy.java:56) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
	at com.github.ydoc.core.strategy.AbstractStrategy.baseResponse(AbstractStrategy.java:154) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
	at com.github.ydoc.core.strategy.AbstractHandler.processResponse(AbstractHandler.java:46) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
	at com.github.ydoc.core.strategy.AbstractHandler.init(AbstractHandler.java:36) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
	at com.github.ydoc.core.handler.api.PostHandler.generateApi(PostHandler.java:18) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
	at com.github.ydoc.core.handler.api.PostHandler.generateApi(PostHandler.java:11) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
	at com.github.ydoc.core.StrategySelector.matchAndGenerateApi(StrategySelector.java:33) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
	at com.github.ydoc.core.ScanApi.scan(ScanApi.java:111) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
	at com.github.ydoc.core.ScanApi.afterPropertiesSet(ScanApi.java:210) ~[ydoc-spring-boot-starter-1.1.7.jar:na]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1863) ~[spring-beans-5.3.17.jar:5.3.17]
	at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1800) ~[spring-beans-5.3.17.jar:5.3.17]
	... 16 common frames omitted
@NoBugBoy
Copy link
Owner

NoBugBoy commented Apr 2, 2022

嗯 还没支持这种结构,等后续不忙了会陆续解决这些问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants