V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
honglei92
V2EX  ›  Kotlin

libcore.reflect.parameterizedtypeimpl cannot be cast to Java .lang.clas 这个错误 我真是莫名其妙

  •  
  •   honglei92 · 2020-05-20 23:40:22 +08:00 · 2658 次点击
    这是一个创建于 1434 天前的主题,其中的信息可能已经有所发展或是发生改变。

    1java 方法 public void getUploadConfig(String uploadJson, final RxResultCallback<TMResponse> callBack)

    2TMRespnse 类 是泛型类 public class TMResponse<T>

    3 在 kotlin 中使用 getUploadConfig("111", object : RxResultCallback<TMResponse<Any>>()

    就报 上面的错,object : RxResultCallback<TMResponse<Any>>() 这里应该怎么写 呢?

    1 条回复    2020-05-27 23:18:33 +08:00
    KentY
        1
    KentY  
       2020-05-27 23:18:33 +08:00
    你是要把一个新的 instance RxResultCallback<TMResponse<Any>>() 作为参数传递给那个 get... () method 吗?
    你调用一个 fun 不用 object: type, 你要么先把 object 构建好, 传 object, 要么直接
    getUploadConfig("111", RxResultCallback<TMResponse<Any>>())
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3359 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 28ms · UTC 11:32 · PVG 19:32 · LAX 04:32 · JFK 07:32
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.