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

Duplicate Binding: ScalaModule believes A == A with B. #43

Open
nbauernfeind opened this issue Feb 6, 2015 · 1 comment
Open

Duplicate Binding: ScalaModule believes A == A with B. #43

nbauernfeind opened this issue Feb 6, 2015 · 1 comment
Labels
Milestone

Comments

@nbauernfeind
Copy link
Member

@shengc Provided an example that involves a binding error when it probably shouldn't be.

trait A { def a {} }
trait B

type AB = A with B

class Model extends AbstractModule with ScalaModule {
    def configure() {
        bind[A].toInstance(new A {})
        bind[AB].toInstance(new A with B {})
    }
}

Guice.createInjector(new Model()) // This fails at run time. Guice thinks binds are dups.
@tsuckow
Copy link
Member

tsuckow commented Jul 11, 2018

This could get interesting because AFAICT there is no Java type to represent a mixin. Scala appears to call this a "refined type".

Now, I am not sure if Guice actually cares about the iternals of the type or if we could make up a new class that extends Java.lang.reflect.type and call it a day.

tsuckow added a commit that referenced this issue Jul 11, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants