Hello,

i recently discovered (with Franz' help :) ) a bug regarding the usage of Picocontainers and the @nullable-Annotation.


---- what happened: -----

The ConnectionHandler depends optionally on IProxyResolver. The parameter is annotated with "@nullable", so, while getting the component, it should be ok if no proxyresolver is provided. (see the following code)


 public ConnectionHandler(final XMPPConnectionService connectionService,
        final TCPServer tcpServer, final MDNSService mDNSService,
        final IConnectionManager transferManager,
        @Nullable final IProxyResolver proxyResolver,
        final Preferences preferences) {


...................


The problem is, without a ProxyResolver getComponents() throws an UnsatisfiableDepency-Exception, so the nullable-annotation does NOT seem to behave as specified. As a Hotfix i added a second Constructor to ConnectionHandler without the proxyResolver-Parameter, since according to the picocontainer-documentation getComponents() returns the fitting constructor with the least amount of parameters. The fix worked and getComponents() did not threw an UnsatisfiableDepency-Exception anymore.

even if this worked in my case, if you think of a component which has multiple nullable-annotations, you can imagine the increase in necessary additional constructors for a fix.


regards,

M.Krummrei

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
DPP-Devel mailing list
DPP-Devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dpp-devel

Reply via email to