roboguice/roboguice — pull request #173 by stephanenicolas (2014-01-20 21:05:00+00:00)
Title: Try some optimization to speed up start up time. Clean up.

Mentionned in PR #169, this is an attempt to limit the space search for RoboGuice when injecting stuff. It will discard a few classes that can't receive injections.

The main Idea is expressed by the javadoc of the new GuiceInjectionMonitor's javadoc :

/*
* Monitors the state of type hierarchy when injecting a given type via Guice.
* This class allows to prune the type hierarchy when looking for injection points.
* It is based on the following observations :
*

* If a class A extends B and B extends C,
* then if B is inside android package, then B can't
* contains injections points.
*
* If B is inside RoboGuice package, or "subpackages", then it may
* receive injections. A is probably a custom app class or a roboguice test
* and it may contain injections as well. But if C doesn't belong to roboguice,
* then we went too high inside the type hierarchy and it's not worth having a look
* at class C and ascendants.
*

* @author SNI
*/

I am afraid of the impact on obfuscation, and would love to hear from any given measure of the optimization, apart from rationale and experience.

I this track is valid, there might be even harder optimizations to find like only making Views or Activities or Fragment aware of view injections, stuff like that.