EpoxyAttribute generate problem for Kotlin
See original GitHub issueI try to apply EpoxyAttribute
to field in Kotlin, like below:
@EpoxyModelClass(layout = R.layout.model_epoxy)
abstract class TestEpoxyModel(@EpoxyAttribute @ColorInt var color: Int) : EpoxyModel<View>() {
override fun bind(view: View?) {
view?.setBackgroundColor(color)
}
}
And got error on compile annotation, like below:
com.airbnb.epoxy.EpoxyProcessorException: EpoxyAttribute annotations must not be on private or static fields. (class: TestEpoxyModel, field: color)
e: Some error(s) occurred while processing annotations. Please see the error messages above.
Issue Analytics
- State:
- Created 7 years ago
- Comments:20 (12 by maintainers)
Top Results From Across the Web
Why Epoxy does not generate model class? - Stack Overflow
I want to use Epoxy for my recyclerView with kotlin, but Epoxy Model does not generate PostModel_() class, what wrong with it?
Read more >How do you set OnClickListenrs in your AirBNB Epoxy Models ...
Holder>() { // Declare your model properties like this @EpoxyAttribute @StringRes var text = 0 @EpoxyAttribute(EpoxyAttribute.Option.
Read more >Kotlin Language Documentation 1.7.21
Create a project. Create an application. Run the application. What's next? Comparison to Java. Some Java issues addressed in Kotlin.
Read more >RecyclerViews made easy with Epoxy | by Sasikanth - Medium
addTo(EpoxyController) . But since we are using Kotlin we can use the generated extension functions to build the models. They will automatically ...
Read more >Epoxy - Models and Extensions - Part2 - - Seyed Jafari Blog
since we are using Kotlin one more thing Epoxy code-gen does for us is generating extension function for each of our models. using...
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
@elihart i solved it. change
annotationProcessor 'com.airbnb.android:epoxy-processor:2.2.0'
tokapt 'com.airbnb.android:epoxy-processor:2.2.0'
@minibugdev sorry, I wasn’t clear enough. It wasn’t a solution for you case - it was a proposal to @elihart how it could be possibly solved in a more kotlin way.
@JvmField
works as a temporary workaround tho.