Skip to content
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

Support Scala Set with Guice Multibindings #4

Open
tsuckow opened this issue Feb 3, 2012 · 7 comments
Open

Support Scala Set with Guice Multibindings #4

tsuckow opened this issue Feb 3, 2012 · 7 comments

Comments

@tsuckow
Copy link

tsuckow commented Feb 3, 2012

Guice expects a java Set for multibindings requiring a second constructor to do the translation. It would be nice if we supported directly injecting a Scala mutable.Set

Have this:

class MyActor( val stuff:MutableSet[MyType] ) {
  @Inject() def this( stuff:java.util.Set[MyType] ) = this( asScalaSet(stuff) )

Want this:

class MyActor @Inject() ( val stuff:MutableSet[MyType] ) {
@benlings
Copy link
Owner

I don't know if it's possible to do this in a generic way. Guice requires generic types to have all type parameters fully specified.

@tsuckow
Copy link
Author

tsuckow commented Mar 9, 2012

I attended the Guice Hangout yesterday. Their recommendation (after several non-ideal recommendations) was to make our own newSetBinder function that calls the real one under the hood and then injects a provider for the Scala Set.

Hopefully I will have time to look at this the last week in March, but no guarantees.

@tsuckow
Copy link
Author

tsuckow commented Mar 18, 2012

Ok, I got a basic prototype working. Going to work on integrating into this library and making the syntax jive.

@benlings
Copy link
Owner

Let me know when you think it's ready and I'll look at merging it in. I'll need to read up a bit on how multibindings work. I'm aware of them, but haven't used them myself.

@tsuckow
Copy link
Author

tsuckow commented Mar 27, 2012

Alright, I got them added. Note that I ported to Guice 3.0 and updated sbt. I have the Guice2 branch that has some older code for multibindings, most could be backported I believe. I am not using Guice2 so I didn't fiddle with that.

http://ci.codingwell.net/job/Scala-Guice/

Not sure if you want me to do a pull request. I am new to this work flow on github.

@benlings
Copy link
Owner

I'm new to it too... I should have some time in the next week to review your branch.

@ijuma
Copy link

ijuma commented May 10, 2012

What is the status of this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants