Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin inaccessable field support #541

Closed
GregHib opened this issue Nov 7, 2018 · 2 comments
Closed

Kotlin inaccessable field support #541

GregHib opened this issue Nov 7, 2018 · 2 comments
Labels

Comments

@GregHib
Copy link

GregHib commented Nov 7, 2018

Artemis fails to access @EntityId fields via reflection ReflectionException: Illegal access to field, because of the way Kotlin generates getters and setters which leaves the field itself private. See IntFieldMutator.

@HybridEidolon
Copy link

A workaround is to add the @JvmField annotation to the property, but I am not certain that will work well if you have explicit get/set definitions.

Not having any experience with artemis, it seems that com.artemis.utils.reflect.Field should have an abstraction over getter/setter method pairs in addition to delegating to the java.lang.reflect.Field in order to support this use case, and using those if they're present over the field itself. This would make all mutators work on JVM in the general case.

@DaanVanYperen
Copy link
Collaborator

Added a wiki page to help out Kotlin users.
https://github.com/junkdog/artemis-odb/wiki/Kotlin

The @JvmField workaround should suffice for now, i'm putting this in the freezer as a nice-to-have. If we ever find the time @HybridEidolon solution would be the way to go.

@DaanVanYperen DaanVanYperen mentioned this issue Jan 2, 2019
16 tasks
DaanVanYperen added a commit that referenced this issue Jan 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants