idanatz / OneAdapter

A Viewholderless Adapter for RecyclerView, who supports builtin diffing, states (paging, empty...), events (clicking, swiping...), and more.
MIT License
470 stars 45 forks source link

You can't use interface as M : Diffable in intem module #49

Open PiotrArent96 opened 1 year ago

PiotrArent96 commented 1 year ago

Because of line 12 in com.idanatz.oneadapter.internal.utils in generic.kt you can't use ItemModule with interfaces as in

class MyModule() : ItemModule<SomeInterface>

SomeInterface being

interface SomeInterface { ... }

It causes crash. It's because you are using if (className.startWith("class ")) { } And class name for interface starts with "interface "

You can use abstract class tho since its class name starts with "class " but it simply will do nothing since you can have object with class name of abstract class, and thats how library indentifies types

Also im certain that what you are implementing here is just type.typeName

idanatz commented 1 year ago

Hey

Thanks for the report, il look into it and update.