-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
com.alibaba.fastjson.JSONException: default constructor not found #1451
Comments
主干的代码是没有问题的,版本:1.2.38-preiview-09 |
您这是用IntelliJ IDEA运行的?我用IntelliJ IDEA测试也是正常的,只是Android Studio测试就不行 |
好,我明天试试AS |
已测试,1.1.63.android也存在同样的问题 |
可不可以提供一个运行的demo看看怎么能稳定在kotlin解析,现在我各种尝试都没法运行 |
同问
|
很抱歉,之前都是在Intellj中做的验证的,这个周末跟进哈 |
在Android Studio编译的类也重现不了。。。 |
那就很尴尬了 |
@ZYRzyr 你尝试跑一下这个testcase试试呢。 看跟你的有没有差异呢 |
@neil4dong |
我的AS里面也出现这个问题,后来发现是Class.forName("kotlin.reflect.jvm.internal.KClassImpl") 这里出错了。 |
亲测:版本1.2.38
data class User(val name: String, val age: Int)
//data class User(@JSONField(name="name")val name: String,@JSONField(name="age") val age: Int)
val list = mutableListOf()
for (i in 1..10) {
list.add(User("ycx$i", i * 10))
}
val json = JSON.toJSONString(list)
Log.e("==========json======", json)
val pList: MutableList?
try {
pList = JSON.parseArray(json, User::class.javaObjectType)
Log.e("==========", pList.toString())
} catch (e: Exception) {
e.printStackTrace()
}
data class 用第一行那样写会报如题的错误
第二种写法不会报错
亲测Android studio 2.3.3 ext.kotlin_version = '1.1.4-3'
亲测Android studio 3.0 beta4 ext.kotlin_version = '1.1.4-3'
The text was updated successfully, but these errors were encountered: