Open bangonkali opened 4 years ago
It can not be public because Kotlin adds setters/getters for the fields and keeps it private
. The real fix here should be that the AP will check if this is a Kotlin class in order to use the appropriate getter, when accessing that field. @passy @pasqualeanatriello I could probably have a look at it if needed!
cc: @colriot
Hi @pavlospt , i'm just curious, what is AP in "The real fix here should be that the AP"?
I meant the Annotation Processor of Litho!
@bangonkali better workaround - use @JvmField
:)
This is a known issue. And as @pavlospt said, the correct fix would be to explicitly handle Kotlin properties as a special case (or JavaBeans-style in general). But you can force the Event property behave as AP required it to, by using @JvmField
annotation on each property.
Check this Codelab out for more info: https://github.com/facebook/litho/tree/master/codelabs/events#add-extra-info-to-boxitemchangedevent
Hi @colriot , thanks for directing me to this Codelab! Very useful!
I will leave it up to you guys about the status of this issue. But for now, this really helps!
My pleasure @bangonkali ! All feedback welcome, but keep in mind that these codelabs are in an in-progress state, so, you would be our early adopter :)
hey! is this issue still open? I am a newbie, can I work on this issue?
Hi @NishcheyBhutani . Issue is still open, but the open-source work has already been done by Pavlos. The blocker is in the internal integration at FB.
@colriot hey!so could u pls give me something beginner friendly(in this project or some other project) to which I could contribute....?
Version
Issues and Steps to Reproduce
Create a Kotlin Custom Event
Use this event in a Spec
You will see error
This is how it was compiled in Java
Special emphasis on
Expected Behavior
This should have been public because, in Kotlin, everything is public by default. Also, even if you mark it public it's still private 😢. The output should be something like this:
Workaround for now. Use Java
Link to Code
Intentionally not added because this is fairly easy to reproduce.
Please show some code we can use to reproduce this issue. Consider using PlaygroundComponentSpec to provide a small example of the issue