Guice v2 Update

4 views
Skip to first unread message

limpb...@gmail.com

unread,
Sep 10, 2008, 1:37:05 AM9/10/08
to google-guice
I'd promised Guice 2.0 for 'summer 2008',
and here we are, with ten days left before
fall 2008. Time is up, but the promised
features are still incomplete!

What we're behind on...

Hierarchical Injectors. These need some
serious love. We need this internally at
Google, and I really want to make sure this
is done right.

Struts2, Servlets, OSGi. I've got to go
through some patches from Stuart and
Dhanji to get these things working nicely.

Circular Dependencies. I want to rewrite
the injection loop so we can do circular
dependencies cleanly without proxies.

The Plan...

The code has come a long, long way since
Guice 1.0 and I'd quite like it if we could
get something of release quality out for
folks to start using. I'm thinking of polishing
up the current code (Javadocs, etc.) and
calling it 'Guice 2.0'.

Even without the new features it's still a
huge update, and worthy of your time to
upgrade. (hello, @Provides)

Once that's available, I'll keep working, and
get Guice 2.1 out during 'fall 2008'. This
should contain all of the slipped features.

How you can help...

Run your application's test suite using today's
snapshot, and report any regressions:
http://code.google.com/p/google-guice/downloads/detail?name=guice-snapshot20080909.jar

Try out the new APIs, and reply with your
comments. Recent Javadoc is here:
http://google-guice.googlecode.com/svn/trunk/latest-javadoc/index.html

Thanks,
Jesse

Brian

unread,
Sep 10, 2008, 8:51:37 AM9/10/08
to google-guice
I would definitely remove the current h. injector implementation for
2.0.
Brian
>  http://code.google.com/p/google-guice/downloads/detail?name=guice-sna...

Brian Pontarelli

unread,
Sep 10, 2008, 11:32:38 AM9/10/08
to google...@googlegroups.com
As the maintainer of Savant, I wanted to ask about versioning of Guice.

Is 2.0 runtime compatible with 1.0? If it is, I'd strongly urge you to
reconsider naming it to 1.1 or 1.5 or something like that.

Savant (along with other dependency management tools) by default
treats major versions as completely non-compatible and breaks your
build if it notices that your dependency graph is using different
majors. I can change the Guice meta-data in the Savant repository to
indicate that Guice is "major-compatible", meaning that it is
compatible across major versions, but this is dangerous and if 3.0 is
non-compatible, things will get messy.

On the flip-side, if 2.0 is not compatible at compile or runtime, the
version makes sense.

-bp

Karthik Krishnan

unread,
Sep 10, 2008, 2:38:49 PM9/10/08
to google...@googlegroups.com
Two requests/questions?
 
1. Is this going to be mavenized now or when the updates are done?
2. Can we have tutorials/documentation/usage guide (whatever you wish to call it) on the new API? One of my enduring peeves with Google code is that the documentation is often insufficient.  We don't get Robbie's Guice 1.0 book here in India unless we shell out nearly 1500 bucks in local currency (which is a large amount no matter what the currency :) ).
 
Thanks,
 
Karthik Krishnan

Bob Lee

unread,
Sep 10, 2008, 3:36:21 PM9/10/08
to google...@googlegroups.com
On Tue, Sep 9, 2008 at 10:37 PM, je...@swank.ca <limpb...@gmail.com> wrote:
The code has come a long, long way since
Guice 1.0 and I'd quite like it if we could
get something of release quality out for
folks to start using. I'm thinking of polishing
up the current code (Javadocs, etc.) and
calling it 'Guice 2.0'.

Even without the new features it's still a
huge update, and worthy of your time to
upgrade. (hello, @Provides)

Once that's available, I'll keep working, and
get Guice 2.1 out during 'fall 2008'. This
should contain all of the slipped features.

Let's not try to rush a release out on such short notice. "Summer 2008" was just a random date we pulled out of our asses.

I know everyone is excited about 2.0, but we're in no danger of slipping perpetually. We have a concrete, minimal list of features we plan on including. We should take as much time as is necessary to polish and document those features because it goes without saying, we will be stuck with them indefinitely.

We need to build some real extensions on top of the new features before I'll be comfortable rubber stamping them. For example, I'd like to see a scope validator and maybe even an update to our Eclipse plugin.

As for the version number, this feels like a 2.0 to me.

Finally, I think I should take on hierarchical injectors. This is sticky territory. To those who are afraid the feature will be confusing, we could only expose hierarchical injectors through the SPI. For example, instead of creating a child injector through Guice.createInjector(), you could call com.google.inject.spi.HierarchicalInjectors.create(Injector parent, ...).

Bob

Marko Kocić

unread,
Sep 10, 2008, 4:30:10 PM9/10/08
to google-guice
On 10 сеп, 21:36, "Bob Lee" <crazy...@crazybob.org> wrote:
> On Tue, Sep 9, 2008 at 10:37 PM, je...@swank.ca <limpbiz...@gmail.com>wrote:
>
> Let's not try to rush a release out on such short notice. "Summer 2008" was
> just a random date we pulled out of our asses.

Agree. Let's better 2.0 be rock solid, since it will going to have a
lot of press.

> I know everyone is excited about 2.0, but we're in no danger of slipping
> perpetually. We have a concrete, minimal list of features we plan on
> including. We should take as much time as is necessary to polish and
> document those features because it goes without saying, we will be stuck
> with them indefinitely.

That's why 2.0 beta/alpha is important. Doing 2.0 without a single
prerelease will not get much testing of new features from the users.
Random snapshots are just not enough.

Dhanji R. Prasanna

unread,
Sep 10, 2008, 7:24:00 PM9/10/08
to google...@googlegroups.com
On Thu, Sep 11, 2008 at 5:36 AM, Bob Lee <craz...@crazybob.org> wrote:


Finally, I think I should take on hierarchical injectors. This is sticky territory. To those who are afraid the feature will be confusing, we could only expose hierarchical injectors through the SPI. For example, instead of creating a child injector through Guice.createInjector(), you could call com.google.inject.spi.HierarchicalInjectors.create(Injector parent, ...).

Good call, make the barrier to entry high enough that people will respect its complexity.

Dhanji.

Jan Kriesten

unread,
Sep 11, 2008, 12:34:53 AM9/11/08
to google...@googlegroups.com

Hi Jesse,

> Run your application's test suite using today's
> snapshot, and report any regressions:

I can't use that version at the moment (see my mail 'trunk: @Inject @Named error').

I really like guice and would be sorry if that would remain the case and would
stop being able to use guice with other JVM languages than Java.

Best regards, --- Jan.

limpb...@gmail.com

unread,
Sep 11, 2008, 2:19:46 AM9/11/08
to google-guice


On Sep 10, 12:36 pm, "Bob Lee" <crazy...@crazybob.org> wrote:
> Let's not try to rush a release out on such short notice. "Summer 2008" was
> just a random date we pulled out of our asses.

Sounds good. So V2 won't be out in summer 2008
as originally planned. I'll upload a proper snapshot
with complete binaries for users who want to get the
stable Guice 2 features early.

> We need to build some real extensions on top of the new features before I'll
> be comfortable rubber stamping them. For example, I'd like to see a scope
> validator and maybe even an update to our Eclipse plugin.

Volunteers?

> Finally, I think I should take on hierarchical injectors. This is sticky
> territory. To those who are afraid the feature will be confusing, we could
> only expose hierarchical injectors through the SPI. For example, instead of
> creating a child injector through Guice.createInjector(), you could call
> com.google.inject.spi.HierarchicalInjectors.create(Injector parent, ...).

I think the most important aspects of hierarchical
injectors are expressing hierarchy in modules, and
addressing the assistedinject use case.

Thanks Bob.

tzwoenn

unread,
Sep 11, 2008, 6:28:12 AM9/11/08
to google-guice
For those who need nightly shapshots have a look at
http://www.kamalook.de:8080/hudson/job/Guice/lastBuild/com.google.inject$guice/

As speaking of "real extensions" I can provide an EJB 3.x stack (work
in progress) based on upcoming Guice's features (hierarchical
injectors, MultiBinder, Binder.getProvider(), e.g.).

Kamil Demecki

unread,
Sep 11, 2008, 9:30:08 AM9/11/08
to google-guice


On Sep 10, 2:51 pm, Brian <medo...@gmail.com> wrote:
> I would definitely remove the current h. injector implementation for
> 2.0.
> Brian
>

No ! ;> Hierarchical injector is only solution for runtime bindings.

Logan Johnson

unread,
Sep 11, 2008, 9:33:18 AM9/11/08
to google...@googlegroups.com
"runtime bindings"?

that doesn't sound good.

Brian

unread,
Sep 12, 2008, 10:25:35 AM9/12/08
to google-guice

georgo

unread,
Sep 12, 2008, 11:12:00 AM9/12/08
to google-guice
I felt quite comfortable with using the tags from svn. A simple
guice-2.0-09082008 Snapshot tag would do well for me. Anybody who
wants can execute the build, create the jar and deploy it to wherever
he/she wants to (for me it'd be the maven repository :-)). Google
collections handle that somehow like this I think.

Georg

Kamil Demecki

unread,
Sep 13, 2008, 8:41:21 AM9/13/08
to google-guice


On Sep 11, 3:33 pm, "Logan Johnson" <logan.john...@gmail.com> wrote:
> "runtime bindings"?
> that doesn't sound good.
>
>


I think it is the best solution to some type of problems, specialy if
you need start up system, you dont have enough information at begin,
and cant configure system injector in one step. I thought a lot of
this problem and it is cool that hierarchical injectors provide
solution to this. It is advanced feature and must be used with careful
but is needed (imho mandatory).

Kamil Demecki

unread,
Sep 13, 2008, 10:16:28 AM9/13/08
to google-guice
I see that is another option described in
http://groups.google.com/group/google-guice/msg/183947c897535e8b. I'm
curious if it is enough to this case, but hierarchical injectors seems
to me natural to this case.

Alen Vrečko

unread,
Sep 16, 2008, 2:55:13 PM9/16/08
to google-guice
Just tried out the current HI from trunk, I don't get the child child
injector to respect the singleton. Am I missing something?

The code

Injector injector = Guice.createInjector(new AbstractModule() {
protected void configure() {
bind(EnergySource.class).to(Plutonium.class);
bind(DeLorean.class).in(Singleton.class);
}
});

Injector childInjector = Guice.createInjector(injector);

Injector childChildInjector = Guice.createInjector(childInjector,
new AbstractModule() {
protected void configure() {
// provision exception if this is not declared?
bind(EnergySource.class).to(LightningBolt.class);
}
});

injector.getInstance(DeLorean.class) ==
childInjector.getInstance(DeLorean.class)

but

childInjector.getInstance(DeLorean.class) !=
childChildInjector.getInstance(DeLorean.class)

the constructor of DeLorean gets called 2 times. Would have expected
it to work all the way down, it's turtles all the way down:)

Cheers,
Alen

Brian

unread,
Sep 17, 2008, 12:03:21 AM9/17/08
to google-guice

Leigh Klotz

unread,
Oct 10, 2008, 7:15:12 PM10/10/08
to google-guice
I see there is now a download for guice-snapshot20080909.jar on this
project's downloads page.

The download jar doesn't include multibindings or assisted inject, so
in order to use those features I need to build anyway.

Unfortunately, there is no corresponding tag for snapshot20080909 in
SVN so I had to do this:
svn checkout -r 619 http://google-guice.googlecode.com/svn/trunk
ant dist

It would be nice if there were an SVN tag for r619 like there is for
the other snapshots, or if there were download jars for the extensions
for snapshot20080909.

Leigh.
Reply all
Reply to author
Forward
0 new messages