-
Notifications
You must be signed in to change notification settings - Fork 25
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
Fix Prototype Factory Providers #540
Conversation
turns out we don't need a special method for lazyness
In that a |
Extracted this fix from #540 @prototype with Provider<T> currently produces code that registers Provider<Provider<T>> instead of Provider<T> and this fixes that.
Extracted this refactoring from #540 The existing .registerProvider() without a leading .asPrototype() is already a "lazy only once" style provider. This change uses that and then removes the LazyProvider and registerLazy() as they are no longer needed or used. This also changes the synchronized block to use a ReentrantLock in OnceProvider just in case the provider invocation does something interesting and using Java 21+ Virtual Threads.
Thanks. I've ended up pulling this out into 2 separate PRs because I kind of needed to do that to understand the changes and see the impact and also because we should really have bug fixes in their own PR and not combined with other things like a refactor. So yeah, created #541 and #542 and yes these are pretty much exactly what is in this PR. Cheers, Rob. |
Extracted this fix from #540 @prototype with Provider<T> currently produces code that registers Provider<Provider<T>> instead of Provider<T> and this fixes that.
Extracted this refactoring from #540 The existing .registerProvider() without a leading .asPrototype() is already a "lazy only once" style provider. This change uses that and then removes the LazyProvider and registerLazy() as they are no longer needed or used. This also changes the synchronized block to use a ReentrantLock in OnceProvider just in case the provider invocation does something interesting and using Java 21+ Virtual Threads.
Pull request was closed
Before, prototype scoped Providers were generating incorrectly.
Now can do:
And this will generate: