drakeet / MultiType

Flexible multiple types for Android RecyclerView.
Apache License 2.0
5.76k stars 749 forks source link

BinderNotFoundException #271

Closed zyallday closed 5 years ago

zyallday commented 5 years ago

What kind of issue is this?

Info:
Description:
    BinderNotFoundException(@NonNull Class<?> clazz) {
    super("Do you have registered {className}.class to the binder in the adapter/pool?"
        .replace("{className}", clazz.getSimpleName()));
  }
Reproduction Steps:
My thoughts:

这个异常在抛出的时候,打印的日志只有 class 的 simpleName, 这样导致在线上如果代码经过了混淆之后会有很多类的 simpleName 一样无法定位到底是哪个类的 Binder 没有注册, 是否可以改成这样

BinderNotFoundException(@NonNull Class<?> clazz) {
    super("Do you have registered {className}.class to the binder in the adapter/pool?"
        .replace("{className}", clazz.getCanonicalName()));
  }
What did I do:
zyallday commented 5 years ago

匿名内部类没有 canonicalName 用 clazz.getName() 更好

drakeet commented 5 years ago

MultiType 的最新源码中,使用的是 clazz.name:

internal class BinderNotFoundException(clazz: Class<*>) : RuntimeException(
  "Have you registered the ${clazz.name} type and its binder to the adapter or type list?"
)

因此这个 issue 本身是不成立的,即将关闭。