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

Use assertions to verify Supplier never invoked by constructors #9

Open
realityforge opened this issue Feb 27, 2020 · 0 comments
Open
Labels
enhancement New feature or request
Milestone

Comments

@realityforge
Copy link
Collaborator

We should add java assertions to generated suppliers to verify that the supplier is not invoked in the binding code (i.e. @Injector constructors or provider methods on @Fragment types). It may also be able to assert that they are not invoked before the injector is initialized but it is unclear if this can be done safely in a concurrent scenario or is even reasonable to do in a concurrent scenario.

This would involve adding a flag to Injector that is set when fully initialized and then checking this flag inside supplier. To ensure this code is stripped in production builds the assignment and verification would need to be done via asserts like assert state = 1; and assert state != 0, "Supplier N invoked before component construction complete";

realityforge added a commit that referenced this issue Feb 27, 2020
@realityforge realityforge added the enhancement New feature or request label Feb 27, 2020
@realityforge realityforge added this to the 1.0 milestone Mar 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

No branches or pull requests

1 participant