I'm in the process of upgrading from a really old snapshot of Guice2 to the
newest version. For the most part, it's straightforward. The only real
catch is the new AssistedInject (using @Inject instead of @AssistedInject,
naming @Assisted parameters and it internally using child injectors). One
particular change that threw me for a loop is the null handling for the
assisted parameters. I received an error:
com.google.inject.ProvisionException: Guice provision errors:
1) null returned by binding at
org.limewire.core.api.support.LocalClientInfoFactory.createLocalClientInfo()
but parameter 2 of
org.limewire.core.impl.support.LocalClientInfoImpl.<init>() is not @Nullable
while locating java.lang.String annotated with
@com.google.inject.assistedinject.Assisted(value=detail)
for parameter 2 at
org.limewire.core.impl.support.LocalClientInfoImpl.<init>(LocalClientInfoImpl.java:43)
while locating org.limewire.core.impl.support.LocalClientInfoImpl
while locating org.limewire.core.api.support.LocalClientInfo
1 error
at com.google.inject.InjectorImpl$4.get(InjectorImpl.java:767)
at
com.google.inject.assistedinject.FactoryProvider2.invoke(FactoryProvider2.java:218)
at $Proxy17.createLocalClientInfo(Unknown Source)
at
org.limewire.ui.support.FatalBugManager.handleFatalBug(FatalBugManager.java:57)
at org.limewire.ui.swing.Initializer$9.run(Initializer.java:544)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
at
java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
at
java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
at
java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
My take on that is that code somewhere is calling
LocalClientInfoFactory.createLocalClientInfo with a null second parameter.
Previously, this was allowed. With the new code, it isn't allowed.
Is this an expected change? I can see requiring @Nullable for bindings, but
for @Assisted parameters where the code is being called explicitly, it
doesn't seem as clear to me. It's easy enough to change, but this should
atleast be documented.
Sam
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"google-guice" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-guice?hl=en
-~----------~----~----~----~------~----~------~--~---