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";
We should add java assertions to generated suppliers to verify that the supplier is not invoked in the binding code (i.e.
@Injectorconstructors or provider methods on@Fragmenttypes). 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;andassert state != 0, "Supplier N invoked before component construction complete";