-
Notifications
You must be signed in to change notification settings - Fork 44
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
bind[F[T]], where T is a value type (long, int, etc), does not work with @Inject constructors #56
Comments
I just started hitting this as well. @woparry did you ever find a workaround? |
@chrisbenincasa I'm working on solution. I have it done, respectively, but I'm still uncertain if I don't break something, because my fix is backward incompatible. I solved it using a macro. |
What about making the type I'm not sure if there is a way to intercept the Injection and do the above automatically. |
Unfortunately I discovered there is a problem with binding Scala types. I'm fighting it. |
I believe there is no way how to intercept getting an instance from the |
@tsuckow @chrisbenincasa @woparry Guys, I have bad news. I spent many hours with research and made a big effort to solve this issue, however it cannot be done. Here is why. The problem lies in Java and Scala type system. In Java, you're unable to create "Hey, lets change the type on-the-fly to some object and back when injecting" you may say - at least I did. So, when binding, we are able to change the type which is being bound (e.g. by macro defining a custom So, for me the outcome is we would have to change the Guice itself. Before that being done, we have to use Java types when using generic type parameters (basically what @tsuckow suggested above, even though it's very sad). |
Is there any news on this? From what I understand, the workaround is to use |
example:
Note that it works fine if you use @provides instead
or if T is a reference type
The text was updated successfully, but these errors were encountered: