Factory issues with kotshi 2.0-rc1
See original GitHub issueUsing kotshi:1.0.6 the following works
@KotshiJsonAdapterFactory
abstract class ApplicationJsonAdapterFactory : JsonAdapter.Factory {
companion object {
val INSTANCE: ApplicationJsonAdapterFactory = KotshiApplicationJsonAdapterFactory()
}
}
...
moshi = Moshi.Builder().add(ApplicationJsonAdapterFactory.INSTANCE).build()
If I upgrade to kotshi:2.0-rc1 it no longer works Expression 'KotshiApplicationJsonAdapterFactory' of type 'KotshiApplicationJsonAdapterFactory' cannot be invoked as a function. The function 'invoke()' is not found
If I follow the latest in the README:
@KotshiJsonAdapterFactory
object ApplicationJsonAdapterFactory : JsonAdapter.Factory by KotshiApplicationJsonAdapterFactory
...
moshi = Moshi.Builder().add(ApplicationJsonAdapterFactory).build()
This also doesn’t work Unresolved reference: KotshiApplicationJsonAdapterFactory
Is there something I’m missing here?
Issue Analytics
- State:
- Created 4 years ago
- Comments:9 (6 by maintainers)
Top Results From Across the Web
kotshi - Freesoft.dev
An annotations processor that generates Moshi adapters from immutable Kotlin data classes. Moshi's default reflective adapters assume your ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Man, I had hoped kapt would be better with this now. Anyway, the generated factory is an object in 2.0 so just remove your parentheses in the first example and that will still work
I haven’t found one and I’m not sure what to write if I were to file one since I can’t reproduce it consistently.