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

Check for PreferenceInjector.inject call at compile time #19

Open
denley opened this issue Mar 7, 2015 · 2 comments
Open

Check for PreferenceInjector.inject call at compile time #19

denley opened this issue Mar 7, 2015 · 2 comments

Comments

@denley
Copy link
Owner

denley commented Mar 7, 2015

It would improve UX to check that the user has properly called PreferenceInjector.inject and PreferenceInjector.stopListening (if necessary) in the target class if there are annotations present.

This may not actually be possible, especially when dealing with inheritance.

denley added a commit that referenced this issue Jul 25, 2015
Classes that contain at least one `@BindPref` annotation
are now checked at compile-time to properly call
PreferenceBinder.bind(this), and PreferenceBinder.unbind(this)
(if there is at least one annotation without `listen=false`).

This serves to shorten the length of time between the user
forgetting the method call and becoming aware of the issue.

Fixes #19
@denley
Copy link
Owner Author

denley commented Jul 25, 2015

It turns out this is possible using java's Compiler Tree API. It has been implemented using a technique from this stackoverflow answer

@denley
Copy link
Owner Author

denley commented Aug 3, 2015

This feature seems to have some compatibility issues. It really needs to work perfectly as it can cause unfixable compilation errors when it functions incorrectly.

I'm going to remove this feature pending extensive testing on a range of use cases and build cases.

@denley denley reopened this Aug 3, 2015
denley added a commit that referenced this issue Aug 3, 2015
 The feature is unstable and pending unit testing and bug fixes.

 #19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant