xiaodududu / google-guice

Automatically exported from code.google.com/p/google-guice
Apache License 2.0
0 stars 0 forks source link

Support annotating interfaces with their default implementation. #44

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
For example:

@DefaultImplementation(ServiceImpl.class)
interface Service {
  ...
}

This can be used when a compile time dependency on the implementation is
acceptable, but you still want the flexibility of proxying, mocking, etc.,
that comes with interfaces.

Original issue reported on code.google.com by crazybob...@gmail.com on 28 Feb 2007 at 6:56

GoogleCodeExporter commented 9 years ago
I like the intent -- discoverable default implementations -- but I'm not sure I 
like
the means.  Interface containing a hard reference to implementation just 
strikes me
as not very guicy.  We discussed once the idea of a package annotation which you
would use on the package containing the interfaces, which would identify a 
class that
implements Module, and I kind of think it should identify it by a relative 
String
("impl/FooModule") even though I know that's crappy.  Let's discuss further?

Original comment by kevin...@gmail.com on 28 Feb 2007 at 7:06

GoogleCodeExporter commented 9 years ago
Yeah, I probably won't implement this right away, so there's plenty of time to
discuss. Like I said, I'm not exactly worried about the compile time 
dependency. This
feature is just for people who want the maximum brevity and only care about the
remaining benefits of using interfaces, particular to unit testing.

Original comment by crazybob...@gmail.com on 28 Feb 2007 at 8:22

GoogleCodeExporter commented 9 years ago
Let's go ahead and get this in so we can get some experience with it.

Original comment by crazybob...@gmail.com on 28 Feb 2007 at 10:45

GoogleCodeExporter commented 9 years ago
Added in rev 251.

Original comment by crazybob...@gmail.com on 1 Mar 2007 at 9:50