Guice 4.0 beta5 released

250 views
Skip to first unread message

Sam Berlin

unread,
Sep 25, 2014, 10:51:04 AM9/25/14
to google...@googlegroups.com
Yesterday we pushed out a 4.0 beta5 release for Guice.  It's available on maven central as usual.

Some notable changes since the last beta include:
  * Better java8 compatibility.
  * Various optimizations to speed things up & reduce allocations.
  * Added OptionalBinder for better optional bindings or bindings with default values.
  * Allow Keys from child injectors to be GC'd when the child injector gets GC'd.
  * Added a "testlib" extension with a new 'BoundFieldModule' to support easier binding in tests.
  
For changes since the last 3.0 release, see the commits & API diffs.

Special thanks to Colin Decker for building/staging the release!

sam

Roger Kapsi

unread,
Sep 29, 2014, 1:47:06 PM9/29/14
to google...@googlegroups.com
Hey,

one of our projects is fiddling with Dropwizard and Jersey 1.18.1. One of the things we need to do to make things work is overwrite the JerseyServletModule's webApp() provider method. It appears Guice 4.0 beta5 is introducing a new behavior that breaks the ability to overwrite provider methods.

1) Overriding @Provides methods is not allowed.
@Provides method: com.sun.jersey.guice.JerseyServletModule.webApp()
overridden by: com.squarespace.dropwizard.guice.GuiceBundleModule.webApp()
at com.google.inject.internal.ProviderMethodsModule.getProviderMethods(ProviderMethodsModule.java:128)

Sam Berlin

unread,
Sep 29, 2014, 1:53:02 PM9/29/14
to google...@googlegroups.com, lukeis...@gmail.com
[+luke]

Luke, do you think it'd be possible to allow overriding (maybe hidden behind a flag and also printing out a warning to the console)?  Maybe just if the return types are exactly the same?

sam

--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-guice...@googlegroups.com.
To post to this group, send email to google...@googlegroups.com.
Visit this group at http://groups.google.com/group/google-guice.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-guice/f3e636d4-286e-4ddc-bcdb-1c9ba7b37827%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luke Sandberg

unread,
Sep 29, 2014, 5:21:12 PM9/29/14
to Sam Berlin, google...@googlegroups.com

Here is the original thread where we discussed the change:
https://groups.google.com/forum/m/#!topic/google-guice/bRo5SvmzpdI

We discussed adding a flag to make this a warning instead of an error, I think we ended up not doing it because in the few cases where someone wanted to do this, there were other ways to solve the problem.

Have you tried using Modules.override?
We could add a flag or system property to control this, but it would be unfortunate to keep the flag forever.

Sam Berlin

unread,
Sep 29, 2014, 5:31:03 PM9/29/14
to Luke Sandberg, Roger Kapsi, google...@googlegroups.com
I talked a bit with Roger about this, and in this case the JerseyServletModule's is a third party thing that isn't easy to modify.  Modules.override is one solution, but I'm loath to suggest that folks use that for production modules.  I think a flag that prints out scary warnings (and defaults to off, but can be turned on for compatibility with Guice 3) is a decent solution.  Once we release Guice 4, we can drop the flag so it doesn't stick around forever.

sam

Luke Sandberg

unread,
Sep 29, 2014, 6:28:52 PM9/29/14
to Sam Berlin, google...@googlegroups.com, Roger Kapsi

SGTM
I can take this on next week (I'm currently on vacation)

Reply all
Reply to author
Forward
0 new messages