Generated factory type should be package scoped
Closed this issue · 4 comments
JakeWharton commented
Hopefully this doesn't prevent consumers from other packages from seeing the JsonAdapter.Factory
interface...
ansman commented
I think this will prevent the code from compiling on Kotlin, the subclass needs to have the same or tighter visibility.
ansman commented
Maybe you could do this instead?
@KotshiAdapterFactory
object MyFactory : JsonAdapter.Factory by KotshiMyFactory.INSTANCE
JakeWharton commented
Ah, my usage is internal
which is probably why it worked when I made the change.
I wonder if
@KotshiJsonAdapterFactory
object MyJsonAdapterFactory : JsonAdapter.Factory by KotshiMyJsonAdapterFactory
would work...
Biggest problem is that Kotlin won't recognize the Java as being an object
so you'd be forced to do by KotshiMyJsonAdapterFactory.INSTANCE
JakeWharton commented
Hah, yep. Downside of that approach, though, is that you get two instances instead of one. It's fine as-is.