Comment #10 on issue 271 by isaac.q.shum: Scopes.SINGLETON + null doesn't work http://code.google.com/p/google-guice/issues/detail?id=271
A first attempt is attached. It uses two different methods for SINGLETON and REQUEST / SESSION, but I can swap them or do whatever you all suggest. I'd like to add tests. I'm not sure where is best. It also introduces a test break below, which I can fix by changing the assert, but I'd need some guidance to track down the real cause of the bug. Thanks all. [junit] 2) testBindNullAsEagerSingleton(com.google.inject.NullableInjectionPointTest)junit.framework.AssertionFailedError: Expected "Guice provision errors: [junit] [junit] 1) null returned by binding at [unknown source] [junit] but com.google.inject.NullableInjectionPointTest$FooField.foo is not @Nullable [junit] while locating com.google.inject.NullableInjectionPointTest$Foo [junit] for field at com.google.inject.NullableInjectionPointTest$FooField.foo(NullableInjectionPointTest.java:171) [junit] while locating com.google.inject.NullableInjectionPointTest$FooField [junit] [junit] 1 error" to contain substring "null returned by binding at com.google.inject.NullableInjectionPointTest" [junit] at com.google.inject.Asserts.assertContains(Asserts.java:64) [junit] at com.google.inject.NullableInjectionPointTest.testBindNullAsEagerSingleton(NullableInjectionPointTest.java:161) [junit] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [junit] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [junit] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) Attachments: null_scope.diff 3.5 KB -- You received this message because you are listed in the owner or CC fields of this issue, or because you starred this issue. You may adjust your issue notification preferences at: http://code.google.com/hosting/settings --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "google-guice-dev" group. To post to this group, send email to google-guice-dev@googlegroups.com To unsubscribe from this group, send email to google-guice-dev+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/google-guice-dev?hl=en -~----------~----~----~----~------~----~------~--~---