-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Guice should never ever inject a null value #41
Comments
From limpbizkit on February 27, 2007 21:28:01 I imagine there are scenarios where null is reasonable. Suppose you have a service that checks permissions public class AccountService { IMHO, this particular situation doesn't really lend itself to a null-object pattern. But I do think injecting null is something you'd want to do very rarely. So perhaps instead of banning it |
From kevinb9n on February 28, 2007 11:17:34 I don't see why a null-object pattern wouldn't work here. But actually in this case Null is stinky... |
From crazyboblee on February 28, 2007 12:24:17 Or an anonymous/guest user. Down with null. |
From crazyboblee on February 28, 2007 14:45:08 (No comment was entered for this change.) Labels: 1.0RC3 |
From kevinb9n on March 01, 2007 02:58:35 Fixed with revision 248 . Status: Fixed |
From kevinb9n on February 27, 2007 14:58:17
Right now you can have a custom provider return null and I think guice will
inject the null value. We should add sanity checking to make sure guice
never injects null. This way people do not need to check for it in their
constructors etc., which in turn allows them to use null when they want
to in their unit tests (which is quite a helpful ability to have).
Original issue: http://code.google.com/p/google-guice/issues/detail?id=41
The text was updated successfully, but these errors were encountered: