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

Fix custom converter reflection based initialization #10

Open
FabianTerhorst opened this issue May 23, 2016 · 1 comment
Open

Fix custom converter reflection based initialization #10

FabianTerhorst opened this issue May 23, 2016 · 1 comment
Labels

Comments

@FabianTerhorst
Copy link
Owner

https://github.com/FabianTerhorst/FastLayout/blob/master/fastlayout-processor/src/main/java/io/fabianterhorst/fastlayout/processor/LayoutProcessor.java#L107 is throwing a exception every time.

@Alexander--
Copy link

I haven't had much time to read the code, but it looks like you are attempting to directly instantiate a class from annotated code (before it have been compiled). Naturally, this won't work (it is throwing something like MirroredTypeException, isn't it?)

Paperparcel have a neat, working implementation of pluggable converters: it searches for annotated classes like you do, then generates a code, which adds them to Map at runtime, somewhere during initialization of generated boilerplate. This allows you to retrieve user converters without reflection and use them at runtime by utilising polymorphism (they all inherit from specialized interface).

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

2 participants