-
Notifications
You must be signed in to change notification settings - Fork 114
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
TP 3 Draft Specs #225
Comments
Let me share my thoughts on it.
|
|
|
|
BTW, why nobody else has commented on this? This topic needs discussion, for the good of this fantastic library. |
I really like the idea of releasable singletons with an annotation since our team wanted to increase the performance of tp by caching classes that had no state but these "singletons" could be cleaned out and recreated since we only made it singleton to speed up the injection. Basically lazy garbage collection. |
TODO: better CHANGELOG, README, and wiki landing page. To be updated for TP3. |
Ticket closed as all was released in 3.0.0 |
This issue is a central hub for the specifications of TP 3. It can refer to more detailed issues but should offer a summary of the features we plan for the next major release of TP.
Releasable singletons
We should release all internal providers under memory pressure, but not automatically as some can't recover their state. Thus, users should have full control over this. We should provide different mechanisms to let user mark classes whose singletons can be released:
Details in #212
Better scope annotations
For now, only "singleton classes" can be annotated to indicate in which scope TP should create an instance of theses classes. We want to extend this mechanism, which actually breaks the JSR 330, and allows things like:
Which means Foo can only be created by TP inside a scope that supports the
@ActivityScope
, but withoutFoo
being a singleton. A singleton would be expressed by:Note that this new notation is just making more clear and distinct to which scope entities belong and how they are recycled. These 2 concepts are currently entangled in JSR 330. Also, using the new annotation model will still preserve the strong contract of
being a singleton of the root scope, as everyone would expect.
This change should not require any binding API changes.
Better TP API
Changing the API will also help users to be sure of which TP version they are using and avoid misinterpreting the new annotation model.
Toothpick.inject(foo, scope)
-->scope.inject(foo)
, more details in Change scope API to allow a scope to inject #217.give a base class to factories and MemberInjectors? to limit the generated code size(Create base class for Factories and MI? #347).Improve Examples
toothpick-sample
tests are failing #337)KTP
#316
Documentation
Misc
Being able to test scope graph at build time using unit tests(test scope graph at build time using unit tests #348)other ideas
Add an annotation
@ShouldBeLazy
so that a class can only be injected lazily. This could help for instance to delay the creation of some network related classes..The text was updated successfully, but these errors were encountered: