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

On Mon, Sep 29, 2014 at 5:21 PM, Luke Sandberg <[email protected]>
wrote:

> 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.
>
> On Sep 29, 2014 7:52 AM, "Sam Berlin" <[email protected]> wrote:
> >
> > [+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
> >
> >
> > On Mon, Sep 29, 2014 at 1:47 PM, Roger Kapsi <[email protected]> wrote:
> >>
> >> 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)
> >>
> >>
> >> On Thursday, September 25, 2014 10:51:04 AM UTC-4, Sam Berlin wrote:
> >>>
> >>> 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
> >>
> >> --
> >> 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 [email protected].
> >> To post to this group, send email to [email protected].
> >> 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.
> >
> >
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
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/CAJEBNUe0R08HCbH3O-Jf1S%2BWZPMA5ic6UuLXsL%2BvNX9OOQceUQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to