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
Fixing issue 362 and improvement #363
Conversation
…jector replacement to different class (single responsability)
…ven when delegates are used.
/** | ||
* Replaces Toothpick injector to be able to notify delegates. | ||
*/ | ||
object InjectorReplacer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
KTPInjector
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or just keep the method or create a proper subclass r.object only for the injector of KTP.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed.
I tried to use an extension functions from within the same package, but it doesnt work cause of the visibility. :(
} | ||
} | ||
init { | ||
InjectorReplacer.replace() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just do the assignment here and use a dedicated objwct
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cannot do it cause of visiblitiy. Otherwise we would need to make the field protected (instead of package-private) and extend Toothpick (which means, having to go back to companion and KTP.TP....
)
/** | ||
* Replaces Toothpick injector to be able to notify delegates. | ||
*/ | ||
object InjectorReplacer { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you make this internal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure
@@ -39,7 +39,7 @@ | |||
// its transformation | |||
private static final ConcurrentHashMap<Object, Scope> MAP_KEY_TO_SCOPE = | |||
new ConcurrentHashMap<>(); | |||
protected static Injector injector = new InjectorImpl(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
better package-private
5cacbc9
to
8ce314c
Compare
RTM. Thx a lot. Good changes ;) |
This PR contains the following changes:
These changes are improvements that do not change the public API.